# Integration by parts twice

By Murray Bourne, 11 Nov 2010

When we first learn how to integrate, the examples we see involve simple polynomials, or single functions like these:

## Integrals of products

What if we need to find the integral of a product of 2 functions, like the following example?

**Example 1 **

This is where we need the important and useful technique in calculus known as ** integration by parts**. (You can see a full explanation starting from basic principles and with more examples here: Integration by parts).

To find this integral, we choose "*u*" such that its derivative is simpler than *u*. In this case, we will choose *u = x* and proceed as follows:

u = x |
dv = sin x dx |

du = dx |
v = −cos x |

We apply the integration by parts formula and find the integral:

Tidying this up gives:

Now, that last integral is easy and we can write our final answer:

**Note 1: **The constant of integration (*C*) appears after we do the final integration.

**Note 2: **Choosing *u* and *dv* can cause some stress, but if you follow the LIATE rule, it is easier. For *u*, choose whatever comes highest in the folloentrwing list, and choose *dv* as the lowest in this list.

L - logarithm functions

I - Inverse trigonometric functions

A - Algebraic functions (simple polynomial terms)

T - trigonometric functions

E - Exponential functions

## Integration by parts - twice

Now, let's see a case that is double-barreled. That is, we don't get the answer with one round of integration by parts, rather we need to perform integration by parts two times.

**Example 2:**

In this example we choose *u = x*^{2}, since this will reduce to a simpler expression on differentiation (and it is higher on the LIATE list), where *e ^{x}* will not.

u = x^{2} |
dv = e^{x}dx |

du = 2x dx |
v = e^{x} |

Now for integration by parts:

We re-arrange this to give the following, which I call equation [1]:

This time we can't immediately do that final integral, so we need to perform integration by parts again. Choosing "*u*" so that its derivative is simpler than *u* again, we have:

u = x ^{} |
dv = e^{x} dx |

du = dx |
v = e^{x} |

**Note** that the *u* and *v* here have different values from the *u* and *v* at the beginning of Example 2. This can be a trap if you don't write things carefully!

Now we proceed using integration by parts on :

That last integral is simple, and we get the following, which I call equation [2]:

But we haven't finished the question - we must remember we are finding this integral:

This was our answer to the first integration by parts:

Substituting answer [2] this into equation gives us:

Tidying this up, we obtain the final answer:

**Notice** the place where the constant "+*C*" appears in our answer - it's after thel integration has been performed. (Some students get hung up on this step, or add the "+*C*" before it is appropriate, and some forget to add it at all!) I have used a subscript 1 on the first constant since it is not the same value as the final *C*.

## Integration by parts twice - with solving

We also come across integration by parts where we actually have to solve for the integral we are finding. Here's an example.

**Example 3: **

In this example, it is not so clear what we should choose for "*u*", since differentiating *e ^{x}* does not give us a simpler expression, and neither does differentiating sin

*x*. We choose the "simplest" possiblity, as follows (even though

*e*is below trigonometric functions in the LIATE table):

^{x}u = e^{x} |
dv = sin x dx |

du = e^{x} dx |
v = âˆ’cos x |

Apply the integration by parts formula:

We obtain the following, which I'll call equation [3]:

Now, for that final integral:

Once again, we need to decide which function to use for *u*, and settle on the one which gives simplest derivative:

u = e^{x} |
dv = cos x dx |

du = e^{x} dx |
v = sin x |

Applying integration by parts for the second time:

We obtain equation [4]:

Wait a minute - we have a final integral that is the same as what we started with! If we kept going, we would go around in circles and never finish.

So we need to perform the following "trick". We substitute our answer for the second integration by parts (equation [4]) into our first integration by parts answer (equation [3].

Removing the brackets:

Now, this equation is in the following form:

*p* = âˆ’*q* + *r* âˆ’ *p *

To solve this for *p*, we just add *p* to both sides:

2*p = âˆ’q + r *

Then divide both sides by 2:

*p * = (âˆ’*q + r*)/2

So we will do the same to our integral equation, number [5].

I add to both sides:

Dividing both sides by 2 gives:

So we have solved equation [5] for , giving us the desired result.

(Note I used a "+*K*" for the first constant that appeared. My final "*C*" has value *K*/2, but normally we only need to be concerned with the final constant.)

See the 31 Comments below.