Thread: Solve y^2 + xy dy/dx = 0 by integrating factor?

1. Solve y^2 + xy dy/dx = 0 by integrating factor?

a) Given (dN/dx - dM/dy) = Q, which is a function of only y. Prove that

e^ $\int$Q dy is an integrating factor of the equation
M dx + N dy = 0, where M and N are functions of x and y.

b) Solve
y^2 + x y dy/dx = 0
by finding an integrating factor to make it exact.

This is how I did:
M = y^2
N = x y
dN/dx = y
dM/dy = 2y

dN/dx - dM/dy = y - 2y = -y
(dN/dx - dM/dy)/M = -y/y^2 = -1/y, which is a function of y
Therefore, from part a,
an integrating factor is

e^[ $\int$-1/y dy] = e^[-ln |y|]

Multiplying both sides of the given equation by the integrating factor,
y^2 e^[-ln |y|] + x y e^[-ln |y|] dy/dx = 0
d/dx (x y^2 e^[-ln|y|]) = 0
x y^2 e^[-ln|y|] = C ( a constant)
y^2 e^[-ln|y|] = C/xIs this correct?

c) Solve the above differential equation by finding am integrating factor to make it separable.
I think the integrating factor in part b also makes it separable. So can I use the same answer?
But I think the equation can be solved much easier as follows:

y^2 + x y dy/dx = 0
y (y + x dy/dx) = 0
y = 0 Or
y + x dy/dx = 0
Or y = -x dy/dx
Or, dy/y = -1/x dx
Or,dy/dy + dx/x = 0
ln y + ln x = C (a constant)
ln(xy) = C
xy = e^C = K, where K is a constant
y = K/x, if X is not zero

If x is zero, then from the given equation
y^2 + 0 = 0
Or, y = 0

Is this correct? Can I use this in the answer?