Let M(x,y) = x - y2 and N(x,y) = 2xy. Then ∂M/∂y = -2y and ∂N/∂x = 2y. Since ∂M/∂y ≠ ∂N/∂x, this differential equation is inexact. However, by multiplying the equation by an integrating factor, one may turn the inexact ODE into an exact one. First compute
(∂M/∂y - ∂N/∂x)/N = -4y/(2xy) = -2/x.
Then, the integrating factor is
e∫-(2/x) dx = e-2ln|x| = 1/x2.
Multiplying the differential equation by 1/x2 results in
(1) (1 - y2/x2) dx + 2y/x dy = 0.
Since ∂/∂y(1 - y2/x2) = -2y/x2 and ∂/∂x(2y/x) = -2y/x2, (1) is indeed an exact differential equation. Its solution will be of the form u(x,y) = C, where C is a general constant. So
(2) ∂u/∂x = 1 - y2/x2
(3) ∂u/∂y = 2y/x.
Integrating (1) with respect to x yields
(4) u(x,y) = x + y2/x + f(y),
for some function f depending on y. Differentiating (4) with respect to y and comparing with (3), one obtains
(5) 2y/x = 1 + 2y/x + f;'(y).
From (5), 0 = 1 + f'(y), or -1 = f'(y). Hence f(y) = -y + constant, and the general solution of (1) is
x + y2/x - y = C,
which is also the general solution of the original differential equation.