Solution to Exact Differential Equation

Theorem
The first order ordinary differential equation:
 * $$F = M \left({x, y}\right) + N \left({x, y}\right) \frac {dy} {dx} = 0$$

is an exact differential equation iff:
 * $$\frac {\partial M} {\partial y} = \frac {\partial N} {\partial x}$$

The general solution of such an equation is:
 * $$f \left({x, y}\right) = C$$

where:
 * $$\frac {\partial f} {\partial x} = M, \frac {\partial f} {\partial y} = N$$

Necessary Condition

 * Suppose $$F$$ be exact.

Then by definition there exists a function whose second partial derivatives of $$f$$ exist and are continuous:
 * $$f \left({x, y}\right)$$

where:
 * $$\frac {\partial f} {\partial x} = M, \frac {\partial f} {\partial y} = N$$

Differentiating $$M$$ and $$N$$ partially WRT $$y$$ and $$x$$ respectively:


 * $$\frac {\partial M} {\partial y} = \frac {\partial^2 f} {\partial x \partial y}, \frac {\partial N} {\partial x} = \frac {\partial^2 f} {\partial y \partial x}$$

The mixed second partial derivatives are equal, so we have:
 * $$\frac {\partial M} {\partial y} = \frac {\partial N} {\partial x}$$

Sufficient Condition
Now suppose $$F$$ is such that:
 * $$\frac {\partial M} {\partial y} = \frac {\partial N} {\partial x}$$

Take the equation:
 * $$\frac {\partial f} {\partial x} = M$$

and integrate it WRT $$x$$:
 * $$(1) \qquad f = \int M dx + g \left({y}\right)$$

Note that the arbitrary constant here is an arbitrary function of $$y$$, since when differentiating partially WRT $$x$$ it disappears.

So, now we need to find such a $$g \left({y}\right)$$ so as to make $$f$$ as defined in $$(1)$$ satisfy $$\frac {\partial f} {\partial y} = N$$.

We differentiate $$(1)$$ WRT $$y$$ and equate it to $$N$$ to get:
 * $$\frac {\partial} {\partial y} \int M dx + g' \left({y}\right) = N$$

So:
 * $$g' \left({y}\right) = N - \frac {\partial} {\partial y} \int M dx$$

which we can integrate WRT $$y$$:
 * $$g \left({y}\right) = \int \left({N - \frac {\partial} {\partial y} \int M dx}\right) dy$$

which works as long as the thing being integrated is a function of $$y$$ only.

This will happen if its derivative WRT $$x$$. We need to make sure of that, so we try it out:

$$ $$ $$

Lo and behold, this is our initial condition.

The Solution
Then $$F$$ can be written in the form:
 * $$\frac {\partial f} {\partial x} dx + \frac {\partial f} {\partial y} dy = 0$$

and the solution follows.