Find a general solution to $xy’ = y^2+y$

ordinary differential equations

I'm trying to find the general solution to $xy' = y^2+y$, although I'm unsure as to whether I'm approaching this correctly.

What I have tried:

dividing both sides by x and substituting $u = y/x$ I get:

$$y' = u^2x^2+u$$

Then substituting $y' = u'x + u$ I get the following:
$$u'x+u = u^2x^2+u \implies u' = u^2x \implies \int\frac{du}{u^2}=\int x dx$$
Proceeding on with simplification after integration:
$$\frac{1}{u}=\frac{x^2}{2}+c\implies y = \frac{2x}{x^2+c}$$

However, the answer shows $y=\frac{x}{(c-x)}$

Best Answer

You say that $$y' = u^2x^2+u$$ but $$y' = \frac{y^2+y}{x} = \bigg(\frac{y}{x}\bigg)^2 x + u = u^2 x +u.$$ So here's a mistake.

The right solution:

$$xdy = (y^2 + y)dx$$ $$\frac{dy}{y^2+y} = \frac{dx}{x}$$ $$\frac{dy}{y} - \frac{dy}{y+1} = \frac{dx}{x}$$ $$ln|y| - ln|y+1| = ln|x| + C_1$$ $$\frac{y}{y+1} = C x$$ $$1-\frac{1}{y+1} = C x$$ $$1-Cx = \frac{1}{y+1}$$ and so on.