Linear second order not exact but solved by finding an M integrating factor.
Example 1
Example 2

ode internal name "linear_second_order_ode_solved_by_an_M_integrating_factor"

This is another method to find integrating factor method for the second order ode. This method of finding an integrating factor is not a general one like the above using \(\mu \left ( x\right ) \) but it is easier to check. This is tried first and if this does not work, then the above will be tried.

Given the ode, normalized so that the coefficient of \(y^{\prime \prime }\) is one

\begin{equation} y^{\prime \prime }+Q\left ( x\right ) y^{\prime }+R\left ( x\right ) y=f\left ( x\right ) \tag {1}\end{equation}

Let there exists an integrating factor \(M\left ( x\right ) \) such that

\begin{equation} \left ( M\left ( x\right ) y\right ) ^{\prime \prime }=M\left ( x\right ) f\left ( x\right ) \tag {2}\end{equation}

Then it can be integrated twice and solved. To find \(M\), the above becomes

\begin{align} \left ( M^{\prime }y+My^{\prime }\right ) ^{\prime } & =Mf\nonumber \\ M^{\prime \prime }y+M^{\prime }y^{\prime }+M^{\prime }y^{\prime }+My^{\prime \prime } & =Mf\nonumber \\ My^{\prime \prime }+y^{\prime }\left ( 2M^{\prime }\right ) +M^{\prime \prime }y & =Mf\nonumber \\ y^{\prime \prime }+y^{\prime }\left ( 2\frac {M^{\prime }}{M}\right ) +\frac {M^{\prime \prime }}{M}y & =f \tag {2A}\end{align}

Comparing (2A) to (1) gives

\begin{align*} 2\frac {M^{\prime }}{M} & =Q\\ \frac {M^{\prime \prime }}{M} & =R \end{align*}

Or

\begin{align} M^{\prime }-\frac {1}{2}MQ & =0\tag {3}\\ M^{\prime \prime }-MR & =0 \tag {4}\end{align}

Starting with (3) gives \(M=e^{\frac {1}{2}\int Qdx}\). If this also satisfies (4), then \(M\) is found by integration. If not, then this method did not work.

Example 1

\[ y^{\prime \prime }-4xy^{\prime }+\left ( 4x^{2}-2\right ) y=0 \]

Hence \(Q=-4x\) and \(R=\left ( 4x^{2}-2\right ) ,f\left ( x\right ) =0\). Eq(3) becomes

\[ M^{\prime }-\frac {1}{2}MQ=0 \]

Therefore

\begin{align*} M & =e^{\frac {1}{2}\int Qdx}\\ & =e^{\frac {1}{2}\int -4xdx}\\ & =e^{-x^{2}}\end{align*}

Now we much check that equation (4) is verified with such \(M\).

\begin{align*} M^{\prime } & =-2xe^{-x^{2}}\\ M^{\prime \prime } & =-2e^{-x^{2}}-2x\left ( -2e^{-x^{2}}\right ) \\ & =-2e^{-x^{2}}+4xe^{-x^{2}}\end{align*}

Substituting these in (4) gives

\begin{align*} \left ( -2e^{-x^{2}}+4xe^{-x^{2}}\right ) -e^{-x^{2}}\left ( 4x^{2}-2\right ) & =0\\ -2e^{-x^{2}}+4xe^{-x^{2}}+2e^{-x^{2}}-4x^{2}e^{-x^{2}} & =0\\ 0 & =0 \end{align*}

\(M\) is satisfied. Therefore the integrating factor is

\[ M=e^{-x^{2}}\]

Eq (2) now becomes

\begin{align*} \left ( My\right ) ^{\prime \prime } & =0\\ My^{\prime } & =c_{1}\\ My & =c_{1}x+c_{2}\\ y & =\frac {c_{1}x+c_{2}}{M}\\ & =\left ( c_{1}x+c_{2}\right ) e^{x^{2}}\end{align*}

Which is the same answer found using the more general method of \(\mu \left ( x\right ) \) in the above section but this is simpler when it works since it does not involve solving another ode (the adjoint ode) to find an integrating factor.

Example 2 Here is an example where the method of integrating factor does not work.

\[ y^{\prime \prime }+\frac {1}{x}y^{\prime }+\frac {1}{x}y=0 \]

Here \(p=1,q=\frac {1}{x},r=\frac {1}{x},f\left ( x\right ) =0\). The condition of exactness is

\begin{align*} p^{\prime \prime }-q^{\prime }+r & =0\\ 0-\left ( -\frac {1}{x^{2}}\right ) +\frac {1}{x} & =0 \end{align*}

Is not satisfied. Hence the ode is not exact. Therefore let us try to find \(M\). Using

\begin{align*} M & =e^{\frac {1}{2}\int qdx}\\ & =e^{\frac {1}{2}\ln x}\\ & =\sqrt {x}\end{align*}

Therefore \(M^{\prime }=\frac {1}{2}x^{\frac {-1}{2}}\) and \(M^{\prime \prime }=-\frac {1}{4}x^{\frac {-3}{2}}\). Substituting these in (4) to verify gives (using \(r=x^{-1}\))

\begin{align*} -\frac {1}{4}x^{\frac {-3}{2}}-x^{\frac {1}{2}}\left ( x^{-1}\right ) & =0\\ -\frac {1}{4}x^{\frac {-3}{2}}-x^{-\frac {1}{2}} & =0 \end{align*}

Which does not verify as the LHS is not zero. Therefore the integrating method did not work on this ode.

An easier method to find if an \(M\) integrating factor exists is the following. Since \(M=e^{\frac {1}{2}\int qdx}\) then substituting this into (2A) gives

\[ y^{\prime \prime }+y^{\prime }\left ( 2\frac {M^{\prime }}{M}\right ) +\frac {M^{\prime \prime }}{M}y=f\left ( x\right ) \]

Since \(M^{\prime }=\frac {1}{2}qM\) and since

\begin{align*} M^{\prime \prime } & =\frac {1}{2}\left ( q^{\prime }M+qM^{\prime }\right ) \\ & =\frac {1}{2}\left ( q^{\prime }M+\frac {1}{2}q^{2}M\right ) \end{align*}

Then (2A) now becomes

\begin{align*} y^{\prime \prime }+y^{\prime }\left ( 2\frac {\frac {1}{2}qM}{M}\right ) +\frac {\frac {1}{2}\left ( q^{\prime }M+\frac {1}{2}q^{2}M\right ) }{M}y & =f\\ y^{\prime \prime }+qy^{\prime }+\frac {1}{2}\left ( q^{\prime }+\frac {1}{2}q^{2}\right ) y & =f \end{align*}

By comparing the above to the given ode in normal form shows that for \(M\) to exist the condition is

\[ r=\frac {1}{2}\left ( q^{\prime }+\frac {1}{2}q^{2}\right ) \]

if the above is true, then \(M\) exists and is given by

\[ M=e^{\frac {1}{2}\int qdx}\]

Using this method on the first example above \(y^{\prime \prime }-4xy^{\prime }+\left ( 4x^{2}-2\right ) y=0\), where \(q=-4x\) and \(r=\left ( 4x^{2}-2\right ) \). Checking if \(\left ( 4x^{2}-2\right ) =\frac {1}{2}\left ( q^{\prime }+\frac {1}{2}q^{2}\right ) \), then \(\frac {1}{2}\left ( -4+\frac {1}{2}\left ( 16x^{2}\right ) \right ) =\allowbreak 4x^{2}-2=r\). Hence \(M\) exists. This is a much faster method to determine if \(M\) exists or not.  

The second example \(y^{\prime \prime }+\frac {1}{x}y^{\prime }+\frac {1}{x}y=0\) where \(q=\frac {1}{x},r=\frac {1}{x}\), then \(\frac {1}{2}\left ( q^{\prime }+\frac {1}{2}q^{2}\right ) =\frac {1}{2}\left ( -x^{-2}+\frac {1}{2}x^{-2}\right ) =-\frac {1}{4x^{2}}\neq r\). Therefore no \(M\) exists and the integration factor does not exist for this ode. Note this does not mean there is no integrating factor. It just means this short cut method which I call the \(M\) integrating factor does not work.