# Integration by parts: $\int xe^{-x}dx$

This is a pretty straight forward integral to me, but I don't understand how my teacher got the answer:

$$(-xe^{-x})-e^{-x}+C$$

Here is the original problem:

$$\int xe^{-x}dx$$

Here are my steps to solve it:

$$u=x$$ $$du=dx$$ $$dv=e^{-x}dx$$ $$v=-e^{-x}$$

So rewriting the problem I get:

$$(-xe^{-x})- \int -e^{-x}dx$$

Solving the above integral I get (I factored out the negative one to get a positive $e^{-x}$):

$$(-xe^{-x})+e^{-x}+C$$

Did I solve this incorrectly?

## 3 Answers

Integrating $e^{-x}$ gives $-e^{-x}$. You're missing a minus sign at the final step.

• Gosh all the back and forth in calculus 2 sometimes confuses me! Thank you. – hax0r_n_code Oct 14 '13 at 19:35

$$\int xe^{-x}dx$$

$\displaystyle u=x\Rightarrow du=dx, dv=e^{-x}dx\Rightarrow v=-e^{-x}$. So rewriting the problem we get:

$$\int xe^{-x}dx=(-xe^{-x})+ \int e^{-x}dx=(-xe^{-x})-e^{-x}+C$$

maxima confirms the solution of your teacher

(%i1) diff((-x*exp(-x))-exp(-x)+C,x);
- x
(%o1)                               x %e


Your first step is ok.

(%i2) diff((-x*exp(-x))-integrate(-exp(-x),x),x);
- x
(%o2)                               x %e


Your final result is wrong

(%i3) diff((-x*exp(-x))+exp(-x)+C,x);
- x       - x
(%o3)                          x %e    - 2 %e