Solve the differential equation $y'' + y' + a(x e^{-x} - 1 + e^{-x}) = 0$ I am a bit stuck on the particular solution for this system. According to Wolfram, the general solution is 
$$\frac{1}{2} a e^{-x} x^2 + 2 a x e^{-x} + \frac 12 x + \frac 12 c_1 e^{-x} + c_2$$
The last two terms are from the homogenous solution, but I do not know how to come up with the guess for the particular solution.

Observe that $xe^{-x}+e^{-x}-1$ is sum of "product of polynomial and exponential"  and polynomial. Intiutively, we can suppose that some particular solutions is also "product of polynomial and exponential" and polynomial. Let $y=p(x)e^{-x}+ \alpha x^2+\beta x+\gamma$, where $p(x)$ is a polynomial. Then
\begin{align}
y''+y'&=p''(x)e^{-x}-p'(x)e^{-x}-p'(x)e^{-x}+p(x)e^{-x}+p'(x)e^{-x}-p(x)e^{-x}+2\alpha x+2\alpha+\beta\\
&=(p''(x)-p'(x))e^{-x}+2\alpha x+2\alpha+\beta
\end{align}
and we can get $p''(x)-p'(x)=-a(x+1)$ and $\alpha=0,\beta=a$. After some calculation, $p(x)=\frac{1}{2}ax^2+2ax$ fits the differential equation. Therefore,
$$
p(x)e^{-x}+ \alpha x^2+\beta x+\gamma =(\frac{1}{2}ax^2+2ax)e^{-x} +ax +\gamma
$$
is a particular solution. here $\gamma$ is "free".
