4.3.2.9 Exact linear second order ode \(p_{2}\left ( x\right ) y^{\prime \prime }+p_{1}\left ( x\right ) y^{\prime }+p_{0}\left ( x\right ) y=f\left ( x\right ) \)
4.3.2.9.1 Example 1
4.3.2.9.2 Example 2

ode internal name "exact_linear_second_order_ode"

The ode

\begin{equation} p_{2}\left ( x\right ) y^{\prime \prime }+p_{1}\left ( x\right ) y^{\prime }+p_{0}\left ( x\right ) y=f\left ( x\right ) \tag {1}\end{equation}

is called exact if the following condition is met

\begin{equation} p_{2}^{\prime \prime }-p_{1}^{\prime }+p_{0}=0\tag {1A}\end{equation}

In this case, then

\begin{equation} \frac {d}{dx}\left ( p_{2}y^{\prime }+\left ( p_{1}-p_{2}^{\prime }\right ) y\right ) =p_{2}y^{\prime \prime }+p_{1}y^{\prime }+p_{0}y\tag {2}\end{equation}

Which implies we can write (1) as

\begin{equation} \frac {d}{dx}\left ( p_{2}y^{\prime }+\left ( p_{1}-p_{2}^{\prime }\right ) y\right ) =f\left ( x\right ) \tag {2A}\end{equation}

Or

\begin{equation} p_{2}y^{\prime }+\left ( p_{1}-p_{2}^{\prime }\right ) y=\int f\left ( x\right ) dx+c_{1}\tag {3}\end{equation}

Sometimes (2A) is called the adjoint ode of (1). Eq (3) is called the first integral equation of (1). It has order one less than (1).  Let us see how to find the condition that first integral exist or not.

\[ p_{2}y^{\prime \prime }+p_{1}y^{\prime }+p_{0}y=\left ( p_{2}y^{\prime }+\left ( p_{1}-p_{2}^{\prime }\right ) y\right ) ^{\prime }\]

Expanding gives

\begin{align*} p_{2}y^{\prime \prime }+p_{1}y^{\prime }+p_{0}y & =p_{2}^{\prime }y^{\prime }+p_{2}y^{\prime \prime }+\left ( p_{1}^{\prime }-p_{2}^{\prime \prime }\right ) y+\left ( p_{1}-p_{2}^{\prime }\right ) y^{\prime }\\ & =p_{2}y^{\prime \prime }+\left ( p_{2}^{\prime }+p_{1}-p_{2}^{\prime }\right ) y^{\prime }+\left ( p_{1}^{\prime }-p_{2}^{\prime \prime }\right ) y\\ & =p_{2}y^{\prime \prime }+p_{1}y^{\prime }+\left ( p_{1}^{\prime }-p_{2}^{\prime \prime }\right ) y \end{align*}

Comparing coefficients

\begin{align*} p_{0} & =p_{1}^{\prime }-p_{2}^{\prime \prime }\\ p_{2}^{\prime \prime }-p_{1}^{\prime }+p_{0} & =0 \end{align*}

This is the condition for exactness stated in (1A). i.e. if ODE (1) satisfies this condition then the ODE is exact and has first integral which we now can be easily solve since it is ode of order one less. See section on higher order ode’s of how this can be extended to higher order ode’s.

4.3.2.9.1 Example 1

\[ x^{2}y^{\prime \prime }+xy^{\prime }-y=x^{4}\]

Then \(p_{2}=x^{2},p_{1}=x,p_{0}=-1,f\left ( x\right ) =x^{4}\). Condition (3) becomes

\begin{align*} p_{2}^{\prime \prime }-p_{1}^{\prime }+p_{0} & =2-1-1\\ & =0 \end{align*}

Hence it is second order exact. Therefore the adjoint ode (2) is

\begin{align*} \left ( p_{2}y^{\prime }+\left ( p_{1}-p_{2}^{\prime }\right ) y\right ) ^{\prime } & =f\left ( x\right ) \\ \left ( x^{2}y^{\prime }+\left ( x-2x\right ) y\right ) ^{\prime } & =x^{4}\\ x^{2}y^{\prime }+\left ( x-2x\right ) y & =\int x^{4}dx+c\\ x^{2}y^{\prime }-xy & =\frac {x^{5}}{5}+c \end{align*}

Integrating gives

\[ x^{2}y^{\prime }+\left ( x-2x\right ) y=\int x^{4}dx+c \]

This is called the first integral of the original ode. Hence

\begin{align*} x^{2}y^{\prime }+\left ( x-2x\right ) y & =\int x^{4}dx+c_{1}\\ x^{2}y^{\prime }-xy & =\frac {x^{5}}{5}+c_{1}\end{align*}

This is linear ode. Solving this ode gives

\[ y=\frac {x^{4}}{15}-\frac {c_{1}}{2x}+c_{2}x \]

Note that this is also a Euler ode.

4.3.2.9.2 Example 2

\[ y^{\prime \prime }+xy^{\prime }+y=0 \]

Here \(p_{2}=1,p_{1}=x,p_{0}=1.\) The condition for exactness is

\begin{align*} p_{2}^{\prime \prime }-p_{1}^{\prime }+p_{0} & =0-1+1\\ & =0 \end{align*}

The ode is already exact. i.e. no integrating factor is needed. The solution becomes

\begin{align*} \left ( p_{2}y^{\prime }+\left ( p_{1}-p_{2}^{\prime }\right ) y\right ) ^{\prime } & =0\\ \left ( y^{\prime }+xy\right ) ^{\prime } & =0 \end{align*}

The first integral is

\[ y^{\prime }+xy=c_{1}\]

Solving this gives

\begin{align*} \frac {d}{dx}\left ( Iy\right ) & =Ic_{1}\\ \frac {d}{dx}\left ( ye^{\int xdx}\right ) & =e^{\int xdx}c_{1}\\ ye^{\int xdx} & =\int e^{\int xdx}c_{1}dx+c_{2}\\ y & =e^{\int -xdx}\left ( \int e^{\int xdx}c_{1}dx\right ) +c_{2}e^{\int -xdx}\\ & =c_{1}e^{\frac {-x^{2}}{2}}\left ( \int e^{\frac {x^{2}}{2}}dx\right ) +c_{2}e^{\frac {-x^{2}}{2}dx}\\ & =e^{\frac {-x^{2}}{2}}\left ( c_{1}\int e^{\frac {x^{2}}{2}}dx+c_{2}\right ) \end{align*}