Example 5. Solve the equation $y^{\prime \prime}+\left(y^{\prime}\right)^{2}=2 e^{-y}$.
Solution. The equation does not contain the independent variable $x$. Setting $y^{\prime}=p, y^{\prime \prime}=p \frac{d p}{d y}$, we obtain the Bernoulli equation

$$
p \frac{d p}{d y}+p^{2}=2 e^{-y}
$$

By the substitution $p^{2}=z$ it reduces to the linear equation

$$
\frac{d z}{d y}+2 z=4 e^{-y}
$$

the general solution of which is $z=4 e^{-y}+C_{1} e^{-2 y}$. Replacing $z$ with $p^{2}=\left(y^{\prime}\right)^{2}$, we get

$$
\frac{d y}{d x}= \pm \sqrt{4 e^{-y}+C_{1} e^{-2 y}}
$$

Separating variables and integrating, we have

$$
x+C_{2}= \pm \frac{1}{2} \sqrt{4 e^{y}+C_{1}}
$$

from which

$$
e^{y}+\tilde{C}_{1}=\left(x+C_{2}\right)^{2}
$$

where $\tilde{C}_{1}=\frac{C_{1}}{4}$

This is the general integral of the given equation.