DiffEq Home

Exact ODEs

    


An ODE of the form \[\begin{align} M(x,y)+N(x,y)\frac{dy}{dx}&=0 \;\;\;\; (12)\\ \text{ or, } M(x,y)\, dx+N(x,y)\, dy&=0. \nonumber \end{align}\] is called exact if it can be written as \[\frac{d}{dx}\left(f(x,y)\right) =0 \] for some function \(f(x,y)\) in which \(y\) is a function of \(x\). Then the solution is \[f(x,y)=c.\] Note that comparing \[\frac{d}{dx}\left(f(x,y)\right) =f_x(x,y)+f_y(x,y)\frac{dy}{dx}=0 \] with (12) we get \[\begin{equation*} f_x(x,y)= M(x,y),\, f_y(x,y)=N(x,y). \end{equation*}\] Thus we have \[M_y(x,y)=f_{yx}(x,y)=f_{xy}(x,y)=N_x(x,y).\]
Theorem. Let \(M,N,M_y\) and \(N_x\) be continuous functions on \(R=(a,b)\times (c,d)\). Then the ODE \[M(x,y)\, dx+N(x,y)\, dy=0\] is exact in \(R\) if and only if \[M_y(x,y)=N_x(x,y)\] at each point in \(R\).

Example. \[2xy\, dx+(x^2+3y^2)\, dy=0\] is exact since \[M_y=\frac{\partial}{\partial y}\left(2xy \right)=2x=\frac{\partial}{\partial x}\left(x^2+3y^2 \right)=N_x.\]
Example. \[2xy^2\, dx+(x^2+3y^2)\, dy=0\] is non-exact since \[M_y=\frac{\partial}{\partial y}\left(2xy^2 \right)=4xy\neq 2x=\frac{\partial}{\partial x}\left(x^2+3y^2 \right)=N_x.\]

Steps to solve:

  1. Find a function \(f(x,y)\) such that \[\begin{align*} f_x(x,y)&= M(x,y)\\ f_y(x,y)&=N(x,y). \end{align*}\]

  2. The solution is \(f(x,y)=c.\)

Example. Solve the ODE \[2xy+(x^2+3y^2)\, \frac{dy}{dx}=0.\] Solution. Note that \[M_y=\frac{\partial}{\partial y}\left(2xy \right) =2x=\frac{\partial}{\partial x}\left(x^2+3y^2 \right)=N_x.\] So the given ODE is exact and there is a function \(f(x,y)\) such that \[\begin{align*} f_x(x,y)&= 2xy & (13)\\ f_y(x,y)&=x^2+3y^2.& (14) \end{align*}\] Integrating (13) partially with respect to \(x\), we get \[\begin{eqnarray} \int f_x(x,y)\, dx &=& \displaystyle\int 2xy \, dx \nonumber \\ \implies f(x,y) &=& x^2y+h(y). \;\;\;\; (15) \end{eqnarray}\] Differentiating (15) partially with respect to \(y\), we get \[\begin{equation} f_y(x,y)=x^2+h'(y).\;\;\;\; (16) \end{equation}\] Comparing (14) and (16), we get \(x^2+h'(y)=x^2+3y^2 \implies h'(y)=3y^2\). Thus \[h(y)=\int 3y^2\, dy=y^3.\] From (15) we get \[f(x,y)=x^2y+h(y)=x^2y+y^3.\] Thus the solution is \[x^2y+y^3=c.\]


Non-exact to Exact:
Sometimes a non-exact ODE can made exact when multiplied by an integrating factor \(\mu(x,y)\). For example, \[(2x^2+y^2)\, dx+xy\, dy=0\] is non-exact, but \[\begin{align*} 2x\, [ (2x^2+y^2)\, dx+xy\, dy ]&=0\\ \text{i.e., } (4x^3+2xy^2)\, dx+2x^2y\, dy&=0 \end{align*}\] is exact where \(\mu(x,y)=2x\).

Finding such integrating factor \(\mu(x,y)\) is complicated. So we will concentrate on the IF that is a function of \(x\), i.e., \(\mu(x,y)=\mu(x)\) and \(\mu_y=0\). Suppose the following ODE is exact. \[\mu(x) M(x,y)+\mu(x) N(x,y)\frac{dy}{dx}=0\] \[\begin{align*} (\mu M)_y&=(\mu N)_x\\ \mu_yM+\mu M_y&=\mu_xN+\mu N_x\\ \mu M_y&=\mu_xN+\mu N_x \text{ since } \mu_y=0\\ \mu_xN&=\mu M_y-\mu N_x\\ \frac{d\mu}{dx}&=\mu\frac{M_y-N_x}{N}\\ \int \frac{d\mu}{\mu}&=\int \frac{M_y-N_x}{N}\, dx\\ \ln \mu&=\int \frac{M_y-N_x}{N}\, dx\\ \mu&=e^{\int \frac{M_y-N_x}{N}\, dx}\\ \end{align*}\]
Example. Find an integrating factor that makes the following non-exact ODE exact when multiplied by it. \[(2x^2+y^2)-xy\, \frac{dy}{dx}=0\]
Solution. Here \(M=2x^2+y^2\) and \(N=-xy\). So \[ \frac{M_y-N_x}{N}= \frac{(2y)-(-y)}{-xy}= -\frac{3}{x}.\] \[\begin{align*} \frac{d\mu}{dx}&=\mu\frac{M_y-N_x}{N}=-\mu\frac{3}{x}\\ \int \frac{d\mu}{\mu}&=-3\int \frac{dx}{x}\\ \ln \mu&=-3\ln x=\ln(x)^{-3}=\ln\left(\frac{1}{x^3} \right)\\ \mu&=\frac{1}{x^3}\\ \end{align*}\] So the IF is \(\mu=\frac{1}{x^3}\). We can verify that the following ODE is exact. \[\begin{align*} \frac{1}{x^3}[(2x^2+y^2)-xy\, \frac{dy}{dx}]&=0\\ \left(\frac{2}{x}+\frac{y^2}{x^3}\right)-\frac{y}{x^2}\, \frac{dy}{dx}&=0 \end{align*}\] Checking: \[M_y=\frac{\partial}{\partial y}\left(\frac{2}{x}+\frac{y^2}{x^3}\right)=\frac{2y}{x^3} =\frac{\partial}{\partial x}\left(-\frac{y}{x^2}\right)=N_x.\] The solution is \(2\ln x-\displaystyle\frac{y^2}{2x^2}=c\). (verify)


Last edited