3.3.2.8 Exact linear second order ode \(p\left ( x\right ) y^{\prime \prime }+q\left ( x\right ) y^{\prime }+r\left ( x\right ) y=0\)
3.3.2.8.1 Example 1
3.3.2.8.2 Example 2

ode internal name "exact_linear_second_order_ode"

Given the ode\begin {equation} p\left ( x\right ) y^{\prime \prime }+q\left ( x\right ) y^{\prime }+r\left ( x\right ) y=0 \tag {1} \end {equation} We want to first find the condition for exactness. This is the same as saying the above ode has a corresponding adjoint ode, which is \(\left ( py^{\prime }+B\left ( x\right ) y\right ) ^{\prime }=0\). i.e. if an ode \(p\left ( x\right ) y^{\prime \prime }+q\left ( x\right ) y^{\prime }+r\left ( x\right ) y=0\) can be written in the form \(\left ( py^{\prime }+B\left ( x\right ) y\right ) ^{\prime }=0\) for some \(B\left ( x\right ) \) then the ode \(\left ( py^{\prime }+By\right ) ^{\prime }=0\) is called the adjoint of \(py^{\prime \prime }+qy^{\prime }+ry=0\) which is the same thing as saying the ode \(p\left ( x\right ) y^{\prime \prime }+q\left ( x\right ) y^{\prime }+r\left ( x\right ) y=0\) is exact. i.e. it has complete differential.

The goal therefore is to determine if a linear second order ode has a corresponding adjoint ODE or not of the form \(\left ( py^{\prime }+B\left ( x\right ) y\right ) ^{\prime }=0\). If so, then it is exact and we can solve it by solving the adjoint ODE instead since it is much simpler to solve as it is a first order ODE. Lets see how to find the adjoint ODE.

Let \[ py^{\prime \prime }+q\left ( x\right ) y^{\prime }+r\left ( x\right ) y=\left ( py^{\prime }+By\right ) ^{\prime }\] Expanding gives\[ py^{\prime \prime }+qy^{\prime }+ry=p^{\prime }y^{\prime }+py^{\prime \prime }+B^{\prime }y+By^{\prime }\] Comparing coefficients\begin {align*} q & =p^{\prime }+B\\ r & =B^{\prime } \end {align*}

Differentiating the first ode gives \(q^{\prime }=p^{\prime \prime }+B^{\prime }\). Using the second ode gives \(q^{\prime }=p^{\prime \prime }+r\) or \begin {equation} p^{\prime \prime }-q^{\prime }+r=0 \tag {2} \end {equation} This is the condition for exactness. i.e. if the input ODE (1) satisfies (2) then the ODE is exact and has an adjoint ODE of the form \(\left ( py^{\prime }+By\right ) ^{\prime }=0\) which we now can be easily solve since it is complete differential.\begin {align} \left ( py^{\prime }+B\left ( x\right ) y\right ) ^{\prime } & =0\nonumber \\ \left ( py^{\prime }+\left ( q-p^{\prime }\right ) y\right ) ^{\prime } & =0 \tag {3} \end {align}

We see that solving (3) is much simpler than (1) since (3) is first order.  Integrating this once gives\[ py^{\prime }+\left ( q-p^{\prime }\right ) y=c \] This is first order ode. This is also called the first integral equation of (1). In summary, given an ode \(py^{\prime \prime }+qy^{\prime }+ry=0\) which is exact, then its first integral is \(py^{\prime }+\left ( q-p^{\prime }\right ) y=c\) and the solution to this is the solution to the original second order ode.

3.3.2.8.1 Example 1 \[ x^{2}y^{\prime \prime }+xy^{\prime }-y=x^{4}\] Then \(p=x^{2},q=x,r=-1,f\left ( x\right ) =x^{4}\). Condition (2) becomes\begin {align*} p^{\prime \prime }-q^{\prime }+r & =0\\ 2-1-1 & =0\\ 0 & =0 \end {align*}

Hence it is second order exact. Therefore the adjoint ode (3) is\begin {align*} \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*}

The first integral is\begin {align*} 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*}

This is linear ode. Solving this ode gives \[ y=\frac {x^{4}}{15}-\frac {c}{2x}+c_{2}x \] Note that this is also a Euler ode.

3.3.2.8.2 Example 2 \[ y^{\prime \prime }+xy^{\prime }+y=0 \] Here \(p=1,q=x,r=1.\) Let \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =y^{\prime \prime }+xy^{\prime }+y\). The condition for exactness is\[ p^{\prime \prime }-q^{\prime }+r=0 \] Hence the above becomes\begin {align*} 0-1+1 & =0\\ 0 & =0 \end {align*}

The ode is already exact. i.e. no integrating factor is needed. The solution becomes\begin {align*} \left ( py^{\prime }+\left ( q-p^{\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*}