First Order ODE/(x exp y + y - x^2) dy = (2 x y - exp y - x) dx

Theorem
The first order ordinary differential equation:


 * $(1): \quad \left({x e^y + y - x^2}\right) \mathrm d y = \left({2 x y - e^y - x}\right) \mathrm d x$

is an exact differential equation with solution:


 * $2 x e^y + x^2 + y^2 - 2 x^2 y = C$

Proof
Let $(1)$ be expressed in the form:


 * $\left({e^y + x - 2 x y}\right) \mathrm d x + \left({x e^y + y - x^2}\right) \mathrm d y = 0$

Let:
 * $M \left({x, y}\right) = e^y + x - 2 x y$
 * $N \left({x, y}\right) = x e^y + y - x^2$

Then:

Thus $\dfrac {\partial M} {\partial y} = \dfrac {\partial N} {\partial x}$ and $(1)$ is seen by definition to be exact.

By Solution to Exact Differential Equation, the solution to $(1)$ is:
 * $f \left({x, y}\right) = C$

where:

Hence:

and:

Thus:
 * $f \left({x, y}\right) = x e^y + \dfrac {x^2 + y^2} 2 - x^2 y$

and by Solution to Exact Differential Equation, the solution to $(1)$ is:


 * $2 x e^y + x^2 + y^2 - 2 x^2 y = C$

after multiplying by $2$ to clear the fraction.