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$$
This is because for some function F, $F_{xy} = F_{yx}$ by Clairaut's Theorem. $M = F_x$, so the above equation holds.
However, even if this fails, the differential equation may still 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
The way to find this special integrating factor can be to assume that this differential equation has a solution:
$$\rho M(x,y)dx + \rho N(x,y)dy = 0$$
This is only true when $\left(\rho M\right)_y = \left(\rho N\right)_x$, by the same logic as before. We use the multivariable chain rule to write this out:
$$M\rho_y + \rho M_y = N\rho_x + \rho N_x$$
We cannot solve this. This is a difficult partial differential equation. However, we can split this up into cases.
$$\text{Case 1: } \rho \text{ is only in terms of x}$$
$$M\rho_y + \rho M_y = N\rho_x + \rho N_x \to \rho M_y = N\dfrac{d\rho}{dx} + \rho N_x$$
$$\int \dfrac{M_y - N_x}{N}\,\mathrm{d}x = \int\dfrac{1}{\rho}\, \mathrm{d}\rho \to \rho = e^{\int \frac{M_y - N_x}{N}\,\mathrm{d}x}$$
Note that we stipulated that $\rho$ could only have x terms. Therefore, the right side of the equation must also only have x terms. This is only true when $\dfrac{M_y - N_x}{N}$ has only x terms.
$$\text{Case 2: } \rho \text{ has only y terms}$$
We do the same procedure, eliminating the $\rho_x$ term, and we end up getting
$$\rho = e^{\int \frac{N_x - M_y}{M}\, \mathrm{d}y}$$
We know both of these $\rho$ scenarios satisfy $\rho M(x,y)dx + \rho N(x,y)dy = 0$. They were just special cases.
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}$$
$$(3x^2 + y)dx + (x^2y - x)dy = 0$$
We immediately calculate $M_y$ and $N_x$.
$$M_y = 1, N_x = 2xy - 1$$
Something useful is to just subtract one from the other. It doesn't matter whether it's $M_y - N_x$ or vice-versa, because you can just negate if you see that you need to divide by M.
$$M_y - N_x = 2 - 2xy$$
We can look at both equations to see if this is a multiple of either M or N. We see that N equals (-x/2) * the expression above.
$$\dfrac{2 - 2xy}{x^2y - x} = \dfrac{-2(xy - 1)}{x(xy - 1)} = \dfrac{-2}{x}$$
This is written only in terms of x, so we can write
$$\rho = e^{\int \frac{-2}{x}\, \mathrm{d}x} =\dfrac{1}{x^2}$$
$$\rho Mdx + \rho Ndy = 0$$
$$(3 + \dfrac{y}{x^2})dx + (y - \frac{1}{x})dy = 0$$
We know $M_y$ = $N_x$ now, so we can say
$$F_x = 3 + \dfrac{y}{x^2} \to F = 3x - \frac{y}{x} + G(y)$$
$$F_y = y - \dfrac{1}{x} \to F = \dfrac{y^2}{2} - \frac{y}{x} + H(x)$$
$$F = 3x - \dfrac{y}{x} + \dfrac{y^2}{2}$$
$$\boxed{3x - \dfrac{y}{x} + \dfrac{y^2}{2} = C}$$