# Homework Help: Integration - Indefinite - By Parts and U-Sub

1. Mar 24, 2014

1. The problem statement, all variables and given/known data
Integrate the following indefinite integrals

A:$\int e^x (x^2+1) dx$

B:$\int e^x cos(3x+2) dx$

2. Relevant equations
$\int u dv = uv - \int v du$

3. The attempt at a solution
Part A: I have done the following but when I use an integration calculator online its not what I have (although I suppose theres a few ways of doing it)

$$let \, u=x^2 +1 \,\, ∴ \, du=2x \\ let \, dv=e^x \,\, ∴ \, v=e^x \\ \\ ∴e^x(x^2+1)-\int e^x 2x \, dx \\$$
Then doing another by parts on that integral
$$let \, u=2x \,\, ∴ \, du=2 \\ let \, dv=e^x \,\, ∴ \, v=e^x \\ \\ 2xe^x-2\int e^x \, dx = 2xe^x-2e^x + C$$
Then plugging that into the first bit I get
$$e^x(x^2+1)-2xe^x-2e^x + C$$

For Part B:
I am really confused as it doesnt look like a u-sub problem and no matter which way around I set the variables to do a by parts problem, the resulting integral is no easier to solve than the original so any hints on where to start with that one would be much appreciated.

Thanks :)

Last edited: Mar 24, 2014
2. Mar 24, 2014

### PeroK

For part a), you've been a bit sloppy: omitted the dx on the integral, omitted the constant of integration and made a simple mistake on the second parts. I'd try again and be more careful.

For part b): maybe things will work out if you just keep going.

3. Mar 24, 2014

I can assure you that whilst I did my problem on paper, and in doing so did not forget the dx's and constant, when I came to type it into here using latex it was something I forgot to add yes sorry. I have now corrected the sloppyness, I am very new to integration by parts and well integration as a whole really. I would appreciate it if you could let me know where my error is on the second bit as I have gone through it several times and I might be blind to it by now. Thanks :)

4. Mar 24, 2014

### PeroK

5. Mar 24, 2014

### HallsofIvy

You have a sign error here. (-)(-)= +.

Yes, use integration by parts.
To start, let $u= e^x[itex], [itex]dv= sin(3x+ 2)dx$ so that $du= e^xdx$ and $v= -(1/3)cos(3x+ 2)$.
$$\int e^xsin(3x+ 2)dx= -(1/3)e^xcos(3x+2)+ (1/3)\int e^x cos(3x+ 2) dx$$

Now do pretty much the same thing: let $u= e^x$, $dv= cos(3x+ 2)dx$ so that $du= e^xdx$ and $v= (1/3)sin(3x+ 2)$. That gives
$$\int e^x sin(3x+ 2)dx= -(1/3)e^x cos(3x+2)+ (1/3)[(1/3)e^xsin(3x+2)- (1/3)\int e^x sin(3x+ 2)dx$$
$$\int e^x sin(3x+ 2)dx= -(1/3)e^x cos(3x+2)+ (1/9)e^xsin(3x+2)- (1/9)\int e^x sin(3x+ 2)dx$$

Now, don't try to integrate that last integral on the right- it is the same as on the left. Just add $(1/9)\int e^x sin(3x+ 2)dx$ to both sides and divide by 2.

6. Mar 24, 2014

Ah right, yeah now after checking one of the integration calculators I can see that there should be a +2e^x term in it whereas I have a -2e^x term but still going through my calculation step by step I cant see how it becomes positive. Im sure there must be a negative times a negative somewhere but I cannot see it. It may be something to do with my understanding on how you do integration by parts when you have to do it twice by parts.

7. Mar 24, 2014

### jaytech

For part 2, my personal preference is to substitute for everything in the cos() term. So for me I'd just say 3x+2 = s and then you have 3dx = ds and the ex becomes e(s-2)/3. Then when I have a solution as a function of s I plug 3x+2 back in. I just think that doing the by parts with multiple variables in the exponent is easier. Just my preference.

8. Mar 24, 2014

### PeroK

Your mistake is nothing to do with parts, it's to do with -(-2) = 2:

$$e^x(x^2+1)-(2xe^x-2e^x) + C = e^x(x^2+1)-2xe^x+2e^x + C$$

9. Mar 24, 2014

Ah right yeah I can see it now. Sounds stupid but I couldn't see it as when I scan it and visualized it in my head, I was visualizing the end result with the parentheses around it like (2xe^x-2e^x) and therefore couldnt see as my answer is correct if I had the parentheses around that bit.I can see now though (thanks to you :) ) that that means without them I have to flip the signs.

Thanks :) I am off to bed for the night and have the next two days to go through part B. Thanks.