Example 6. Solve the equation $x^{2} y y^{\prime \prime}=\left(y-x y^{\prime}\right)^{2}$.
Solution. The given equation is homogeneous with respect to $y, y^{\prime}, y^{\prime \prime}$. The order of this equation can be reduced by one using the substitution $y=e^{\int z d x}$, where $z$ is a new unknown function of $x$. We have

$$
y^{\prime}=z e^{\int z d x}, \quad y^{\prime \prime}=\left(z^{\prime}+z^{2}\right) e^{\int z d x}
$$

Substituting the expressions for $y, y^{\prime}, y^{\prime \prime}$ into the equation, we get

$$
x^{2}\left(z^{\prime}+z^{2}\right) e^{2 \int z d x}=\left(e^{\int z d x}-x z e^{\int z d x}\right)^{2}
$$

Dividing by $e^{2 \int z d x}$:

$$
x^{2}\left(z^{\prime}+z^{2}\right)=(1-x z)^{2}, \quad \text { or } \quad x^{2} z^{\prime}+2 x z=1
$$

This is a linear equation. The left side can be written as $\left(x^{2} z\right)^{\prime}=1$, from which

$$
x^{2} z=x+C_{1} \quad \text { or } \quad z=\frac{1}{x}+\frac{C_{1}}{x^{2}}
$$

We find the integral:

$$
\int z d x=\int\left(\frac{1}{x}+\frac{C_{1}}{x^{2}}\right) d x=\ln |x|-\frac{C_{1}}{x}+\ln C_{2}
$$

The general solution of the given equation is

$$
y=e^{\int z d x}=e^{\ln |x|-C_{1} / x+\ln C_{2}}, \quad \text { or } \quad y=C_{2} x e^{-C_{1} / x}
$$

In addition, the equation has the obvious solution $y=0$, which is obtained from the general solution when $C_{2}=0$.