Finding a general formula for integrating factor Consider the following problem:

Show that if $\frac{N_x-M_Y}{xM-yN} = R$, where $R$ depends on the quantity $xy$ only, then the differential equation $$M + Ny' = 0$$ has an integrating factor of the form $\mu(xy)$. Find a general formula for this integrating factor.

Note that $A_x$ denotes the derivate of the function $A(x, y)$ with respect to $x$. 
I am familiar with the concept of proving that a differential equation is exact and solving it, and using a given integrating factor to make a differential equation exact. I have considered stating $y'$ explicitly and try to deduct an answer from there, but it doesn't seem like an adequate method.
 A: The equation
$$\tag{1} \mu M + \mu Ny' = 0$$
has an integrating factor if
${\left( {\mu M} \right)_y} = {\left( {\mu N} \right)_x} \Leftrightarrow {\mu _y}M + \mu {M_y} = {\mu _x}N + \mu {N_x}$,
that is, if
$$\tag{2} {\mu _y}M - {\mu _x}N = \mu \left( {{N_x} - {M_y}} \right).$$
Let's suppose that ${N_x} - {M_y} = R\left( z \right)\left( {xM - yM} \right)$, where $z=xy$. Plugging the last expression in $(2)$, it follows that $(1)$ is exact if
$$\tag{3} {\mu _y}M - {\mu _x}N = R\left( z \right)\left( {\mu xM - \mu yM} \right).$$
For $(3)$ to be satisfied, we must have
$$\tag{4} \left\{ {\begin{array}{*{20}{c}}{{\mu _y} = \mu xR(z)}\\{{\mu _x} = \mu y R(z)}\end{array}} \right.$$
Now consider $\mu  = \mu \left( {xy} \right) = \mu \left( z \right)$. Then
$$\tag{5} {\mu _x(z)} = \frac{{\partial \mu }}{{\partial z}}\frac{{\partial z}}{{\partial x}} = \mu '(z)y$$
and
$$\tag{6} {\mu _y(z)} = \frac{{\partial \mu }}{{\partial z}}\frac{{\partial z}}{{\partial y}} = \mu '(z)x$$
Plugging $(5)$ and $(6)$ into the system $(4)$, we get
$$\tag{7} \left\{ {\begin{array}{*{20}{c}}{\mu '\left( z \right)x = \mu \left( z \right)xR\left( z \right)}\\{\mu '\left( z \right)y = \mu \left( z \right)yR\left( z \right)}\end{array}} \right. \Rightarrow \mu '\left( z \right) = \mu \left( z \right)R\left( z \right)$$
But this equation is separable:
$$\mu '\left( z \right) = \mu \left( z \right)R\left( z \right) \to \frac{{d\mu }}{\mu } = R\left( z \right)dz.$$
and we get
$$\tag{8} \mu \left( z \right) = {e^{\int {R\left( z \right)dz} }}.$$
Therefore, if $\frac{{{N_x} - {M_y}}}{{xM - yN}} = R\left( {xy} \right)$, the differential equation $M + Ny'=0$ has an integrating factor whose formula is $(8)$.
