Skip to main content
Search IntMath
Close

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:

\int{(x^2+4)}\,dx=\frac{x^3}{3}+4x+C

\int{\sin{x}}\,dx=-\cos{x}+C

Integrals of products

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

Example 1

\int{{x}\,\sin{x}}\,dx

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:

\int{u\,dv}=uv-\int{v\,du}

\int{x}\,\sin{x}\,dx=(x)(-\cos{x})-\int-\cos{x}\,dx

Tidying this up gives:

\int{x}\,\sin{x}\,dx=-x\,\cos{x}+\int\cos{x}\,dx

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

\int{x}\,\sin{x}\,dx=-x\,\cos{x}+\sin{x}+C

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:

\int{x^2e^x}dx

In this example we choose u = x2, since this will reduce to a simpler expression on differentiation (and it is higher on the LIATE list), where ex will not.

u = x2 dv = exdx
du = 2x dx v = ex

Now for integration by parts:

\int{u\,dv}=uv-\int{v\,du}

\int{x^2e^x}dx={x^2}e^x-\int{e^x}(2x)\,dx

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

\int{x^2e^x}dx={x^2}e^x-2\int{x}\,{e^x}\,dx\;\;\;[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 = ex dx
du = dx v = ex

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 \int{{x}\,e^x}dx:

\int{u\,dv}=uv-\int{v\,du}

\int{{x}\,e^x}dx={x}\,e^x-\int{e^x}dx

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

\int{{x}\,e^x}dx={x}\,e^x-e^x+C\;\;\;[2]

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

\int{x^2e^x}dx

This was our answer to the first integration by parts:

\int{x^2e^x}dx={x^2}e^x-2\int{x}\,{e^x}\,dx\;\;\;[1]

Substituting answer [2] this into equation gives us:

\int{x^2e^x}dx={x^2}e^x-2(x\,e^x-e^x)+C

Tidying this up, we obtain the final answer:

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

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:

\int e^x\sin{x}\,dx

In this example, it is not so clear what we should choose for "u", since differentiating ex does not give us a simpler expression, and neither does differentiating sin x. We choose the "simplest" possiblity, as follows (even though ex is below trigonometric functions in the LIATE table):

u = ex dv = sin x dx
du = ex dx v = −cos x

Apply the integration by parts formula:

\int{u\,dv}=uv-\int{v\,du}

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

\int{e^x\sin{x}\,}dx=-e^x\cos{x}+\int{e^x\cos{x}\,}dx

Now, for that final integral:

\int{e^x\cos{x}\,}dx

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

u = ex dv = cos x dx
du = ex dx v = sin x

Applying integration by parts for the second time:

\int{u\,dv}=uv-\int{v\,du}

We obtain equation [4]:

\int{e^x\cos{x}\,}dx=e^x\sin{x}-\int{e^x\sin{x}\,}dx

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].

\int e^x\sin{x}\,dx

=-e^x\cos{x}+\int e^x\cos{x}\, dx

=-e^x\cos{x}+\left[e^x\sin{x}-\int e^x\sin{x}\,dx\right]

Removing the brackets:

\int e^x\sin{x}\,dx=-e^x\cos{x}+e^x\sin{x}-\int e^x\sin{x}\,{dx}\ \ [2]

Now, this equation is in the following form:

p = −q + r − p

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

2p = −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 \int{e^x\cos{x}\,}dx to both sides:

2\int e^x\sin{x}\,dx=-e^x\cos{x}+e^x\sin{x}+K

Dividing both sides by 2 gives:

\int e^x\sin{x}\,dx=\frac{e^x(\sin{x}-\cos{x})}{2}+C

So we have solved equation [5] for \int e^x\sin{x}\,dx, 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.

Leave a comment




Comment Preview

HTML: You can use simple tags like <b>, <a href="...">, etc.

To enter math, you can can either:

  1. Use simple calculator-like input in the following format (surround your math in backticks, or qq on tablet or phone):
    `a^2 = sqrt(b^2 + c^2)`
    (See more on ASCIIMath syntax); or
  2. Use simple LaTeX in the following format. Surround your math with \( and \).
    \( \int g dx = \sqrt{\frac{a}{b}} \)
    (This is standard simple LaTeX.)

NOTE: You can mix both types of math entry in your comment.

top

Tips, tricks, lessons, and tutoring to help reduce test anxiety and move to the top of the class.