Example 1. Solve the equation

$$
y^{\prime}+2 x y=2 x e^{-x^{2}}
$$
Solution. We apply the method of variation of constants. Consider the homogeneous equation

$$
y^{\prime}+2 x y=0
$$

corresponding to the given non-homogeneous equation. This is a separable equation. Its general solution is

$$
y=C e^{-x^{2}}
$$

The general solution of the non-homogeneous equation is sought in the form

$$
y=C(x) e^{-x^{2}}
$$

where $C(x)$ is an unknown function of $x$. Substituting (3) into (2), we get $C(x)=2 x$, hence $C(x)=x^{2}+C$. Therefore, the general solution of the non-homogeneous equation is

$$
y=\left(x^{2}+C\right) e^{-x^{2}}
$$

where $C$ is the constant of integration.

Remark. It may turn out that the differential equation is linear with respect to $x$ as a function of $y$. The standard form of such an equation is

$$
\frac{d x}{d y}+r(y) x=\varphi(y)
$$