Home»Math Guides»Integrating Factor Solved Example 3
How to find the Integrating Factor for solving Ordinary Differential Equations (ODEs)
Let’s find and simplify a really difficult integrating factor involving trigonometry, but we won’t be asked to solve the ODE completely.
Example problem: Find and simplify the integrating factor for the following ODE: \(\frac{{dy}}{{dx}} + \frac{{\sin (2x)}}{{2\left( {1 + {{\sin }^2}(x)} \right)}}y = 1\)
The ODE is in the correct form to be able to find the integrating factor, so now we find e to the power of the integral of everything before the “y” term.
\[\mu (x) = {e^{\int {\frac{{\sin (2x)}}{{2\left( {1 + {{\sin }^2}(x)} \right)}}dx} }}\]
Let’s consider the following integral:
\[\int {\frac{{\sin (2x)}}{{2\left( {1 + {{\sin }^2}(x)} \right)}}} dx\]
You should know the following trigonometry identity:
\[\sin \left( {2x} \right) = 2\sin \left( x \right)\cos \left( x \right)\]
Substituting in this trigonometric identity,
\[\int {\frac{{2\sin \left( x \right)\cos \left( x \right)}}{{2\left( {1 + {{\sin }^2}(x)} \right)}}} dx\]
\[\int {\frac{{\sin \left( x \right)\cos \left( x \right)}}{{\left( {1 + {{\sin }^2}(x)} \right)}}} dx\]
Now use regular substitution. If you let u be the denominator of the expression above, the derivative of that looks similar to the numerator.
Let \(u = 1 + {\sin ^2}\left( x \right)\), then \(du = 2\sin (x)\cos (x)dx\)
Be careful with above, to derive a squared trigonometric function remember the original chain rule, you need to bring the 2 down, derive it, and also multiply by the original function too.
We substitute u and du into the integral.
\[\frac{1}{2}\int {\frac{{du}}{u}} \]
Integral of a reciprocal is the natural logarithm, ln with absolute symbols, to remove the absolute symbol you need to assume x > 0.
\[\frac{1}{2}\int {\frac{{du}}{u}} \]
You do need to add an integrating constant, but you can explain that it gets removed, because e to the power of a constant is another constant.
Substitute u back, to get in terms of x
\[\frac{1}{2}\ln \left| {1 + {{\sin }^2}(x)} \right|\]
Remember that it’s e to the power of this expression.
\[\mu = {e^{\frac{1}{2}\ln \left| {1 + {{\sin }^2}(x)} \right|}}\]
If you assume x > 0, you can remove the absolute signs. Then, e and ln will “cancel out”.
Before cancelling them, you can move the coefficient 1/2 to be the power of the expression, see logarithm and exponential laws.
\[\mu = {e^{\ln {{\left| {1 + {{\sin }^2}(x)} \right|}^{\frac{1}{2}}}}}\]
To the power of 1/2 is the same as a square root symbol over the terms. Then cancel e and ln out.
\[\mu = \sqrt {1 + {{\sin }^2}(x)} \]
For the condition that x > 0. And we’ve simplified the integrating factor as much as we could.
How to double-check the solution of your ODE integrating factor math problem using MATLAB
Do you want to double-check if the solution to the ODE math problem you were given is correct? But these problems are difficult, and don’t fit if you try a regular or graphing calculator. If only there was a “special calculator” that could find the solutions to ODEs….
But, there is! A program called MATLAB!
As long as your problem has an analytical solution you can use MATLAB’s symbolic solvers such as dsolve to find the analytical solution!
Note: it needs to be a question where you’re able to find an answer in the form of an equation, if you’re asked to find the “numerical solution” to an ODE you can’t do this!
You can use the following script m-file we made, if you have a different problem you can change the variable names and the equation itself, you don’t need to explicitly separate the derivative term either.
%bai-gaming.com/math-guides
syms y(x) x
eqn = diff(y,x) + (sin(2*x))/(2*(1+((sin(x))^2)))*y == 1;
S = dsolve(eqn)
Try an even harder integrating factor problem that has a rational function and an arctan function!