Example 2. Find the general solution of the equation $y^{\prime \prime}+y^{\prime}=x^{2}+2 x$. Also, specify a particular solution that satisfies the initial conditions $x=0, \quad y=1, \quad y^{\prime}=-3$.
Solution. We have $k^{2}+k=0, k_{1}=0, k_{2}=-1, y_{00}=C_{1}+C_{2} e^{-x}$. The right-hand side has the form $P_{n}(x) e^{x}=\left(x^{2}+2 x\right) e^{0 x}$, i.e., $n=2, \lambda=0=k_{1}$ - a single root of the characteristic equation. According to point 2) of theorem 3:

0: $y_{4}=x\left(A x^{2}+B x+C\right)=A x^{3}+B x^{2}+C x$,

1: $y_{ч}^{\prime}=3 A x^{2}+2 B x+C$

1: $y_{4}^{\prime \prime}=6 A x+2 B$.

Comparing the coefficients of the same powers of $x$ on the right and left sides of the equation leads to a system of equations (formally we have 4 equations and 3 unknowns, but the system is always solvable, as one of the equations is trivial):

$x^{3}: 0=0$ (trivial equation);

$x^{2}: 3 A=1, \quad A=\frac{1}{3}$

$x^{1}: 2 B+6 A=2, \quad B=1-3 A=0$

$x^{0}: C+2 B=0, \quad C=-2 B=0$.

We obtained $y_{\text {он }}=C_{1}+C_{2} e^{-x}+\frac{x^{3}}{3}$. Differentiating: $y_{\text {он }}^{\prime}=-$ $-C_{2} e^{-x}+x^{2}$. The initial conditions lead to a new system of equations for the unknown constants: $1=C_{1}+C_{2},-C_{2}=-3 \Rightarrow C_{2}=3$, $C_{1}=-2$.

Answer. $y_{\text {он }}=C_{1}+C_{2} e^{-x}+\frac{x^{3}}{3} ; \quad y_{4}=-2+3 e^{-x}+\frac{x^{3}}{3}$.