Integrating factor having “two variables” in differential equations (first order DE)

integrating-factorordinary differential equations

Suppose we have the following problem:
$$(y-xy^2)dx+(x+x^2y^2)dy=0 \label{1}\tag{$*$}$$
If we try to find an integrating factor $\mu$ of a single variable (I.e., either $\mu(x)$ or $\mu(y)$) we will have a contradiction.
Meaning, the integrating factor is a function of two variables, namely, $\mu(x,y)$.

There has been a lot of theory finding it in a "general case". The majority of the techniques are quite advanced and/or quite complicated. However, searching the internet, I came across the method of integrating factor, described for example in this Q&A.

But I want to understand "why" these sequence of steps to find $\mu(x,y)$ works.

For instance, at the start, we let $M=0$ so that we can find $y_0(x)$ then we let $N=0$ so that we can find $x_0(y)$. My first question is: why is the subscript "0" used? More importantly, why do we let $M=0$ and $N=0$?

Secondly, they find $f(x)$ and $g(y)$ using these formulae, that I can derive them; however, this depends on eliminating $x$ or $y$ via the substitution $y_0(x)$ or $x_0(y)$, but again don't know why it works.

Lastly, the relation that they satisfy:
$$
\frac{\partial M}{\partial y} – \frac{\partial N}{\partial x} = N\cdot f(x,y)-M\cdot g(x,y)\label{2}\tag{$***$}
$$

Why there is not a "2" in front of the left-hand side?

I.e., we know: $$ f(x) = \frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{N} $$ and $$ g(y) = -\frac{\frac{\partial M}{\partial y}-\frac{\partial N}{\partial x}}{M} $$

Consequently, $$N\cdot f(x) = \frac{\partial M}{\partial y} -\frac{\partial N}{\partial x}$$

and $$-M\cdot g(y) = \frac{\partial M}{\partial y} -\frac{\partial N}{\partial x} $$

Adding both equations gives:
$$ 2\frac{\partial M}{\partial y} -2\frac{\partial N}{\partial x} = N\dot f(x)-M\cdot g(y)$$

But in \eqref{2}, there is no "2" on the left-hand side?.

My last question is, where did: $\mu(x,y) = e^{\int f(x) dx + \int g(y) dy}$ come from? I.e., how did he go from the above relation to finding the integrating factor $\mu(x,y)$?

An example where it does not work.
$$y dx +(x+3x^3y^4)dy = 0 $$

Here are my steps (following the method): let
$$
\begin{split}
M = 0 & \implies y_0(x)=0\\
N = 0 & \implies x_0(y)=\sqrt{\frac{1}{-3y^4}}
\end{split}
$$
Then
$$
f(x) = \frac{-9x^2y^4}{x+3x^3y^4} = \frac{0}{x}=0
$$
as $y(x)=0$, and
$$
g(y) =\frac{-3}{y}
$$

Hence, $$
\mu = e^{{\int 0dx + \int\frac{-3}{y}dy}} =\frac{1}{y^3}$$

Which is not the correct integrating factor, according to the book, and I had tried it and did not work.
Sorry for the long post and thank you in advance.

Best Answer

To find an integrating factor $\mu$ for $$ y\,dx +(x+3x^3y^4)\,dy = 0 $$ we expand the exactness condition $$ \partial_y(\mu y)=\partial_x(\mu x+3\mu x^3y^4) $$ to $$ (\partial_y\mu)\,y+\mu =(\partial_x\mu)\,(x+3x^3y^4)+\mu+9\mu x^2y^4\,. $$ This is a linear first order PDE for $\mu(x,y)\,:$ $$ 0=-(\partial_y\mu)\,y+(\partial_x\mu)\,(x+3x^3y^4)+9\mu x^2y^4 $$ The solutions could hardly be uglier. I refrain from transcribing the output from Wolfram Alpha.

A better method for this type of ODE is it to step into Oscar Lanzi's footsteps and try the ansatz $$ \mu(x,y)=x^\alpha\, y^\beta\,. $$ This leads to \begin{align} 0&=-x^\alpha \beta\,y^\beta+\alpha\,x^{\alpha-1}y^\beta(x+3x^3y^4)+9\,x^{\alpha+2} y^{\beta+4}\\[2mm] &=-\beta\,x^\alpha y^\beta+\alpha\,x^\alpha y^\beta+3\,\alpha\,x^{\alpha+2}y^{\beta+4}+9\,x^{\alpha+2} y^{\beta+4}\,. \end{align} It is quickly seen that $$\alpha=\beta=-3$$ solves this equation leading to a usable integrating factor.