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

Theorem
The first order ODE:
 * $(1): \quad \left({x y - 1}\right) \, \mathrm d x + \left({x^2 - x y}\right) \mathrm d y = 0$

has the solution:
 * $x y - \ln x - \dfrac {y^2} 2 + C$

This can also be presented in the form:
 * $\dfrac {\mathrm d y} {\mathrm d x} + \dfrac {x y - 1} {x^2 - x y} = 0$

Proof
We note that $(1)$ is in the form:
 * $M \left({x, y}\right) \mathrm d x + N \left({x, y}\right) \mathrm d y = 0$

but that $(1)$ is not exact.

So, let:
 * $M \left({x, y}\right) = x y - 1$
 * $N \left({x, y}\right) = x^2 - x y = x \left({x - y}\right)$

Let:
 * $P \left({x, y}\right) = \dfrac {\partial M} {\partial y} - \dfrac {\partial N} {\partial x}$

Thus:

It can be observed that:

Thus $\dfrac {P \left({x, y}\right)} {M \left({x, y}\right)}$ is a function of $x$ only.

So Integrating Factor for First Order ODE: Function of One Variable can be used:


 * $\mu \left({y}\right) = e^{\int g \left({x}\right) \mathrm d x}$

Hence:

Thus an integrating factor for $(1)$ has been found:
 * $\mu = \dfrac 1 x$

which yields, when multiplying it throughout $(1)$:
 * $\left({y - \dfrac 1 x}\right) \, \mathrm d x + \left({x - y}\right) \mathrm d y = 0$

which is now exact.

Let $M$ and $N$ be redefined as:


 * $M \left({x, y}\right) = y - \dfrac 1 x$
 * $N \left({x, y}\right) = x - y$

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 y - \ln x - \dfrac {y^2} 2$

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


 * $x y - \ln x - \dfrac {y^2} 2 + C$