Example 4. Find the general solution of the equation

$$
y^{\prime \prime}+3 y^{\prime}+2 y=2 x^{2}-4 x-17
$$
Solution. The right-hand side of the given equation is a second-degree polynomial $f(x)=P_{2}(x)=a x^{2}+b x+c$, where $a=2, b=-4, c=-17$. Since $q \neq 0$, according to formula (10.32), we seek a particular solution in the form

$$
\bar{y}=Q_{2}(x)=A x^{2}+B x+C
$$

Substituting the expressions for $\bar{y}, \bar{y}^{\prime}=2 A x+B, \bar{y}^{\prime \prime}=2 A$ into the given equation, we get

$$
2 A+3(2 A x+B)+2\left(A x^{2}+B x+C\right)=2 x^{2}-4 x-17
$$

or

$$
2 A x^{2}+(6 A+2 B) x+(2 A+3 B+2 C)=2 x^{2}-4 x-17
$$

Since $\bar{y}$ is a solution to the differential equation, the last equality must hold for all $x$, i.e., it is an identity, so the coefficients of the same powers of $x$ on both sides are equal:

$$
2 A=2,6 A+2 B=-4,2 A+3 B+2 C=-17
$$

From the resulting system of equations, we find that

$$
A=1, B=-5, C=-2
$$

therefore

$$
\bar{y}=x^{2}-5 x-2
$$

The general solution of the corresponding homogeneous equation

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

is given by the formula

$$
y_{0}=C_{1} e^{-x}+C_{2} e^{-2 x}
$$

since the characteristic equation $k^{2}+3 k+2=0$ has roots $k_{1}=-1, k_{2}=-2$. Based on formula (10.21), we obtain the general solution

$$
y=C_{1} e^{-x}+C_{2} e^{-2 x}+x^{2}-5 x-2
$$

of the original equation.