# Exact Differential Equations 2

In here, we discussed that a first-order differential equation $M(x,y)dx+N(x,y)dy=0$ is exact if and only if $\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}$ in which case we can solve the exact equation by finding a potential $U$ such that $M(x,y)dx+N(x,y)dy=dU$. Let $\frac{\partial M}{\partial y}\ne\frac{\partial N}{\partial x}$ and multiply the equation by a function $\mu(x,y)$ (which is unbeknownst to us at the moment). $$\mu(x,y)M(x,y)dx+\mu(x,y)N(x,y)dy=0$$ Assume that this new equation is exact. Then $$\frac{\partial \mu M}{\partial y}=\frac{\partial \mu N}{\partial x}$$ which is equivalent to \begin{equation}\label{eq:exact}N\frac{\partial\mu}{\partial x}-M\frac{\partial\mu}{\partial y}=\mu\left(\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}\right)\end{equation} Let us consider a simple case $\mu=\mu(x)$. Then \eqref{eq:exact} reduces to \begin{equation}\label{eq:exact2}\frac{d\mu}{dx}=\frac{\mu\left(\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}\right)}{N}\end{equation} If the RHS of \eqref{eq:exact2} depends only on the $x$ variable, \eqref{eq:exact2} is a separable equation $$\frac{d\mu}{\mu}=\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}dx$$ and $\mu(x)$ is found by $$\mu(x)=\exp\left[\int\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}dx\right]$$ Similarly, if $\mu=\mu(y)$ then $$\mu(y)=\exp\left[-\int\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{M}dx\right]$$ provided $\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{M}$ depends only on the $y$ variable.

Example. Solve the equation $$(x^2-y)dx+(x^2y^2+x)dy=0$$

Solution. $\frac{\partial M}{\partial y}=-1$, $\frac{\partial N}{\partial x}=2xy^2+1$. $\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}=-\frac{2}{x}$ so $\mu(x)=\frac{1}{x^2}$. Now, \begin{align*}\mu Mdx+\mu Ndy&=\left(1-\frac{y}{x^2}\right)dx+\left(y^2+\frac{1}{x}\right)dy\\&=dx+y^2dy+\frac{xdy-ydx}{x^2}=0\end{align*} Since the last term is $d\left(\frac{y}{x}\right)$, by integrating we find the solution $$3x^2+xy^3+3y-Cx=0$$

Revisiting First-Order Linear Differential Equations

A first-order linear differential equation $\frac{dy}{dx}+P(x)y=Q(x)$ can be written as $$(P(x)y-Q(x))dx+dy=0$$ Let $M=Py-Q$ and $N=1$. Then $\frac{\partial M}{\partial y}=P$ and $\frac{\partial N}{\partial x}=0$ so $$\mu=e^{\int\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N}dx}=e^{\int P(x)dx}$$ Now let $$\mu(P(x)y-Q(x))dx+\mu dy=dU$$ for some scalar function $U$. Then $$\frac{\partial U}{\partial x}=\mu Py-\mu Q,\ \frac{\partial U}{\partial y}=\mu$$ $$U(x,y)=\int_0^y\mu dy+\varphi(x)=\mu y+\varphi(x)$$ and $$\frac{\partial U}{\partial x}=\mu’y+\varphi'(x)=\mu Py+\varphi'(x)=\mu Py-\mu Q$$ Thus $\varphi'(x)=-\mu Q$ and hence $\varphi(x)=-\int\mu Qdx$. Since $\varphi(x)$ contains an arbitrary constant, we can set $U(x,y)=0$ for the general solution i.e. $\mu y-\int\mu Qdx=0$ and thereby $$y=\frac{\int\mu Qdx}{\mu}$$