Example 2
\begin{align} \frac {dy}{dx} & =-\frac {y}{x}+x^{2}\nonumber \\ dy & =\left ( \frac {-y+x^{3}}{x}\right ) dx\nonumber \\ xdy & =-ydx+x^{3}dx\nonumber \\ 0 & =-xdy-ydx+x^{3}dx \tag {1}\end{align}
But RHS is complete differential because
\[ -xdy-ydx+x^{3}dx=d\left ( \frac {x^{4}}{4}-xy\right ) \]
Hence (1) becomes
\[ 0=d\left ( \frac {x^{4}}{4}-xy\right ) \]
Integrating gives
\[ 0=\frac {x^{4}}{4}-xy+c \]
solving for \(y\)
gives
\[ y=\frac {x^{3}}{4}+\frac {c}{x}\]