MathJax TeX Test Page
The general form of our solutions to differential equations is $$F(x,y(x)) = C$$
So, let's differentiate with respect to x. $$\dfrac{\partial F}{\partial x} + \dfrac{\partial F}{\partial y}\dfrac{dy}{dx} = 0 \to F_x\, dx + F_y\, dy = 0 $$.
That's the basic idea for this post. We are given an equation in the form of $M\, dx + N\, dy = 0$, and we have to find the F such that $F_x = M$, and $F_y = N$. If it does have an F, we call that **exact**.
How can we determine this? We must check if
$$M_y = N_x$$
If not, don't worry, it still may have a solution. Imagine the differential equation $ydx + xdy = 0$. The function $F(x,y) = xy$. Now, let's multiply through by x. $xydx + x^2dy = 0$. $M_y = x,$ and $N-x = 2x$. The two aren't equal. So, we need to figure out a way to account for that.

MathJax TeX Test Page
There are two ways of finding the integrating factor. One method is guess-and-check. The other method can only be done if the integrating factor is a function of only x or only y. If $\dfrac{M_y - N_x}{N}$ has only x terms, $$\rho(x) = e ^{\int \frac{M_y - N_x}{N} dx}$$
If $\dfrac{N_x - M_y}{M}$ has only y terms, $$\rho(y) = e ^{\int \frac{N_x - M_y}{M} dy}$$
Then, you know the following equation is exact $$\rho Mdx + \rho Ndy = 0$$

MathJax TeX Test Page
If you know an equation is exact, you just have to find the function F. $$Mdx + Ndy = 0$$. So, $M = f_x$. Therefore, you must partially integrate M with respect to x. In addition, you must partially integrate N with respect to y, because $N = f_y$. After doing that, the two functions may be different, so you combine their terms. I will illustrate this with an example.

MathJax TeX Test Page
$$2xydx + (y^2 - x^2)dy = 0$$
$$N_x - M_y = -2x - (2x) = -4x, \dfrac{-4x}{2xy} = \dfrac{-2}{y}$$
That has only y terms, so it works!
$$\rho = e^{\int\frac{-2}{y}\,dy} = e^{-2\ln(y)} = \frac{1}{y^2}$$
Now, I multiply both parts by the integrating factor.
$$\dfrac{2x}{y}dx + (1 - \dfrac{x^2}{y^2})dy = 0$$
First, I partially integrate the first part with respect to x. $$f_x = \dfrac{2x}{y}, F = \dfrac{x^2}{y} + C$$
Now, I partially integrate the second part with respect to y.
$$f_y = 1 - \dfrac{x^2}{y^2}, F = \dfrac{x^2}{y} + y + C$$
So, we combine the two terms, and we get $$\dfrac{x^2}{y} + y = C \to \boxed{x^2 + y^2 = Cy}$$