# Integration by parts, where am I going wrong?

1. Feb 17, 2012

### Kaldanis

1. The problem statement, all variables and given/known data

$\int_{1}^{2} x^2 e^{x} dx$

2. Relevant equations

Integrating by parts. Writing out chain rule, integrating both sides and rearranging gives ∫f(x)g'(x) dx = f(x)g(x) - ∫f'(x)g(x) dx

3. The attempt at a solution

$\int_{1}^{2} x^2 e^{x} dx = \left[x^2 e^x\right]_{1}^{2} - \int_{1}^{2} 2x e^{x} dx$

Applying again gives:

$\int_{1}^{2} x^2 e^{x} dx = \left[x^2 e^x\right]_{1}^{2} - \left(\left[2x e^x\right]_{1}^{2} - \int_{1}^{2} 2 e^{x} dx\right)$

Integrating last term gives:

$\int_{1}^{2} x^2 e^{x} dx = \left[x^2 e^x\right]_{1}^{2} - \left(\left[2x e^x\right]_{1}^{2} - \left[2e^x\right]_{1}^{2}\right)$

When I simplify this I get -2e2 + 3e, however I know the answer should be 2e2-e.

Can someone please point out where my mistake is?

2. Feb 17, 2012

### vela

Staff Emeritus
You got the calculus part right. You just didn't simplify it correctly, but we can't tell you where since you didn't show us that part of your work.

3. Feb 17, 2012

### Kaldanis

Ah yeah, I was getting frustrated with trying to write it out in latex! But thanks for letting me know I've at least got all that part right, I'll try again a few more times and then write it out here if I can't get it

4. Feb 17, 2012

### Staff: Mentor

you didnt show you last step so I think you made a sign error there.

(4ee - e) - ( 4ee - 2e - (2ee - 2e) ) ==> 4ee - e - 4ee + 2e + 2ee - 2e ==> 2ee - e

5. Feb 17, 2012

### Kaldanis

Thank you :D I got it. I screwed up a + and - my first 50 times of trying to solve this.

(22e2-12e) - ( (2*2e2 - 2e) - (2e2 - 2e) )
= (4e2 - e) - ( (4e2 - 2e) - (2e2 - 2e) )
= (4e2 - e) - ( 4e2 - 2e -2e2 + 2e )
= 4e2 - e - 4e2 + 2e + 2e2 - 2e
= 2e2 - e