Exact ODEs
A First Order ODE is said to be exact if it can be written as follows:
$$ M(x,y) dx + N(x,y) dy = 0 $$
where \(\frac{\partial M}{\partial y} = \frac{\partial N}{\partial x}\). It can be directly integrated, because there exist a function \(u(x,y)\)
with the following properties
$$ \frac{\partial u}{\partial x} = M, \frac{\partial u}{\partial y} = N $$
so that
$$ du = u_x dx + u_y dy = M dx + N dy = 0 $$
The solution is
$$ u(x,y) = c $$
Example 1
Show that the following ODE is exact and solve it $$ x dx + y dy = 0 $$
solution:
$$ M(x,y) = x , N(x,y) = y \rightarrow M_y = N_x = 0 $$
$$ du = x dx + y dy = 0 $$
$$ u = \frac{x^2}{2} + \frac{y^2}{2} = c $$
$$ y(x) = \pm \sqrt{2c - x^2} $$
Example 2
Solve the following ODE $$ y' = \frac{x-y}{x+y} $$
solution: Exact ODE
$$ du = (y-x)dx + (x+y)dy = 0 $$
$$ M(x,y) = y-x , N(x,y) = x+y \rightarrow M_y = N_x = 1 $$
$$ u = y x - \frac{x^2}{2} + f(y) = x y + \frac{y^2}{2} + g(x)$$
$$ u = \frac{y^2}{2} + x y - \frac{x^2}{2} = c $$
$$ y(x) = - x \pm \sqrt{2 x^2 + 2 c} $$
Not Exact ODEs
If a First Order ODE is not exact, it can be made exact by multiplying with an integrating factor:
$$ M(x,y) dx + N(x,y) dy = 0 $$
where \(\frac{\partial M}{\partial y} \ne \frac{\partial N}{\partial x}\). But
$$ f(x,y) M(x,y) dx + f(x,y) N(x,y) dy = 0 $$
is exact where \(f(x,y)\) is the integrating factor. Finding \(f(x,y)\) requires solving the following equation
$$ \frac{\partial f(x,y) M(x,y)}{\partial y} = \frac{\partial f(x,y) N(x,y)}{\partial x}$$
which may be more difficult than the original equation. But if we assume that the integrating factor is only a function
of a single variable than it may be easy to find. For example if it is of the form \(f(x)\)
$$ \frac{\partial f(x) M(x,y)}{\partial y} = \frac{\partial f(x) N(x,y)}{\partial x}$$
then
$$ f M_y = f' N + f N_x $$
$$ f' + p(x) f = 0, p(x) = \frac{1}{N} (N_x - M_y) $$
Otherwise , if \(f(y)\)
$$ \frac{\partial f(y) M(x,y)}{\partial y} = \frac{\partial f(y) N(x,y)}{\partial x}$$
then
$$ M f' + f M_y = f N_x $$
$$ f' + p(y) f = 0, p(y) = \frac{1}{M} (M_y - N_x) $$
By solving these linear homogeneous separable equations we can find \(f\). However sometimes both assumption fail
and we have to solve a PDE to find \(f(x,y)\).
Example 1
Show that the following ODE is not exact and find the integrating factor and the solution
$$ y dx - x dy = 0 $$
solution:
$$ M(x,y) = y , N(x,y) = -x \rightarrow M_y = 1 \ne N_x = -1 $$
Assume \(f(x)\)
$$ p(x) = \frac{1}{N} (N_x - M_y) = \frac{1}{-x} (-1 - 1) =\frac{2}{x} $$
$$ f' + \frac{2}{x} f = 0 $$
$$ \frac{df}{f} = -2\frac{dx}{x} $$
$$ \log{f} = -2 \log{x}$$
$$ f(x) = \frac{1}{x^2} $$
$$ \frac{y}{x^2} dx - \frac{1}{x} dy = 0$$
$$ u = -\frac{y}{x} = c $$
$$ y(x) = c_1 x $$
Example 2
Solve the following ODE $$ (y^2-xy)dx + (xy+y^2)dy = 0 $$
solution: ODE is not exact
$$ M(x,y) = y^2-xy , N(x,y) = xy+y^2 \rightarrow M_y = 2y-x \ne N_x = y $$
Assume \(f(x)\)
$$ p(x) = \frac{1}{N} (N_x - M_y) = \frac{1}{xy+y^2} (y - 2y + x) =\frac{x-y}{xy+y^2} $$
which is not a function of a single variable. That means our assumption is wrong.
Assume \(f(y)\)
$$ p(y) = \frac{1}{M} (M_y - N_x) = \frac{1}{y^2-xy} (2y - x - y) =\frac{y-x}{y(y-x)}=\frac{1}{y} $$
$$ f' + \frac{1}{y} f = 0 $$
$$ \frac{df}{f} = -\frac{dy}{y} $$
$$ \log{f} = - \log{y}$$
$$ f(y) = \frac{1}{y} $$
$$ du = (y-x)dx + (x+y)dy = 0 $$
$$ M(x,y) = y-x , N(x,y) = x+y \rightarrow M_y = N_x = 1 $$
$$ u = y x - \frac{x^2}{2} + f(y) = x y + \frac{y^2}{2} + g(x)$$
$$ u = \frac{y^2}{2} + x y - \frac{x^2}{2} = c $$
$$ y(x) = - x \pm \sqrt{2 x^2 + 2 c} $$