Solve differential equation: $y' = \frac{y^2}{x^3} + 2\frac{y}{x} - x$ I need to solve this differential equation: $y' = \frac{y^2}{x^3} + 2\frac{y}{x} - x$.
My attempt
I found that $y = x^2$ is a solution. Then I tried to put $y = x^2f(x)$, and solved this way:
$$2xf(x) + x^2f'(x) = xf^2(x) + 2xf(x) - x \implies x^2f'(x) = xf^2(x) - x \implies$$
$$xf'(x) = f^2(x) - 1 \implies \frac{df(x)}{f^2(x) - 1} = \frac{dx}{x} \implies$$
$$\frac{1}{2}\ln\left|\frac{f(x) - 1}{f(x) + 1}\right| = \ln|x| + C_* \implies \frac{f(x) - 1}{f(x) + 1} = Cx^2 \implies$$
$$f(x) = \frac{1 + Cx^2}{1 - Cx^2}$$
And we lost a solution $f(x) = -1$. So finally we have
$$y = x^2\frac{1 + Cx^2}{1 - Cx^2}, y = -x^2$$
Now I have 3 questions:
$\quad 1)$ Is my solution correct? I'm not sure that all solutions were found.
$\quad 2)$ When can we use particular solution to find all other solutions? I mean doing something like $y = g(x)h(x)$, where $g(x)$ is a particular solution.
$\quad 3)$ Is there an easier method to solve this equation?
 A: With a slightly different approach,
$$\frac{y'}x=\left(\frac y{x^2}+1\right)^2-2$$
indeed hints the change of variable
$$y=x^2z,$$ which makes the equation separable,
$$\frac{2xz+x^2z'}x=(z+1)^2-2,$$
$$\frac{z'}{z^2-1}=\frac1x$$
and
$$\text{artanh } z=\log Cx,$$
$$z=\tanh \log Cx.$$
$$y=x^2\sqrt{\frac{1+Cx}{1-Cx}}.$$

There remains to discuss the special case $z=\pm1$, such that $z'=0$, giving the two extra solutions
$$y=\pm x^2.$$
A: For question 3
$$y' = \frac{y^2}{x^3} + 2\frac{y}{x} - x$$
$$y'- 2\frac{y}{x}  = \frac{y^2}{x^3} - x$$
$$\left ( \dfrac y {x^2} \right )'= \frac{y^2}{x^5}-\frac{1}{x} $$
It's separable.
$$\left ( \dfrac y {x^2} \right )'=\dfrac 1 x \left ( \frac{y^2}{x^4}-1 \right) $$
$$\dfrac {du}{u^2-1}=\dfrac {dx}{x}$$
Where $ u=\dfrac y {x^2}$
Integrate.
I got this
$$y(x)=x^2\dfrac {1+Kx^2}{1-Kx^2}$$
For $K=0$ you have the particular solution you find by inspection :$y=x^2$
A: 1.) It is correct, if a little unusual.
2.a) The usual way for a Riccati equation with a particular solution is to set $y(x)=y_p(x)+\frac1{u(x)}$ which should result in a linear first order DE for $u$.
2.b) It is typical for Riccati equation that the solution family is similar to a circle, that is, that the real line for the parameter is closed at $\infty$ where you get the missing solution. In the present case replace $C=1/B$ to get the alternative solution formula
$$
y(x)=x^2\,\frac{B+x^2}{B-x^2},
$$
where now the parameter $B=0$ results in $y(x)=-x^2$.
3.) The alternative is to parametrize solutions as $y(x)=-x^3\frac{u'(x)}{u(x)}$ so that
$$
y'(x)=-x^3\frac{u''(x)}{u(x)}-3x^2\frac{u'(x)}{u(x)}+x^3\frac{u'(x)^2}{u(x)^2}
=x^3\frac{u'(x)^2}{u(x)^2}-2x^2\frac{u'(x)}{u(x)}-x
$$
which cancels and reduces to
$$
0=x^2u''(x)+xu'(x)-u(x)
$$
which is an Euler-Cauchy equation with basis solutions $x$ and $x^{-1}$,
$$
y(x)=-x^3\,\frac{A-Bx^{-2}}{Ax+Bx^{-1}}=-x^2\frac{Ax^2-B}{Ax^2+B}.
$$
