Example
\begin{align*} ydx+x\left ( x^{2}y-1\right ) dy & =0\\ M\left ( x,y\right ) +N\left ( x,y\right ) y^{\prime } & =0 \end{align*}

Where

\begin{align*} \frac {\partial M}{\partial y} & =1\\ \frac {\partial N}{\partial x} & =3x^{2}y-1 \end{align*}

Hence not exact. Trying the above 3 methods shows it is not possible to find an integrating factor. But by inspection let \(I=\frac {y}{x^{3}}\). Then the ode becomes

\begin{align*} yIdx+Ix\left ( x^{2}y-1\right ) dy & =0\\ y\frac {y}{x^{3}}dx+\frac {y}{x^{3}}x\left ( x^{2}y-1\right ) dy & =0\\ \frac {y^{2}}{x^{3}}dx+\left ( y^{2}-\frac {y}{x^{2}}\right ) dy & =0\\ M\left ( x,y\right ) +N\left ( x,y\right ) y^{\prime } & =0 \end{align*}

Where

\begin{align*} M & =\frac {y^{2}}{x^{3}}\\ N & =\left ( y^{2}-\frac {y}{x^{2}}\right ) \end{align*}

Now we see that the ode is exact by checking:

\begin{align*} \frac {\partial M}{\partial y} & =\frac {2y}{x^{3}}\\ \frac {\partial N}{\partial x} & =-\left ( -2\frac {y}{x^{3}}\right ) =\frac {2y}{x^{3}}\end{align*}

Since ode is now exact, we need to find \(\phi \) from

\begin{align} \frac {\partial \phi }{\partial x} & =M\tag {3}\\ \frac {\partial \phi }{\partial y} & =N \tag {4}\end{align}

From (3)

\[ \frac {\partial \phi }{\partial x}=\frac {y^{2}}{x^{3}}\]

Therefore

\begin{align} \phi & =\int Mdx+f\left ( y\right ) \nonumber \\ & =\int \frac {y^{2}}{x^{3}}dx+f\left ( y\right ) \nonumber \\ & =y^{2}\int x^{-3}dx+f\left ( y\right ) \nonumber \\ & =y^{2}\frac {x^{-2}}{-2}+f\left ( y\right ) \nonumber \\ & =\frac {y^{2}}{-2x^{2}}+f\left ( y\right ) \tag {5}\end{align}

Where \(f\left ( y\right ) \) is arbitrary function to be found. Taking derivative of the above w.r.t. \(y\) gives

\begin{align*} \frac {\partial \phi }{\partial y} & =\frac {d}{dy}\left ( -\frac {y^{2}}{2x^{2}}+f\left ( y\right ) \right ) \\ & =-\frac {y}{x^{2}}+f^{\prime }\left ( y\right ) \end{align*}

Comparing the above to (4) shows that

\begin{align*} N & =-\frac {y}{x^{2}}+f^{\prime }\left ( y\right ) \\ y^{2}-\frac {y}{x^{2}} & =-\frac {y}{x^{2}}+f^{\prime }\left ( y\right ) \\ f^{\prime }\left ( y\right ) & =y^{2}\end{align*}

Hence

\begin{align*} f\left ( y\right ) & =\int y^{2}dy\\ & =\frac {y^{3}}{3}+c \end{align*}

Substituting this into (5) gives

\begin{align*} \phi & =\frac {y^{2}}{-2x^{2}}+f\left ( y\right ) \\ & =\frac {y^{2}}{-2x^{2}}+\frac {y^{3}}{3}+c \end{align*}

Since \(\phi \) is also constant function then we can simplify the above to

\begin{align*} \frac {y^{2}}{-2x^{2}}+\frac {y^{3}}{3} & =C\\ 3y^{2}-2x^{2}y^{3} & =6x^{2}C\\ 3y^{2}-2x^{2}y^{3} & =x^{2}C_{1}\end{align*}