4.4.1.4 How to solve the ode once it is determined it is exact
4.4.1.4.1 Examples finding first integral \(R\left ( x,y,y^{\prime }\right ) \) for an exact second order ode

In the examples above we did not show how to obtain or find the first integral \(R\left ( x,y,y^{\prime }\right ) \). Given an ode \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =0\) which is determined to be exact as above, then how to solve it? This is done by first finding the first integral \(R\). We need to find \(R\left ( x,y,y^{\prime }\right ) \) such that

\[ F\left ( x,y,y,y^{\prime \prime }\right ) =\frac {d}{dx}R\left ( x,y,y^{\prime }\right ) =0 \]

Once \(R\) is found, then we need to solve the first order ode \(R\left ( x,y,y^{\prime }\right ) =c\) where \(R\) is now one order less that \(F\) so it should be simpler to solve. This ode might require another integration factor to solve depending on what it type turns out to be.

This reduces the order of the ode from second to first order (since \(R\) is first order). To find \(R\left ( x,y,y^{\prime }\right ) \) the first step is to write the given ode in this form

\begin{equation} F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =f\left ( x,y,y^{\prime }\right ) y^{\prime \prime }+g\left ( x,y,y^{\prime }\right ) \tag {1}\end{equation}

We know what \(f,g\) are in the above by reading them from the given ode. But

\begin{align} F & =\frac {d}{dx}R\left ( x,y,y^{\prime }\right ) \nonumber \\ & =\frac {\partial R}{\partial x}\frac {dx}{dx}+\frac {\partial R}{\partial y}\frac {dy}{dx}+\frac {\partial R}{\partial y^{\prime }}\frac {dy^{\prime }}{dx}\nonumber \\ & =R_{x}+R_{y}y^{\prime }+R_{y^{\prime }}y^{\prime \prime } \tag {1A}\end{align}

And since \(y^{\prime \prime }=\Phi \left ( x,y,y^{\prime }\right ) \) then the above can also be written as

\[ F=R_{x}+R_{y}y^{\prime }+\Phi R_{y^{\prime }}\]

The above is same as Eq (1B) in the introduction above. Comparing (1,1A) shows that

\begin{align} f & =R_{y^{\prime }}\tag {2}\\ g & =R_{x}+R_{y}y^{\prime } \tag {3}\end{align}

At this point it is easier to replace \(y^{\prime }\) by \(p\). The above becomes

\begin{align} f & =R_{p}\tag {2}\\ g & =R_{x}+R_{y}p \tag {3}\end{align}

Using (2,3) we are able to determine \(R\). Note that \(R\) must exist since we checked the ode is exact and hence must have a first integral. This method similar to how we find \(R\) for an exact first order ode.

Starting with (2) and integrating it w.r.t. \(p\) gives

\begin{equation} R=\int fdp+\psi \left ( x,y\right ) \tag {4}\end{equation}

Where \(\psi \left ( x,y\right ) \) acts like an integration constant but since \(R\) depends on more than one variable, it is now an arbitrary function of the other variables \(x,y\). If we can find \(\psi \left ( x,y\right ) \), then \(R\) is found, since \(f\) is known. To find \(\psi \,\), we differentiate one time w.r.t. \(x\) and another time w.r.t. \(y\) and substitute the result in (3). This gives

\begin{equation} g=\left ( \frac {\partial }{\partial x}\left ( \int fdp\right ) +\psi _{x}\left ( x,y\right ) \right ) +\left ( \frac {\partial }{\partial y}\left ( \int fdp\right ) +\psi _{y}\left ( x,y\right ) \right ) p \tag {5}\end{equation}

In the above the terms \(\frac {\partial }{\partial x}\left ( \int fdp\right ) ,\frac {\partial }{\partial y}\left ( \int fdp\right ) \) are known, since everything is known. The only unknowns are \(\psi _{x}\left ( x,y\right ) ,\psi _{y}\left ( x,y\right ) \). Comparing terms in (5) we can generate two equations for \(\psi _{x},\psi _{y}\) and by integrating them we find \(\psi \). Examples below show how to do this as this is easier explained using examples.

4.4.1.4.1 Examples finding first integral \(R\left ( x,y,y^{\prime }\right ) \) for an exact second order ode

Example 1

\[ yy^{\prime \prime }+\left ( y^{\prime }\right ) ^{2}+2axyy^{\prime }+ay^{2}=0 \]

Comparing this to  \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =f\left ( x,y,y^{\prime }\right ) y^{\prime \prime }+g\left ( x,y,y^{\prime }\right ) \) shows that

\begin{align*} f & =y\\ g & =\left ( y^{\prime }\right ) ^{2}+2axyy^{\prime }+ay^{2}\\ & =p^{2}+2axyp+ay^{2}\end{align*}

Therefore (4) becomes

\begin{align} R & =\int fdp+\psi \left ( x,y\right ) \nonumber \\ & =yp+\psi \left ( x,y\right ) \tag {1A}\end{align}

Hence (5) becomes

\begin{align*} g & =\left ( \frac {\partial }{\partial x}\left ( \int fdp\right ) +\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}\left ( \int fdp\right ) +\psi _{y}\right ) p\\ p^{2}+2axyp+ay^{2} & =\left ( \frac {\partial }{\partial x}\left ( yp\right ) +\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}\left ( yp\right ) +\psi _{y}\right ) p \end{align*}

But \(\frac {\partial }{\partial x}\left ( yp\right ) =0\) since \(y,p\) are held constant. It is important to watch for this here. Given \(f\left ( x,y\right ) =3x+y\left ( x\right ) \) where \(y\) is function of \(x\), then when we do \(\frac {\partial f}{\partial x}\) the result is \(3\) and not \(3+y^{\prime }\) because with partial derivatives the \(y\) is held constant. Similarly \(\frac {\partial }{\partial y}\left ( yp\right ) =p^{2}\). The above becomes

\begin{align*} p^{2}+2axyp+ay^{2} & =\psi _{x}+\left ( p+\psi _{y}\right ) p\\ & =\psi _{x}+p^{2}+\psi _{y}p\\ 2axyp+ay^{2} & =\psi _{x}+\psi _{y}p \end{align*}

Comparing terms shows that

\begin{align} 2axy & =\psi _{y}\tag {2A}\\ ay^{2} & =\psi _{x} \tag {3A}\end{align}

Integrating (2A) w.r.t \(y\) gives

\begin{equation} \psi =axy^{2}+h\left ( x\right ) \tag {4A}\end{equation}

Differentiating the above w.r.t. \(x\) gives \(\psi _{x}=ay^{2}+h^{\prime }\left ( x\right ) \). comparing this to (3A) above gives \(ay^{2}=ay^{2}+h^{\prime }\left ( x\right ) \), hence \(h^{\prime }\left ( x\right ) =0\) or \(h\left ( x\right ) =c\). Therefore (4A) becomes

\[ \psi =axy^{2}+c \]

Substituting the above in (1A) gives

\[ R=yp+axy^{2}+c \]

Therefore, since \(R=c_{1}\) a constant, then the above becomes (by merging the constants)

\begin{align*} yp+axy^{2} & =c_{2}\\ yy^{\prime }+axy^{2} & =c_{2}\end{align*}

This is the reduced ode which needs to be solved for \(y\). The above says that \(R=yy^{\prime }+axy^{2}+c_{2}\). To verify, let us apply \(F=\frac {d}{dx}R\). This gives

\begin{align*} yy^{\prime \prime }+\left ( y^{\prime }\right ) ^{2}+2axyy^{\prime }+ay^{2} & =\frac {d}{dx}\left ( yy^{\prime }+axy^{2}+c_{2}\right ) \\ & =y^{\prime }y^{\prime }+yy^{\prime \prime }+ay^{2}+2axyy^{\prime }\\ & =yy^{\prime \prime }+\left ( y^{\prime }\right ) ^{2}+2axyy^{\prime }+ay^{2}\end{align*}

Verified.

Example 2

\begin{align*} y^{\prime \prime }+xy^{\prime }+y & =0\\ F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) & =0 \end{align*}

This ode is not nonlinear, but let us apply this method to it anyway. First we need to determine if it is exact or not.  Applying the test

\begin{align*} \frac {\partial F}{\partial y}-\frac {d}{dx}\left ( \frac {\partial F}{\partial y^{\prime }}\right ) +\frac {d^{2}}{dx^{2}}\left ( \frac {\partial F}{\partial y^{\prime \prime }}\right ) & =0\\ 1-\frac {d}{dx}\left ( x\right ) +\frac {d^{2}}{dx^{2}}\left ( 1\right ) & =0\\ 1-1 & =0\\ 0 & =0 \end{align*}

So it exact. Comparing this ode to  \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =f\left ( x,y,y^{\prime }\right ) y^{\prime \prime }+g\left ( x,y,y^{\prime }\right ) \) shows that

\begin{align*} f & =1\\ g & =xy^{\prime }+y\\ & =xp+y \end{align*}

Therefore (4) becomes

\begin{align} R & =\int fdp+\psi \left ( x,y\right ) \nonumber \\ & =p+\psi \left ( x,y\right ) \tag {1A}\end{align}

Hence (5) becomes

\begin{align*} g & =\left ( \frac {\partial }{\partial x}\left ( \int fdp\right ) +\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}\left ( \int fdp\right ) +\psi _{y}\right ) p\\ xp+y & =\left ( \frac {\partial p}{\partial x}+\psi _{x}\right ) +\left ( \frac {\partial p}{\partial y}+\psi _{y}\right ) p \end{align*}

But \(\frac {\partial p}{\partial x}=0\) since \(y\) is held constant. And \(\frac {\partial p}{\partial y}=0\). The above becomes

\[ xp+y=\psi _{x}+\psi _{y}p \]

Comparing terms shows that

\begin{align*} x & =\psi _{y}\\ y & =\psi _{x}\end{align*}

Integrating the first equation gives \(\psi =xy+c\). Hence (1A) becomes

\[ R=p+xy+c \]

Therefore, since \(R=c_{1}\) a constant, then the above becomes (by merging the constants)

\begin{align*} p+xy & =c_{2}\\ y^{\prime }+xy & =c_{2}\end{align*}

This is the reduced ode which needs to be solved for \(y\). Solving gives

\[ y=\operatorname {erf}\left ( \frac {i\sqrt {2}x}{2}\right ) e^{\frac {-x^{2}}{2}}c_{1}+c_{2}e^{\frac {-x^{2}}{2}}\]

Example 3

\begin{align*} y^{\prime \prime }-2yy^{\prime } & =0\\ F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) & =0 \end{align*}

First we need to determine if it is exact or not.  Applying the test

\begin{align*} \frac {\partial F}{\partial y}-\frac {d}{dx}\left ( \frac {\partial F}{\partial y^{\prime }}\right ) +\frac {d^{2}}{dx^{2}}\left ( \frac {\partial F}{\partial y^{\prime \prime }}\right ) & =0\\ -2y^{\prime }-\frac {d}{dx}\left ( -2y\right ) +\frac {d^{2}}{dx^{2}}\left ( 1\right ) & =0\\ -2y^{\prime }+2\frac {d}{dx}\left ( y\right ) & =0\\ -2y^{\prime }+2y^{\prime } & =0\\ 0 & =0 \end{align*}

So it exact.  Comparing this ode to  \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =f\left ( x,y,y^{\prime }\right ) y^{\prime \prime }+g\left ( x,y,y^{\prime }\right ) \) shows that

\begin{align*} f & =1\\ g & =-2yy^{\prime }\\ & =-2yp \end{align*}

Therefore (4) becomes

\begin{align} R & =\int fdp+\psi \left ( x,y\right ) \nonumber \\ & =p+\psi \left ( x,y\right ) \tag {1A}\end{align}

Hence (5) becomes

\begin{align*} g & =\left ( \frac {\partial }{\partial x}\left ( \int fdp\right ) +\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}\left ( \int fdp\right ) +\psi _{y}\right ) p\\ -2yp & =\left ( \frac {\partial p}{\partial x}+\psi _{x}\right ) +\left ( \frac {\partial p}{\partial y}+\psi _{y}\right ) p\\ -2yp & =\psi _{x}+\psi _{y}p \end{align*}

Comparing terms shows that

\begin{align*} -2y & =\psi _{y}\\ 0 & =\psi _{x}\end{align*}

Integrating the first equation gives \(\psi =-y^{2}+h\left ( x\right ) \). Differentiating this w.r.t. \(x\) gives \(\psi _{x}=h^{\prime }\left ( x\right ) \). comparing this to the second equation above gives \(0=h^{\prime }\left ( x\right ) \), hence \(h\left ( x\right ) =c\). Hence \(\psi =-y^{2}+c\).  Therefore (1A) becomes

\[ R=p-y^{2}+c \]

Therefore, since \(R=c_{1}\) a constant, then the above becomes (by merging the constants)

\begin{align*} p-y^{2} & =c_{2}\\ y^{\prime }-y^{2} & =c_{2}\end{align*}

This is the reduced ode.

Example 4

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

First we need to determine if it is exact or not.  Applying the test

\begin{align*} \frac {\partial F}{\partial y}-\frac {d}{dx}\left ( \frac {\partial F}{\partial y^{\prime }}\right ) +\frac {d^{2}}{dx^{2}}\left ( \frac {\partial F}{\partial y^{\prime \prime }}\right ) & =0\\ 2-\frac {d}{dx}\left ( 4x\right ) +\frac {d^{2}}{dx^{2}}\left ( \left ( x-1\right ) ^{2}\right ) & =0\\ 2-4+\frac {d}{dx}\left ( 2\left ( x-1\right ) \right ) & =0\\ 2-4+2 & =0\\ 0 & =0 \end{align*}

So it exact.  Comparing this ode to  \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =f\left ( x,y,y^{\prime }\right ) y^{\prime \prime }+g\left ( x,y,y^{\prime }\right ) \) shows that

\begin{align*} f & =\left ( x-1\right ) ^{2}\\ g & =4xy^{\prime }+2y-2x\\ & =4xp+2y-2x \end{align*}

Therefore (4) becomes

\begin{align} R & =\int fdp+\psi \left ( x,y\right ) \nonumber \\ & =\left ( x-1\right ) ^{2}p+\psi \left ( x,y\right ) \tag {1A}\end{align}

Hence (5) becomes

\begin{align*} g & =\left ( \frac {\partial }{\partial x}\left ( \int fdp\right ) +\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}\left ( \int fdp\right ) +\psi _{y}\right ) p\\ 4xp+2y-2x & =\left ( \frac {\partial }{\partial x}\left ( \left ( x-1\right ) ^{2}p\right ) +\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}\left ( \left ( x-1\right ) ^{2}p\right ) +\psi _{y}\right ) p\\ 4xp+2y-2x & =2p\left ( x-1\right ) +\psi _{x}+\psi _{y}p\\ 4xp+2y-2x & =p\left ( 2\left ( x-1\right ) +\psi _{y}\right ) +\psi _{x}\end{align*}

Comparing terms shows that

\begin{align*} 4x & =2\left ( x-1\right ) +\psi _{y}\\ 2y-2x & =\psi _{x}\end{align*}

Or

\begin{align*} 2x+2 & =\psi _{y}\\ 2y-2x & =\psi _{x}\end{align*}

Integrating the first equation gives \(\psi =2xy+2y+h\left ( x\right ) \). Differentiating this w.r.t. \(x\) gives \(\psi _{x}=2y+h^{\prime }\left ( x\right ) \). comparing this to the second equation above gives \(2y-2x=2y+h^{\prime }\left ( x\right ) \), hence \(h^{\prime }\left ( x\right ) =-2x\). Hence \(h=-x^{2}+c\). Therefore\(\ \psi =2xy+2y-x^{2}+c\).  Eq (1A) becomes

\begin{align*} R & =\left ( x-1\right ) ^{2}p+2xy+2y-x^{2}+c\\ & =\left ( x-1\right ) ^{2}y^{\prime }+2xy+2y-x^{2}+c \end{align*}

Therefore, since \(R=c_{1}\) a constant, then the above becomes (by merging the constants)

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

Which is the reduced ode to solve.

Example 5

\begin{align*} y^{\prime \prime }-y^{\prime }e^{y} & =0\\ F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) & =0 \end{align*}

First we need to determine if it is exact or not.  Applying the test

\begin{align*} \frac {\partial F}{\partial y}-\frac {d}{dx}\left ( \frac {\partial F}{\partial y^{\prime }}\right ) +\frac {d^{2}}{dx^{2}}\left ( \frac {\partial F}{\partial y^{\prime \prime }}\right ) & =0\\ -y^{\prime }e^{y}-\frac {d}{dx}\left ( -e^{y}\right ) +\frac {d^{2}}{dx^{2}}\left ( 1\right ) & =0\\ -y^{\prime }e^{y}+y^{\prime }e^{y} & =0\\ 0 & =0 \end{align*}

So it exact.  Comparing this ode to  \(F\left ( x,y,y^{\prime },y^{\prime \prime }\right ) =f\left ( x,y,y^{\prime }\right ) y^{\prime \prime }+g\left ( x,y,y^{\prime }\right ) \) shows that

\begin{align*} f & =1\\ g & =-y^{\prime }e^{y}\\ & =-pe^{y}\end{align*}

Therefore (4) becomes

\begin{align} R & =\int fdp+\psi \left ( x,y\right ) \nonumber \\ & =p+\psi \left ( x,y\right ) \tag {1A}\end{align}

Hence (5) becomes

\begin{align*} g & =\left ( \frac {\partial }{\partial x}\left ( \int fdp\right ) +\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}\left ( \int fdp\right ) +\psi _{y}\right ) p\\ -pe^{y} & =\left ( \frac {\partial }{\partial x}p+\psi _{x}\right ) +\left ( \frac {\partial }{\partial y}p+\psi _{y}\right ) p\\ -pe^{y} & =\psi _{x}+\psi _{y}p \end{align*}

Comparing terms shows that

\begin{align*} -e^{y} & =\psi _{y}\\ 0 & =\psi _{x}\end{align*}

Integrating the first equation gives \(\psi =-e^{y}+h\left ( x\right ) \). Partial differentiating this w.r.t. \(x\) gives \(\psi _{x}=h^{\prime }\left ( x\right ) \). comparing this to the second equation above gives \(h^{\prime }\left ( x\right ) =0\), hence \(h\left ( x\right ) =c\). Hence \(h=-x^{2}+c\). Therefore\(\ \psi =-e^{y}+c\).  Eq (1A) becomes

\begin{align*} R & =p-e^{y}+c\\ & =y^{\prime }-e^{y}+c \end{align*}

Therefore, since \(\phi =c_{1}\) a constant, then the above becomes (by merging the constants)

\[ y^{\prime }-e^{y}=c_{2}\]

Which is the reduced ode to solve.