Theorem: Linear Second Order ODE/y'' + 2 y' + y = x exp -x

The second order ODE:
:$(1): \quad y'' + 2 y' + y = x e^{-x}$
has the general solution:
:$y = e^{-x} \paren {C_1 + C_2 x + \dfrac {x^3} 6}$

Proof:
It can be seen that $(1)$ is a nonhomogeneous linear second order ODE in the form:
:$y'' + p y' + q y = \map R x$
where:
:$p = 2$
:$q = 1$
:$\map R x = x e^{-x}$
First we establish the solution of the corresponding constant coefficient homogeneous linear second order ODE:
:$y'' + 2 y' + y = 0$
From Linear Second Order ODE: $y'' + 2 y' + y = 0$, this has the general solution:
:$y_g = \paren {C_1 + C_2 x} e^{-x}$
It remains to find a particular solution $y_p$ to $(1)$.
We have that:
:$\map R x = x e^{-x}$
and so from the Method of Undetermined Coefficients for Product of Polynomial and Exponential, we assume a solution:
{{begin-eqn}}
{{eqn | l = y_p
      | r = e^{-x} \paren {A_1 x^3 + A_2 x^2 + A_3 x + A_4}
      | c = 
}}
{{eqn | ll= \leadsto
      | l = {y_p}'
      | r = -e^{-x} \paren {A_1 x^3 + A_2 x^2 + A_3 x + A_4} + e^{-x} \paren {3 A_1 x^2 + 2 A_2 x + A_3}
      | c = 
}}
{{eqn | r = e^{-x} \paren {-A_1 x^3 + \paren {3 A_1 - A_2} x^2 + \paren {2 A_2 - A_3} x + A_3 - A_4}
      | c = 
}}
{{eqn | ll= \leadsto
      | l = {y_p}''
      | r = -e^{-x} \paren {-A_1 x^3 + \paren {3 A_1 - A_2} x^2 + \paren {2 A_2 - A_3} x + A_3 - A_4} + e^{-x} \paren {-3 A_1 x^2 + 2 \paren {3 A_1 - A_2} x + \paren {2 A_2 - A_3} }
      | c = 
}}
{{eqn | r = e^{-x} \paren {A_1 x^3 + \paren {-6 A_1 + A_2} x^2 + \paren {6 A_1 - 4 A_2 + A_3} x + 2 A_2 - 2 A_3 + A_4}
      | c = 
}}
{{end-eqn}}
Substituting in $(1)$:
{{begin-eqn}}
{{eqn | o = 
      | r = e^{-x} \paren {A_1 x^3 + \paren {-6 A_1 + A_2} x^2 + \paren {6 A_1 - 4 A_2 + A_3} x + 2 A_2 - 2 A_3 + A_4}
      | c = 
}}
{{eqn | o = 
      | ro= +
      | r = 2 e^{-x} \paren {-A_1 x^3 + \paren {3 A_1 - A_2} x^2 + \paren {2 A_2 - A_3} x + A_3 - A_4}
      | c = 
}}
{{eqn | o = 
      | ro= +
      | r = e^{-x} \paren {A_1 x^3 + A_2 x^2 + A_3 x + A_4}
      | c = 
}}
{{eqn | r = x e^{-x}
      | c = 
}}
{{eqn | ll= \leadsto
      | n = 2
      | o = 
      | r = e^{-x} \paren {A_1 x^3 + \paren {-6 A_1 + A_2} x^2 + \paren {6 A_1 - 4 A_2 + A_3} x + \paren {2 A_2 - 2 A_3 + A_4} }
      | c = 
}}
{{eqn | o = 
      | ro= +
      | r = e^{-x} \paren {-2 A_1 x^3 + \paren {6 A_1 - 2 A_2} x^2 + \paren {4 A_2 - 2 A_3} x + \paren {2 A_3 - 2 A_4} }
      | c = 
}}
{{eqn | o = 
      | ro= +
      | r = e^{-x} \paren {A_1 x^3 + A_2 x^2 + A_3 x + A_4}
      | c = 
}}
{{eqn | r = x e^{-x}
      | c = 
}}
{{end-eqn}}
Hence by equating coefficients:
{{begin-eqn}}
{{eqn | l = A_1 - 2 A_1 + A_1
      | r = 0
      | c = 
}}
{{eqn | ll= \leadsto
      | l = 0
      | r = 0
      | c = 
}}
{{eqn | l = \paren {-6 A_1 + A_2} + \paren {6 A_1 - 2 A_2} + A_2
      | r = 0
      | c = 
}}
{{eqn | ll= \leadsto
      | l = 0
      | r = 0
      | c = 
}}
{{eqn | l = \paren {6 A_1 - 4 A_2 + A_3} + \paren {4 A_2 - 2 A_3} + A_3
      | r = 1
      | c = 
}}
{{eqn | ll= \leadsto
      | l = 6 A_1
      | r = 1
      | c = 
}}
{{eqn | l = \paren {2 A_2 - 2 A_3 + A_4} + \paren {2 A_3 - 2 A_4} + A_4
      | r = 0
      | c = 
}}
{{eqn | ll= \leadsto
      | l = A_2
      | r = 0
      | c = 
}}
{{end-eqn}}
So from General Solution of Linear 2nd Order ODE from Homogeneous 2nd Order ODE and Particular Solution:
:$y = y_g + y_p = e^{-x} \paren {C_1 + C_2 x + \dfrac {x^3} 6}$
{{qed}}