Integrating Factor for First Order ODE

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

be non-homogeneous and not exact.

By Existence of Integrating Factor, if $$(1)$$ has a general solution, there exists an integrating factor $$\mu \left({x, y}\right)$$ such that:
 * $$\mu \left({x, y}\right) \left({M \left({x, y}\right) + N \left({x, y}\right) \frac {dy} {dx}}\right) = 0$$

is an exact differential equation.

Unfortunately, there is no systematic method of finding such a $$\mu \left({x, y}\right)$$ for all such equations $$(1)$$.

However, there are certain types of first order ODE for which an integrating factor can be found procedurally.

Function of x or y only
Suppose that:
 * $$g \left({x}\right) = \frac {\frac {\partial M}{\partial y} - \frac {\partial N}{\partial x}}{N}$$

is a function of $$x$$ only.

Then:
 * $$\mu \left({x}\right) = e^{\int g \left({x}\right) dx}$$

is an integrating factor for $$(1)$$.

Suppose that:
 * $$h \left({y}\right) = \frac {\frac {\partial M}{\partial y} - \frac {\partial N}{\partial x}}{M}$$

is a function of $$y$$ only.

Then:
 * $$\mu \left({y}\right) = e^{\int -h \left({y}\right) dy}$$

is an integrating factor for $$(1)$$.

Function of x + y
Suppose that:
 * $$g \left({z}\right) = \frac {\frac {\partial M}{\partial y} - \frac {\partial N}{\partial x}}{N - M}$$

is a function of $$z$$, where $$z = x + y$$.

Then:
 * $$\mu \left({x + y}\right) = \mu \left({z}\right) = e^{\int g \left({z}\right) dz}$$

is an integrating factor for $$(1)$$.

Function of xy
Suppose that:
 * $$g \left({z}\right) = \frac {\frac {\partial M}{\partial y} - \frac {\partial N}{\partial x}}{N y - M x}$$

is a function of $$z$$, where $$z = x y$$.

Then:
 * $$\mu \left({x y}\right) = \mu \left({z}\right) = e^{\int g \left({z}\right) dz}$$

is an integrating factor for $$(1)$$.

Proof
Let us for ease of manipulation express $$(1)$$ in the form of differentials:
 * $$(2) \qquad M \left({x, y}\right) dx + N \left({x, y}\right) dy = 0$$

Now, suppose $$\mu$$ is an integrating factor for $$(2)$$.

Then, by definition, $$\mu M \left({x, y}\right) dx + \mu N \left({x, y}\right) dy = 0$$ is exact.

By Solution to Exact Differential Equation, we have that:
 * $$\frac {\partial \left({\mu M}\right)} {\partial y} = \frac {\partial \left({\mu N}\right)} {\partial x}$$

Evaluating this, using the Product Rule, we get:
 * $$\mu \frac {\partial M} {\partial y} + M \frac {\partial \mu} {\partial y} = \mu \frac {\partial N} {\partial x} + N \frac {\partial \mu} {\partial x}$$

which leads us to:
 * $$\frac 1 \mu \left({N \frac {\partial \mu} {\partial x} - M \frac {\partial \mu} {\partial y}}\right) = \frac {\partial M} {\partial y} - \frac {\partial N} {\partial x}$$.

Let us use $$P \left({x, y}\right)$$ for $$\frac {\partial M} {\partial y} - \frac {\partial N} {\partial x}$$.

Thus we have:
 * $$(3) \qquad \frac 1 \mu = \frac {P \left({x, y}\right)} {N \frac {\partial \mu} {\partial x} - M \frac {\partial \mu} {\partial y}}$$

Proof for Function of x or y only
Suppose that $$\mu$$ is a function of $$x$$ only.

Then:
 * $$\frac {\partial \mu} {\partial x} = \frac {d \mu} {d x}, \frac {\partial \mu} {\partial y} = 0$$

which, when substituting in $$(3)$$, leads us to:
 * $$\frac 1 \mu \frac {d \mu} {d x} = \frac {P \left({x, y}\right)} {N \left({x, y}\right)} = g \left({x}\right)$$

where $$g \left({x}\right)$$ is the function of $$x$$ that we posited.

Similarly, if $$\mu$$ is a function of $$y$$ only, we find that
 * $$\frac 1 \mu \frac {d \mu} {d y} = \frac {P \left({x, y}\right)} {-M \left({x, y}\right)} = h \left({y}\right)$$

where $$h \left({y}\right)$$ is the function of $$y$$ that we posited.

Proof for Function of x + y
Suppose that $$\mu$$ is a function of $$z = x + y$$.

Then:
 * $$\frac {\partial z} {\partial x} = 1 = \frac {\partial z} {\partial y}$$

Thus:
 * $$\frac {\partial \mu} {\partial x} = \frac {d \mu} {d z} \frac {\partial z} {\partial x} = \frac {d \mu} {d z} = \frac {d \mu} {d z} \frac {\partial z} {\partial y} = \frac {\partial \mu} {\partial y}$$

which, when substituting in $$(3)$$, leads us to:
 * $$\frac 1 \mu \frac {d \mu} {d z} = \frac {P \left({x, y}\right)} {N \left({x, y}\right) - M \left({x, y}\right)} = g \left({z}\right)$$

where $$g \left({z}\right)$$ is the function of $$z$$ that we posited.

Proof for Function of x y
Suppose that $$\mu$$ is a function of $$z = x y$$.

Then:
 * $$\frac {\partial z} {\partial x} = y, \frac {\partial z} {\partial y} = x$$.

Thus:
 * $$\frac {\partial \mu} {\partial x} = \frac {d \mu} {d z} \frac {\partial z} {\partial x} = y \frac {d \mu} {d z}, \frac {\partial \mu} {\partial y} = \frac {d \mu} {d z} \frac {\partial z} {\partial y} = x \frac {d \mu} {d z}$$

which, when substituting in $$(3)$$, leads us to:
 * $$\frac 1 \mu \frac {d \mu} {d z} = \frac {P \left({x, y}\right)} {N y - M x} = g \left({z}\right)$$

where $$g \left({z}\right)$$ is the function of $$z$$ that we posited.

Final part of proof
We now have four equations of the form:
 * $$\frac 1 \mu \frac {d \mu} {d w} = f \left({w}\right)$$

which is what you get when you apply the Chain Rule and Derivative of Logarithm Function to:
 * $$\frac {d \left({\ln \mu}\right)}{d w} = f \left({w}\right)$$

Thus:
 * $$\ln \mu = \int f \left({w}\right) d w$$

and so:
 * $$\mu = e^{\int f \left({w}\right) d w}$$

Hence the results as stated;

Technique for finding an Integrating Factor
Suppose, therefore, you were given a differential equation which is in (or can be manipulated into) the form:
 * $$M \left({x, y}\right) + N \left({x, y}\right) \frac {dy} {dx} = 0$$

and it was not homogeneous, exact or even linear.

Then what you can do is evaluate:
 * $$\frac {\partial M}{\partial y} - \frac {\partial N}{\partial x}$$

and see what you get when you divide it by each of $$N$$, $$M$$, $$N - M$$ and $$N y - M x$$ in turn.

Then examine what you get to see if you have a function in $$x$$ only, $$y$$ only, $$x + y$$ or $$xy$$ respectively.

If you do, then you have found an integrating factor and can solve the equation by using the technique defined in Solution to Exact Differential Equation.