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 \paren {x e^y + y - x^2} \rd y = \paren {2 x y - e^y - x} \rd 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:


 * $\paren {e^y + x - 2 x y} \rd x + \paren {x e^y + y - x^2} rd y = 0$

Let:
 * $\map M {x, y} = e^y + x - 2 x y$
 * $\map N {x, y} = 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:
 * $\map f {x, y} = C$

where:

Hence:

and:

Thus:
 * $\map f {x, y} = 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.