Solve $y' + y^2 = \frac{1}{x^2}$ by introducing $z = xy$ as a new function. Question:
Solve the equation:
$$y' + y^2 = \frac{1}{x^2},~~~~~~~~~x > 0$$
by introducing $z = xy$
Attempted answer:
$z = xy \Rightarrow y = \frac{z}{x}$
Taking the derivative of $y$ with respect to $x$ using he product rule:
$$y' = \frac{z'}{x} - \frac{z}{x}$$
Adding this into the original equation:
$$\frac{z'}{x} - \frac{z}{x^2} + \frac{z^2}{x^2} = \frac{1}{x^2}$$
Putting $z$ and $x$ on each side:
$$\frac{z'}{1-z^2 + z} = \frac{1}{x}$$
Integrating on each side:
$$\int \frac{1}{1-z^2 + z}dz = \int \frac{1}{x} dx$$
This produces
$$z(x) = \frac{(1+\sqrt{5})c_1x^{\sqrt{5}}+1-\sqrt{5}}{(2c_1 x^{\sqrt{5}}+2)}$$
Substituting back to $y$:
$$y(x) = \frac{(1+\sqrt{5})c_1x^{\sqrt{5}}+1-\sqrt{5}}{x(2c_1 x^{\sqrt{5}}+2)}$$
This seems all and well, but the expected answer contains yet another solution:
$$y = \frac{1\pm\sqrt{5}}{2x}$$
How does this second solution arise? Since there is an $x^2$ in the question, I think that a solution might have been dropped at some point.

Because of the division that must be different from zero as GSofer pointed in his good answer but you can also deduce that solution by other methods:
$$y' + y^2 = \frac{1}{x^2}$$
By inspection $y_p=\frac  A x$
$$-\frac A {x^2}+\frac {A^2}{x^2}=\frac 1 {x^2}$$
$$ \implies A^2-A-1=0$$
$$\implies A=\frac 12 \pm\frac {\sqrt 5}{2} \implies y =\frac {1\pm \sqrt 5}{2x}$$
