$M~dx + N~dy = 0$
$2y(x^2 - y + x)~dx + (x^2 - 2y)~dy = 0$
$M = 2y(x^2 - y + x) = 2x^2y - 2y^2 + 2xy$
$N = x^2 - 2y$
$\dfrac{\partial M}{\partial y} = 2x^2 - 4y + 2x$
$\dfrac{\partial N}{\partial x} = 2x$
$\dfrac{\partial M}{\partial y} - \dfrac{\partial N}{\partial x} = (2x^2 - 4y + 2x) - 2x$
$\dfrac{\partial M}{\partial y} - \dfrac{\partial N}{\partial x} = 2x^2 - 4y = 2(x^2 - 2y)$
$\dfrac{1}{N}\left( \dfrac{\partial M}{\partial y} - \dfrac{\partial N}{\partial x} \right) = \dfrac{2(x^2 - 2y)}{x^2 - 2y} = 2$ → a function of x alone
$f(x) = 2$
Integrating factor
$u = e^{\int f(x)~dx} = e^{\int 2~dx} = e^{2x}$
Thus,
$uM~dx + uN~dy = 0$
$(e^{2x})2y(x^2 - y + x)~dx + e^{2x}(x^2 - 2y)~dy = 0$
$(2x^2e^{2x}y - 2e^{2x}y^2 + 2xe^{2x}y)~dx + (x^2e^{2x} - 2e^{2x}y)~dy = 0$
$x^2e^{2x}~dy + (2x^2e^{2x}y + 2xe^{2x}y)~dx - 2e^{2x}y)~dy - 2e^{2x}y^2~dx = 0$
$[ \, x^2e^{2x}~dy + y(2x^2e^{2x} + 2xe^{2x})~dx \, ] - [ \, e^{2x}(2y~dy) + y^2(2e^{2x}~dx) \, ] = 0$
$d[ \, (x^2e^{2x})y \, ] - d(e^{2x}y^2) = 0$
$\displaystyle \int d(x^2e^{2x}y) - \int d(e^{2x}y^2) = 0$
$x^2e^{2x}y - e^{2x}y^2 = c$
$x^2y - y^2 = ce^{-2x}$
$y(x^2 - y) = ce^{-2x}$ answer