# How to prove this exact Differential Equation is exact?

Take a look at this differential equation:

$$(x^3 + xy^2-y)dx + (y^3+yx^2+x)dy = 0$$

For equation to be exact, we need to prove,

$$\frac {\partial M}{\partial y} = \frac {\partial N}{\partial x}$$

but here,

$M = x^3+xy^2-y$ and $\frac {\partial M}{\partial y} =2xy-1$

and,

$N = y^3+yx^2+x$ and $\frac {\partial N}{\partial x} =2xy+1$

Clearly, $\frac {\partial M}{\partial y} \neq \frac {\partial N}{\partial x}$

But now, if we rearrange the differential equation like this, $$xdx + ydy + \frac{xdy-ydx}{x^2+y^2} = 0$$

then we get, $\frac {\partial M}{\partial y} = \frac {\partial N}{\partial x}$ = $\frac {y^2-x^2}{(x^2+y^2)^2}$

Now I know this differential equation IS exact, as i have taken this from an example in a book, but to solve this exact differential equation, they have rearranged it first to the form I have mentioned above. Why can't we prove $\frac {\partial M}{\partial y} = \frac {\partial N}{\partial x}$ in its initial form?

Your original differential equation $$(x^3+xy^2-y)\,dx+(y^3+yx^2+x)\,dy=0$$ is not exact. What one might do is to multiply it by a function (called integrating factor) $\mu(x,y)$ to make $$\mu(x,y)(x^3+xy^2-y)\,dx+\mu(x,y)(y^3+yx^2+x)\,dy=0$$ exact.

In general, if one starts with $$P(x,y)\,dx+Q(x,y)\,dy=0,$$ then the differential equation $$\mu(x,y)\bigl(P(x,y)\,dx+Q(x,y)\,dy\bigr)=0$$ is exact if (check this) $\mu$ satisfies $$P\mu'_y-Q\mu'_x+\mu\bigl(P'_y-Q'_x\bigr)=0.\tag{*}$$ You do not need to find the general solution to this partial differential equation, it suffices to find a particular solution. In your case, one solution to $(^*)$ is given by $$\mu(x,y)=\frac{1}{x^2+y^2}.$$ This is why your differential equation becomes exact after multiplying with that $\mu$.

It does seems weird to divide the the equation by $x^2+y^2$ with no reason, but of course, there is a reason to do it. Your equation is not exact, thus you want to find an integration factor such that it will become exact and this is what they have done. The integrating factor in this case is $\displaystyle \frac{1}{x^2+y^2}$.

Let's prove it. Noticing the equation could be written as $$\left[x\left(x^2+y^2\right)-y\right]\text{d}x+\left[y\left(x^2+y^2\right)+x\right]\text{d}y=0$$We would like to find an integrating factor of the form $\mu(x^2+y^2)$.

Let $M(x,y)\text{d}x+N(x,y)\text{d}y=0$ be non exact equation such that an integrating factor of the form $\mu(x^2+y^2)$ makes it exact, i.e $$\underbrace{\mu(x^2+y^2)M(x,y)}_{\tilde{M}}+\underbrace{\mu(x^2+y^2)N(x,y)}_{\tilde{N}}=0$$is exact, which means that $\tilde{M}_y=\tilde{N}_x$, thus $$2y\mu'(x^2+y^2)M(x,y)+2\mu(x^2+y^2)M_y=2x\mu'(x^2+y^2)N(x,y)+\mu(x^2+y^2)N_y$$and after simplifying we find $\displaystyle \frac{\mu'(x^2+y^2)}{\mu(x^2+y^2)}=\frac{N_x-M_y}{2yM(x,y)-2xN(x,y)}$.

In your case we will get $$\frac{\mu'(x^2+y^2)}{\mu(x^2+y^2)}=-\frac{1}{x^2+y^2}\Longrightarrow \mu(x^2+y^2)=\frac{1}{x^2+y^2}$$ Multiplying the equation by $\mu(x^2+y^2)$ will make it exact.

Side note - in some cases, it is not so simple to guess the required form of integrating factor, but you can develop some intuition. In this case the hint of the required form was the appearance of $x^2+y^2$ terms in the original equation.