particular solution of $y''+y'=xe^{-x}$ I'm using the method of undetermined coefficients to find a particular solution of:
$$y''+y'=xe^{-x}$$
Ostensibly, it seems that $y_p$ should take the form of $(Ax + B)e^{-x}$
At least that's the form that I think I've been taught. Problem is that it just doesn't work out for me. I get a value for A, but not for B... Am I choosing an incorrect yp form?
 A: It's often good to start with finding the solution to the homogenous solution
$$y_h'' + y_h' =0$$
which, as you know, is $y_h = c_1 + c_2e^{-x}$. Thus you don't need to have a $e^{-x}$-term when you look for the particular solution, since this is already included in the homogenous (if you include it in your particular solution, it will cancel out).
Second, if you are prone to small misstakes, you can take terms in your particular solution one by one, since differentiation is linear. Start with $Axe^{-x}$:
$$\frac{d^2}{dx^2} Axe^{-x} + \frac{d}{dx} Axe^{-x} = -Ae^{-x}$$
then $Bx^2e^{-x}$:
$$\frac{d^2}{dx^2} Bx^2e^{-x} + \frac{d}{dx} Bx^2e^{-x} = 2Be^{-x} - 2Bxe^{-x}$$
You can see that if you have $y_p = Bx^2e^{-x} + Axe^{x}$ you will get
$$y_p'' + y_p' = (2B - A)e^{-x} - 2Bxe^{-x}$$
thus $B = -\frac{1}{2}$ and $2B - A = -1 -A=0$, which gives $A = -1$, which gives you your answer.
A rule which is convenient when making these kinds of calculations is
$$\frac{d^n}{dx^n} \left( f(x) e^{ax} \right) = e^{ax} \left( \frac{d}{dx} + a \right)^n f(x)$$
where $\left(\frac{d}{dx}\right)^n$ is interpreted as $\frac{d^n}{dx^n}$.
For example, using this on $Axe^{-x}$ (writing $D$ for $\frac{d}{dx}$):
$$\begin{align}
\frac{d^2}{dx^2} Axe^{-x} + \frac{d}{dx} Axe^{-x} &= Ae^{-x}( (D-1)^2 x + (D-1) x )= Ae^{-x} (D-1)((D-1)x + x)) = \\
&= Ae^{-x} (D-1)(1) = -Ae^{-x}
\end{align}$$
You can quickly see that the term $Axe^{-x}$ is not enough.
A: As already suggested, you may look for a solution of the form 
$$
y_p (x) = (Ax^2 + Bx)e^{-x}.
$$
(You may also consider $y_p (x) = (Ax^2 + Bx + C)e^{-x}$, to find out that $C$ cancels anyway.) Then,
$$
y'_p (x) = (2Ax + B)e^{ - x}  - (Ax^2  + Bx)e^{ - x} 
$$
and
$$
y''_p (x) = 2Ae^{-x} - (2Ax + B)e^{-x} - (2Ax + B)e^{-x} + (Ax^2 + Bx)e^{-x},
$$
from which you get
$$
y''_p (x) +  y'_p (x) = e^{-x} (2A-2Ax-B-2Ax-B+Ax^2+Bx+2Ax+B-Ax^2-Bx)=e^{-x}(2A-2Ax-B).
$$
Comparing $2A-2Ax-B$ to $x$, we get $2A-B=0$ and $-2A=1$, hence $A=-1/2$ and $B=-1$.
Thus
$$
y_p (x) = ( -x^2/2 - x)e^{ - x} .
$$
(Indeed, you can verify that $y''_p (x) +  y'_p (x) = xe^{-x}$.)
A: You could use the method of Laplace transforms to find the particular solution. The Laplace transform of the right hand side $\int_0^\infty x e^{-x} e^{-x p} dx = 1/(p+1)^2$. Thus the image of the particular solution under the Laplace transform satisfies $p^2 y(p) + p y(p) = 1/(p+1)^2$. Thus $y(p)= p^{-1} (p+1)^{-3}$. The partial fraction decomposition of it is $p^{-1} - (1+p)^{-3} - (1+p)^{-2} - (1+p)^{-1}$. The first term is the Laplace transform of $1$, the second of $-x^2  e^{-x}/2$, the third of $-x e^{-x}$ and the last of $e^{-x}$. Combining you arrive at solution $y_p(x) = 1-e^{-x} \left(1+x+x^2/2\right)$. Therefore the general solution is $y(x) = c_1 + c_2 e^{-x} + y_p(x)$.
A: Just to elaborate on Qiaochu Yuan's answer.. the characteristic polynomial here is $r^2 + r = r(r + 1)$. The root $r = -1$ appears here with multiplicity $m = 1$, so you multiply your suggested solution $(Ax + B)e^{-x}$ by $x^m = x$ and try $y_p = (Ax^2 + Bx)e^{-x}$ instead.
A: If you'd rather not guess at the form, this is easily solvable, if you don't mind integration by parts.  We could integrate both sides right away, but I'll choose an easier initial integration.
$e^xy''+e^xy'=(e^xy')'=x$
$e^xy'=\frac12x^2+C$
$y=\int\frac12 x^2e^{-x}+Ce^{-x}dx=\int x^2e^{-x}dx+k_1e^{-x}+k_2$
So our particular solution is going to be $\int\frac12 x^2e^{-x}dx$, which is where integration by parts comes in.
$u=\frac12x^2,du=xdx$
$dv=e^{-x}dx,v=-e^{-x}dx$
$\int \frac12x^2e^{-x}dx=-\frac12x^2e^{-x}+\int xe^{-x}dx=-\frac12x^2e^{-x}-xe^{-x}+e^{-x}$
That $e^{-x}$ term can be combined with $k_1e^{-x}$ of the homogeneous solution yielding a new constant, leaving the particular solution as $-\frac12x^2e^{-x}-xe^{-x}$
