Solution (source code)

= Solution

Now the <characteristic equation> is $(m+1)^2=0$, with a <repeated root>, so the <complementary function> is $(C_1+C_2x)e^{-x}$. For the polynomial forcing, substitute $ax^2+bx+c$ to obtain
$$
ax^2+(4a+b)x+(2a+2b+c)=x^2.
$$
Thus $a=1$, $b=-4$, $c=6$. For the forcing $2e^{-x}$, both $e^{-x}$ and $xe^{-x}$ already occur in the <complementary function>; the <resonant exponential particular solution> therefore starts with $Kx^2e^{-x}$. The identity
$$
\left(\frac{d^2}{dx^2}+2\frac d{dx}+1\right)(e^{-x}v)=e^{-x}v''
$$
gives $K=1$. The resulting general solution is
$$
\boxed{y=(C_1+C_2x+x^2)e^{-x}+x^2-4x+6.}
$$