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.
 A: I want to start from scratch: $(e^xy')'  =-ax + ae^x -a $. From this you can integrate both sides, and integrate again to get a general solution. Then compare with the homogeneous solution to find out the form of the particular solution. 
A: $y''+y'=0$ has solution $c_1+c_2e^{-x}$ and this is the solution to the homogeneous case. 
Now to a particular solution. Note that neither $y=Ke^{-x}$  nor $y=K$ will work, $K$ constant (why?).
So, you might try an obvious particular solution, with constants $A,B$ 
$y_p=Ax+Bxe^{-x}$, but you won't get anywhere.
So the next choice would be 
$y_p=Ax+Bxe^{-x}+Cx^2e^{-x};\ A,B,C$ constants.
Now substitute and solve for $A,B,C$.
Remark: If you know something about operators/annihilators, these problems are relatively easy. Or you could use variation of parameters. 
A: 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".
