# Exact Differential Equations 1

A first-order differential equation $$M(x,y)dx+N(x,y)dy=0$$ is called an exact differential equation is there is a scalar function $U(x,y)$ such that $$M(x,y)dx+N(x,y)dy=dU$$ The solution is then $U(x,y)=C$ where $C$ is a constant.

Theorem. Suppose that $M(x,y)$ and $N(x,y)$ have continuous partial derivatives in an open region $\mathcal{R}$. Then the 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}$$ for all $(x,y)\in\mathcal{R}$.

Proof. Suppose that $$M(x,y)dx+N(x,y)dy=0$$ is exact. Then there exists a scalar function $U(x,y)$ such that $$M(x,y)dx+N(x,y)dy=dU$$ Thus $\frac{\partial U}{\partial x}=M(x,y)$ and $\frac{\partial U}{\partial y}=N(x,y)$. Now, $$\frac{\partial M}{\partial y}=\frac{\partial^2U}{\partial y\partial x}=\frac{\partial^2U}{\partial x\partial y}=\frac{\partial N}{\partial x}$$ since $M$ and $N$ have continuous partial derivatives. Conversely suppose that $$\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}$$ for all $(x,y)\in\mathcal{R}$. Since $\frac{\partial U}{\partial x}=M$, $$U(x,y)=\int_{x_0}^x M(x,y)dx+\varphi(y)$$ So \begin{align*}\frac{\partial U}{\partial y}&=\frac{\partial}{\partial y}\int_{x_0}^x M(x,y)dx+\varphi(y)\\&=\int_{x_0}^x \frac{\partial M}{\partial y}dx+\varphi'(y)\\&=\int_{x_0}^x \frac{\partial N}{\partial x}dx+\varphi'(y)\\&=N(x,y)-N(x_0,y)+\varphi'(y)\end{align*} Since $\frac{\partial U}{\partial y}=N$, we have $$\varphi'(x)=N(x_0,y)$$ and so $\varphi(y)$ is found to be $$\varphi(y)=\int_{y_0}^y N(x_0,y)dy+C$$ where $C$ is a constant. Therefore, $$U(x,y)=\int_{x_0}^x M(x,y)dx+\int_{y_0}^yN(x_0,y)dy+C$$ This completes the proof.

Remark. Let $\mathbf{F}(x,y)=M(x,y)\mathbf{i}+N(x,y)\mathbf{j}$. Then $M(x,y)dx+N(x,y)dy$ being an exact differential is equivalent to $\mathbf{F}$ being conservative, because $M(x,y)dx+N(x,y)dy=dU$ if and only if $\mathbf{F}=\nabla U$. A scalar function $U(x,y)$ such that $\mathbf{F}=\nabla U$ is called a potential energy function or shortly a potential in physics. Also $\mathbf{F}\cdot d\mathbf{r}=M(x,y)dx+N(x,y)dy$ so $\mathbf{F}\cdot d\mathbf{r}=dU$ means that the work done by the force $\mathbf{F}$does not depend on the particle’s path but only depends on the initial point and the terminal point of the particle’s path.

Remark. Let us consider a complex differential $f(z)dz$. Let $z=x+iy$ and $f(z)=u(x,y)+iv(x,y)$ where $u(x,y)$ and $v(x,y)$ are scalar functions. Then $$f(z)dz=(u+iv)(dx+idy)=(udx-vdy)+i(vdx+udy)$$ This complex differential is exact if and only if both $udx-vdy$ and $vdx+udy$ are exact i.e. $u$ and $v$ satisfy \begin{aligned}\frac{\partial u}{\partial x}&=\frac{\partial v}{\partial y}\\\frac{\partial v}{\partial x}&=-\frac{\partial u}{\partial y}\end{aligned}\label{eq:cauchy-riemann} \eqref{eq:cauchy-riemann} are called the Cauchy-Riemann equations.  If $u$ and $v$ satisfy the Cauchy-Riemann equations \eqref{eq:cauchy-riemann}, they both satisfy Laplace’s equation $$\nabla^2\varphi=\frac{\partial^2\varphi}{\partial x^2}+\frac{\partial^2\varphi}{\partial y^2}=0$$ i.e. $u$ and $v$ are harmonic functions, in particular $v$ is called the harmonic conjugate of $u$. Furthermore $f(z)=u(x,y)+iv(x,y)$ is analytic meaning $\frac{df}{dz}$ exist and is given by $\frac{df}{dz}=\frac{\partial u}{\partial x}+i\frac{\partial v}{\partial x}$. Conversely, if $f(z)=u(x,y)+iv(x,y)$ is analytic then $v$ is a harmonic conjugate of $u$. For more details about harmonic functions see my lecture note here. Functions of a Complex Variable studies differentiation and integrations of complex analytic functions. Laplace’s equation is related to a minimum electrostatic energy. If $\mathbf{E}$ is the electrostatic force field, then in terms of the static potential energy $\varphi$, $\mathbf{E}=\nabla\varphi$. If one imposes the requirement that the static potential energy (associated with the field) in a given volume be a minimum, then it can be shown using Calculus of Variations that $\varphi$ satisfies $\nabla^2\varphi=0$. For details see page 943 of George Arfken, Mathematical Methods for Physicists, 3rd Edition, Academic Press, 1985.

Example.  Show that each equation is exact and find solution.

1. $2xydx+(x^2-2y)dy$
2. $(7x+3y)dx+(3x-5y)dy=0$

Solution.

1. $M=2xy$ and $N=x^2-2y$. Since $\frac{\partial M}{\partial y}=2x=\frac{\partial N}{\partial x}$, the equaiton is exact. Let $U$ be a scalar function such that $2xydx+(x^2-2y)dy=dU$. Then $\frac{\partial U}{\partial x}=2xy$, $\frac{\partial U}{\partial y}=x^2-2y$. From $\frac{\partial U}{\partial x}=2xy$, we get \begin{align*}U(x,y)&=\int_0^x\frac{\partial U}{\partial x}dx+\varphi(y)\\&=\int_0^x 2xydx+\varphi(y)\\&=x^2y+\varphi(y)\end{align*} Differentiating $U$ with respect to y  $$\frac{\partial U}{\partial y}=x^2+\varphi'(y)$$ Since we also have $\frac{\partial U}{\partial y}=x^2-2y$, $\varphi'(y)=-2y$ and $$\varphi(y)=\int_0^y -2ydy+C_1=-y^2+C_1$$ Therefore $U(x,y)=x^2y-y^2+C_1$. The solution is $x^2y-y^2+C_1=C_2$ which can then be written as $x^2y-y^2=C$.
2. Left as exercise for readers. The answer is $$\frac{7}{2}x^2+3xy-\frac{5}{2}y^2=C$$

Remark. The equation in #2 is also homogeneous so of course it can be solved as one. $$f(u)=-\frac{M(1,y)}{N(1,y)}=-\frac{7+3u}{3-5u}$$ and so \begin{align*}\int\frac{du}{f(u)-u}&=-\int\frac{5u-3}{5u^2-6u-7}du\\&=-\frac{1}{2}\int\frac{10u-6}{5u^2-6u-7}du\\&=-\frac{1}{2}\ln(5u^2-6u-7)\\&=\ln\frac{1}{\sqrt{5u^2-6u-7}}\end{align*} Hence the solution is $$x=C_1e^{\int\frac{du}{f(u)-u}}=\frac{C_1}{\sqrt{5u^2-6u-7}}$$ which can be written as $$5x^2y^2-6xy-7x^2=C_2$$ Notice that this is equivalent to the solution given above.