5 What is a first integral of a differential equation and how to find it?
Lets start with first order ode. This generalizes to any order. Let say our ode is
\[ \frac {dy}{dx}=f\left ( x,y\right ) \]
The first
integral of the above ode is any function
\(\Phi \left ( x,y\right ) \) such that its rate of change along
\(x\) is zero. i.e.
\(\frac {d}{dx}\Phi \left ( x,y\right ) =0\).
This means
\begin{align*} \frac {d}{dx}\Phi \left ( x,y\right ) & =\frac {\partial \Phi }{\partial x}+\frac {\partial \Phi }{\partial y}\frac {dy}{dx}\\ & =\Phi _{x}+\Phi _{y}\frac {dy}{dx}\end{align*}
But \(\frac {dy}{dx}=f\left ( x,y\right ) \), hence the above is
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}f\left ( x,y\right ) \]
If the above comes out to be zero, then
\(\Phi \left ( x,y\right ) \) is called the first integral
of the ode
\(\frac {dy}{dx}=f\left ( x,y\right ) \). In the above, we should make sure to replace any
\(y\) in the RHS with the
solution itself of the ode.
Notice that the first integral itself is not constant. But its rate of change as the
independent variable changes is what is constant. We should not mix these two
things.
But how to find the first integral function \(\Phi \left ( x,y\right ) \)? This is easy. We have to solve the ode itself.
Then move all terms to one side, and this is what \(\Phi \left ( x,y\right ) \) is. Let us look at few examples to make
this clear.
It is also possible to find first integral \(\Phi \left ( x,y\right ) \) without solving the ode. We just need to find any \(\Phi \left ( x,y\right ) \)
such that when we differentiate it w.r.t. \(x\) which gives \(\Phi _{x}+\Phi _{y}f\left ( x,y\right ) \) becomes zero. In here \(f\left ( x,y\right ) \)
must be the RHS of the ode. So if we by inspection or other means can find
such \(\Phi \left ( x,y\right ) \) then no need to solve the ode to find it. For some easy ode’s, method of
inspection might be possible. There are more advanced methods to finding first
integrals. But here, for simplicity, we assume we have the solution to the ode
available.
If we want to first first integral without having the solution to the first order ode, and if
the ode is already exact ode, then the same method used in solving exact ode can be
used to find the first integral. i.e. if the ode has form
\begin{equation} M\left ( x,y\right ) dx+N\left ( x,y\right ) dy=0 \tag {1}\end{equation}
Where this is exact (i.e.
\(\frac {\partial M}{\partial y}=\frac {\partial N}{\partial x}\))
then we assume first integral exist and given by
\(\Phi \left ( x,y\right ) =c_{1}\). Hence
\begin{equation} \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}\frac {dy}{dx}=0 \tag {2}\end{equation}
Comparing (1,2) we see
that
\begin{align*} \Phi _{x} & =M\\ \Phi _{y} & =N \end{align*}
From these two equations we can now find \(\Phi \left ( x,y\right ) \) using same methods we use when solving exact
first order ode. So this is an example where we can find \(\Phi \left ( x,y\right ) \) without knowing the solution to
the ode. The above works if the ode is exact.
If the ode is not exact, then we try to find an integrating factor which makes the ode exact
first.
The point of this note is to show that first integral is a function \(\Phi \left ( x,y\right ) \) which happens to be
constant along solution curves.
The first integral \(\Phi \left ( x,y\right ) \) of an ode is not unique. We just need to find one. Even though the ode
itself can have unique solution, there can be many different first integrals \(\Phi \left ( x,y\right ) \,\). Only condition
is that \(\frac {d}{dx}\Phi \left ( x,y\right ) =0\).
5.1 Example \(y^{\prime }=-\frac {x}{y}\)
The solution can be found to be
\[ y^{2}=c_{1}-x^{2}\]
Hence the first integral is (moving everything to one
side)
\[ \Phi \left ( x,y\right ) =y^{2}+x^{2}-c_{1}\]
To show this the first integral, we have to show that
\(\frac {d}{dx}\Phi \left ( x,y\right ) =0\). This is given by
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}f\left ( x,y\right ) \]
Looking at our ode we see that
\(f\left ( x,y\right ) =-\frac {x}{y}\). The above becomes
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}-\Phi _{y}\left ( \frac {x}{y}\right ) \]
But
\(\Phi _{x}=2x\) and
\(\Phi _{y}=2y\), then the above
becomes
\begin{align*} \frac {d}{dx}\Phi \left ( x,y\right ) & =2x-2y\left ( \frac {x}{y}\right ) \\ & =0 \end{align*}
Since \(\frac {d}{dx}\Phi \left ( x,y\right ) =0\) then \(\Phi \left ( x,y\right ) =y^{2}+x^{2}-c_{1}\) is first integral.
5.2 Example \(y^{\prime }=xy\)
This is linear ode, the solution is
\[ y=c_{1}e^{\frac {x^{2}}{2}}\]
Hence the first integral is (moving everything to one side)
\[ \Phi \left ( x,y\right ) =y-c_{1}e^{\frac {x^{2}}{2}}\]
To show this the first integral, we have to show that
\(\frac {d}{dx}\Phi \left ( x,y\right ) =0\). This is given by
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}f\left ( x,y\right ) \]
Looking at our ode
we see that
\(f\left ( x,y\right ) =xy\). The above becomes
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}\left ( xy\right ) \]
But
\(\Phi _{x}=-c_{1}xe^{\frac {x^{2}}{2}}\) and
\(\Phi _{y}=1\), then the above becomes
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =-c_{1}xe^{\frac {x^{2}}{2}}+\left ( xy\right ) \]
But
\(y\) is the solution
\(y=c_{1}e^{\frac {x^{2}}{2}}\),
hence the above becomes
\begin{align*} \frac {d}{dx}\Phi \left ( x,y\right ) & =-c_{1}xe^{\frac {x^{2}}{2}}+xc_{1}e^{\frac {x^{2}}{2}}\\ & =0 \end{align*}
Since \(\frac {d}{dx}\Phi \left ( x,y\right ) =0\) then \(\Phi \left ( x,y\right ) =y-c_{1}e^{\frac {x^{2}}{2}}\) is first integral.
5.3 Example \(y^{\prime }=2x^{2}y^{2}\)
The solution can be found to be
\[ -\frac {1}{y}=\frac {2}{3}x^{3}+c_{1}\]
Hence the first integral is (moving everything to one side)
\[ \Phi \left ( x,y\right ) =\frac {1}{y}+\frac {2}{3}x^{3}+c_{1}\]
To show this is indeed the first integral, we have to show that
\(\frac {d}{dx}\Phi \left ( x,y\right ) =0\). This is given by
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}f\left ( x,y\right ) \]
Looking at our ode we see that
\(f\left ( x,y\right ) =2x^{2}y^{2}\). The above becomes
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}\left ( 2x^{2}y^{2}\right ) \]
But
\(\Phi _{x}=2x^{2}\) and
\(\Phi _{y}=\frac {-1}{y^{2}}\), then the above
becomes
\begin{align*} \frac {d}{dx}\Phi \left ( x,y\right ) & =2x^{2}-\frac {1}{y^{2}}\left ( 2x^{2}y^{2}\right ) \\ & =0 \end{align*}
Since \(\frac {d}{dx}\Phi \left ( x,y\right ) =0\) then
\[ \Phi \left ( x,y\right ) =\frac {1}{y}+\frac {2}{3}x^{3}+c_{1}\]
Is first integral of the ode
\(y^{\prime }=2x^{2}y^{2}\)
5.4 Example \(y^{\prime }=\frac {x-1}{y}\)
The solution is
\[ \frac {y^{2}}{2}=-x+\frac {1}{2}x^{2}+c_{1}\]
Hence the first integral is
\[ \Phi \left ( x,y\right ) =\frac {y^{2}}{2}+x-\frac {1}{2}x^{2}-c_{1}\]
To show this is the first integral, we have to
show that
\(\frac {d}{dx}\Phi \left ( x,y\right ) =0\)\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}f\left ( x,y\right ) \]
Looking at our ode we see that
\(f\left ( x,y\right ) =\frac {x-1}{y}\), then the above becomes
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}\left ( \frac {x-1}{y}\right ) \]
But
\(\Phi _{x}=1-x\) and
\(\Phi _{y}=y\), then the
above becomes
\begin{align*} \frac {d}{dx}\Phi \left ( x,y\right ) & =1-x+y\left ( \frac {x-1}{y}\right ) \\ & =0 \end{align*}
Since \(\frac {d}{dx}\Phi \left ( x,y\right ) =0\) then
\[ \Phi \left ( x,y\right ) =\frac {y^{2}}{2}+x-\frac {1}{2}x^{2}-c_{1}\]
Is first integral of the ode
\(y^{\prime }=\frac {x-1}{y}\).
5.5 Example \(y^{\prime }=y\sin x\)
The solution is
\[ y=c_{1}e^{-\cos x}\]
Hence the first integral is
\[ \Phi \left ( x,y\right ) =y-c_{1}e^{-\cos x}\]
To show this is the first integral, we have to
show that
\(\frac {d}{dx}\Phi \left ( x,y\right ) =0\)\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}f\left ( x,y\right ) \]
Looking at our ode we see that
\(f\left ( x,y\right ) =y\sin x\), then the above becomes
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =\Phi _{x}+\Phi _{y}\left ( y\sin x\right ) \]
But
\(\Phi _{x}=-c_{1}\sin \left ( x\right ) e^{-\cos x}\) and
\(\Phi _{y}=1\), then the
above becomes
\[ \frac {d}{dx}\Phi \left ( x,y\right ) =-c_{1}\sin \left ( x\right ) e^{-\cos x}+\left ( y\sin x\right ) \]
Notice that in this example, we have
\(y\) in the RHS above that did not
cancel as the case was with the first two examples. In this case, we have to replace this
\(y\) by
the solution
\(y=c_{1}e^{-\cos x}\) and the above now becomes
\begin{align*} \frac {d}{dx}\Phi \left ( x,y\right ) & =-c_{1}\sin \left ( x\right ) e^{-\cos x}+c_{1}e^{-\cos x}\sin x\\ & =0 \end{align*}
Since \(\frac {d}{dx}\Phi \left ( x,y\right ) =0\) then
\[ \Phi \left ( x,y\right ) =y-c_{1}e^{-\cos x}\]
Is first integral of the ode
\(y^{\prime }=y\sin x\).