7.2 Integration by Parts: 7.2.1 The Idea by An Example
7.2 Integration by Parts: 7.2.1 The Idea by An Example
However, a clever student might notice that x sec2 x contains terms that could have arisen from
a product rule derivative computation:
d d tan x dx
[x tan x] = x · + tan x ·
dx dx dx
2
= x sec x + tan x.
d
x sec2 x = [x tan x] − tan x.
dx
In fact the line immediately above is perhaps where the spirit of the method is most on display:
that the given function is indeed one part of a product rule derivative. If we are fortunate, the
other part of the product rule formula is easier to integrate, because the derivative term, namely
d
dx [x tan x] is trivial to integrate, since we are just asking for the antiderivative of the derivative of
a (differentiable) function, which ultimately returns the function itself, and an additive constant
we can absorb in the second integral. Indeed, if we take antiderivatives of both sides, we then
get
Z Z
d[x tan x]
x sec2 x dx = − tan x dx
dx
Z
= x tan x − tan x dx
= x tan x − ln | sec x| + C.
From such as the above emerges a method whereby we identify our given function (here x sec2 x)
d
as a part of a product rule computation ( dx [x tan x]), and integrate our original function by
d
instead (trivially) integrating the product rule derivative term (again dx [x tan x]), and then
integrating the other part (tan x) of the product rule output. Often the other, hidden part of the
underlying product rule is easier to integrate than the original function, and therein lies much
of the success of the method.
708 CHAPTER 7. ADVANCED INTEGRATION TECHNIQUES
Next we notice that the first integral on the right hand side of (7.11) is simply uv, and so we
arrive at our final working formula for our integration by parts technique:
Z Z
u dv = uv − v du. (7.12)
Most textbooks and instructors use the formula above in exactly that form. It is best memorized,
though its derivation—particuarly from (7.10)—should not be forgotten.
Next we look at an example of the actual application of (7.12). In the example below, the
arrangement of terms is as one would work the problem with pencil and paper, except for the
implication arrows and the underbraces (which we explain briefly below, and exclude from then
on).
Z
Example 7.2.1 Compute xex dx.
Solution:
u=x dv = ex dx
⇓ ⇑
du = dx v = ex
Z Z Z
x e| {zdx} = uv − v du = (x)(e ) − (ex ) dx = xex − ex + C.
|{z}
x x
u dv
7.2. INTEGRATION BY PARTS 709
It is interesting to note that we choose u and dv, and then compute du and v, with one qualifi-
cation. That is that v is not unique; the computation from dv to v is of an antidifferentiation
nature and so we really only know v up to an additive constant. In fact any v so that dv = ex dx
(we took v = ex =⇒ dv = ex dx) will work in (7.12). Any additive constant, while legitimate,
will eventually cancel in the final computation. For instance, if we had chosen v = ex + 100, we
would have had
Z Z
uv − v du = x(ex + 100) − (ex + 100) dx
as before. For most cases, we will just assume that the additive constant is zero and we will use
the simplest antiderivative for v. (We will not continue to write the implication arrows as they
are technical and perhaps confusing.)
Now we will revisit the example we gave in Subsection 7.2.1, using what will be our basic
style for this method.
Z
Example 7.2.2 Compute x sec2 x dx.
Solution:
u=x dv = sec2 x dx
du = dx v = tan x
Z Z Z Z
x sec2 x dx = u dv = uv − v du = x tan x − tan x dx = x tan x − ln | sec x| + C.
Since this method is more complicated than substitution, there are more complicated consider-
ations in how to apply it. First of course, one should attempt an earlier, simpler method. But
if those fail, and integration by parts is to be attempted,5 the following guidelines for choosing
u and dv should be considered:
1. u and dv must account for exactly all factors of the integral.
1.5. Of course, dv must contain the differential term (for example, dx) as a factor, but
can contain more terms.
R
2. v = dv should be computable with relative ease.
3. du = u′ (x) dx (assuming the original integral was in x) should not be overly complicated.
R R
4. The integral v du should be simpler than the original integral u dv.6
The next example illustrates the importance of the second consideration (numbered 2.) above.
5 Of course with practice one can see ahead whether or not integration by parts is likely to achieve an answer
u = x2 dv = x sin x2 dx
1
du = 2x dx v = − cos x2
2
Z Z
x3 sin x2 dx = x2 · x
|{z} x2 dx}
| sin{z
u dv
Z
= uv − v du
Z
1 1
= (x2 ) − cos x2 − − cos x2 2x dx
2 2
2 Z
x 1
= − cos x2 + cos x2 · x dx
2 2
x2 1
= − cos x2 + sin x2 + C.
2 2
We omitted the details of computing v from dv, and computing the last integral, as most students
at this point can anticipate the approximate forms of those antiderivatives, mentally compute
the derivatives of the approximate forms, and then insert constant factors required to make the
antiderivatives correct. (This was the purpose of the last section.)
R
This last example shows how the requirement that v = dv (up to an additive constant) be
computable helps to guide us to the proper choice of u and dv. It was lucky that the second
integral
R was easily computable
R (which would not have been the case if the original integral were,
say, x2 sin x2 dx or x4 sin x2 dx), but anyhow we cannot even get to the second integral if we
cannot compute v.
The next example shows a different lesson: that it is sometimes appropriate to integrate by
parts more than once in a given problem.
Z
Example 7.2.4 Compute x2 cos 3x dx.
Solution: For reasons that will be clear later, we will call this integral (I). Now we proceed
to the integration by parts.
u = x2 dv = cos 3x dx
1
du = 2x dx v = sin 3x
3
7 In fact, we cannot compute sin x2 dx using any kind of substitution or parts, or any other method of this
R
text for that matter, and arrive at an antiderivative in simple terms of the functions we know so far such as
powers, exponentials, logarithms, trigonometric or hyperbolic functions or their inverses. However, when we
study series we will find other expressions with which we can fashion an antiderivative of sin x2 .
7.2. INTEGRATION BY PARTS 711
Z Z Z
1 2 2
(I) = x2 cos 3x dx} = uv − v du = x sin 3x − x sin 3x dx.
|{z} | {z 3 3
u dv
While we still cannot compute this last integral directly with old methods, it is better than the
original in the sense that our trigonometric function is multiplied by a first-degree polynomial,
where in the original the polynomial was second degree. The work which is left more closely
resembles our earliest examples of integration by parts.
A strict use of the language would force us to introduce two new variables other than u and
v,Rbut since they have “disappeared” in the present form of our answer, namely 31 x2 sin 3x −
2
3 x sin 3x dx, it is not considered such bad form to “reset”
R (or “recycle”) u and v for another
integration by parts step, this time involving the integral x sin 3x dx:
u=x dv = sin 3x dx
1
du = dx v = − cos 3x
3
Z Z Z
x 1 x 1 1
x sin 3x dx = uv − v du = − cos 3x + cos 3x dx = − cos 3x + · sin 3x + C1 .
|{z} | {z } 3 3 3 3 3
u dv
Several lessons can be gleaned from the example above. (1) it is very important for proper
“bookkeeping,” as these problems can beget several “subproblems,” and the proper placement of
resulting terms is crucial to getting the correct answer; (2) it is not unknown to use integration
by parts more than once in a problem; (3) if we can take as many antiderivatives of a function
f (x) as we Rlike (i.e., the antiderivative, the antiderivative of the antiderivative, etc.), then for
an integral xn f (x) dx we can let u = xn , and integration by parts will yield a second integral
with a reduction in the power of x, namely
Z Z
xn f (x) dx = xn F (x) − nxn−1 F (x) dx (7.13)
where F ′ = f .
Other cases concern choices of u where we choose a function whose derivative we know, but
whose antiderivative might not be standard knowledge for the average student.
Z
Example 7.2.5 Compute (x2 + 1) ln x dx.
Solution: We cannot let dv = ln x dx, since as yet we do not know the antiderivative of ln x.
(Even if we did, such a choice for dv would not be advantageous, as Example 7.2.6 helps to
show.) So we have little choice but to let ln x be u.
u = ln x dv = (x2 + 1) dx
1 x3
du = dx v= +x
x 3
712 CHAPTER 7. ADVANCED INTEGRATION TECHNIQUES
Z Z
(x2 + 1) ln x dx = uv − v du
Z 3
x3 x 1
= (ln x) +x − +x dx
3 3 x
Z 2
1 x
= (ln x)(x3 + 3x) − + 1 dx
3 3
1 1 1
= (x3 + 3x) ln x − x3 − x + C.
3 9 3
= x ln x − x + C.
In fact the same type of computation will be used for finding antiderivatives of arctrigonometric
functions.
Z
Example 7.2.7 Compute sin−1 x dx.
Solution: Again we have no choice but to let u = sin−1 x, dv = dx.
u = sin−1 x dv = dx
1
du = √ dx v=x
1 − x2
R
For brevity, we will begin to label the desired integral (I), so here (I) = sin−1 x dx. (The
second interval is computed “by inspection.”)
Z Z
x
(I) = uv − v du = x sin−1 x − √ dx
1 − x2
1/2
= x sin−1 x + 1 − x2 + C.
7.2. INTEGRATION BY PARTS 713
u = e2x dv = cos 3x dx
1
du = 2e2x dx v = sin 3x
3
So far, after some rearrangement and simplifying, we have
Z
(I) = uv − v du
Z
1 2
= e2x sin 3x − e2x sin 3x dx . (7.14)
3 3
| {z }
(II)
This does not seem any easier than the first integral, so perhaps we might continue, but this
time let the trigonometric function be u and the exponential (along with dx) be contained
in dv.
R
Step 2. Compute (II) = e2x sin 3x dx in light of the comments at the end of the first step.
u = sin 3x dv = e2x dx
1
du = 3 cos 3x dx v = e2x
2
Z Z
1 3
(II) = uv − v du = e2x sin 3x − e2x cos 3x dx.
2 2
Combining this with the conclusion (7.14) of Step 1 gives us:
Z
1 2x 2 1 2x 3 2x
(I) = e sin 3x − e sin 3x − e cos 3x dx
3 3 2 2
Z
1 1
= e2x sin 3x − e2x sin 3x + e2x cos 3x dx
3 3
Z
= e2x cos 3x dx.
Unfortunately that puts us right back where we started. However, a minor change in our effort
above will eventually lead us to the solution. While keeping Step 1, our next step towards a
solution is to replace Step 2 by the same strategy as used in Step 1, namely that we use the
exponential function for u and the trigonometric with dv.
714 CHAPTER 7. ADVANCED INTEGRATION TECHNIQUES
R
Step 2—Second Attempt Again we compute (II) = e2x sin 3x dx:
u = e2x dv = sin 3x dx
1
du = 2e2x dx v = − cos 3x
3
Z
(II) = uv − v du
Z
1 2
= − e2x cos 3x + e2x cos 3x dx. (7.15)
3 3
It may seem that (7.15) is also a dead end, since it contains the original integral. But this
attempt is different. In fact, when we combine (7.15) with (7.14) we get
1 2x 2
(I) = e sin 3x − (II)
3 3 Z
1 2 1 2
= e2x sin 3x − − e2x cos 3x + e2x cos 3x dx
3 3 3 3
Z
1 2 2x 4
= e2x sin 3x + e cos 3x − e2x cos 3x dx,
3 9 9
| {z }
(I)
1 2x 2 4
(I) = e sin 3x + e2x cos 3x − (I). (7.16)
3 9 9
Now we are ready to derive (I), not by another calculus computation, but in fact by simple
algebra.
Step 3. Solve (7.16) for (I). First we add 49 (I) to both sides.
13 1 2
(I) = e2x sin 3x + e2x cos 3x + C1 .
9 3 9
Here we add C1 because in fact each (I) in (7.16) represents all antiderivatives which of
course differ from eachother by additive constants. Now (7.16) makes sense because of the
fact that there are additive constants on both sides of that equation (though on the right
side they are mulitplied by − 49 , but that still yields additive constants).8 Solving for (I)
we now have
9 1 2x 2
(I) = e sin 3x + e2x cos 3x + C1
13 3 9
3 2x 2 2x
= e sin 3x + e cos 3x + C, (7.17)
13 13
9
where C = 13 C1 .
8 In fact, two simlutaneous appearances of (I) do not have to have the same additive constants, so (I)−(I) =
C2 , not zero.
7.2. INTEGRATION BY PARTS 715
What is important to understand about the example above is that sometimes, though we
cannot perhaps directly compute a particular integral, it may happen that an indirect method
gives us the answer. Here we found an equation, namely (7.16), which our desired integral
satisfies, and for which it could be solved algebraically. We must be open to the possibility of
finding a desired quantity by indirect methods, as well as direct computations.
It should be pointed out that we could have computed the integral in Example 7.2.8 by
instead letting u be the trigonometric function, and dv = e2x dx in both steps. In fact it is
usually best to pick similar choices for uR and dv when an integration by parts will take more
than one step. (Recall the discussion for xn f (x) dx.)
The method of Example 7.2.8, namely solving for (I) after an integration by parts step, is
available perhaps more often than one would think.
Z
Example 7.2.9 Compute sin2 x dx = (I).
Solution:
u = sin x dv = sin x dx
du = cos x dx v = − cos x
Z Z Z
(I) = uv − v du = − sin x cos x + cos2 x dx.
We could perform the same integration by parts with the second integral, but instead we will
use the fact that cos2 x = 1 − sin2 x:
Z
(I) = − sin x cos x + (1 − sin2 x) dx
Z
= − sin x cos x + x − sin2 x dx
The example above can be computed directly if we use the trigonometric fact that sin2 x =
1
2 (1− cos 2x), giving
Z Z
2 1
sin x dx = (1 − cos 2x) dx
2
1 1
= x − sin 2x + C
2 4
1 1
= x − · 2 sin x cos x + C,
2 4
which is the same as before. For the last step we used the (double-angle) trigonometric identity
sin 2x = 2 sin x cos x. In Section 7.3 we will opt for this alternative method, and indeed will
make quite an effort to exploit the algebraic properties of the trignometric functions wherever
possible, but some integrals there will also require integration by parts.
9 The intermediate step would be 2(I) = x − sin x cos x + C . See the discussion for Example 7.2.8, page 714.
1
In fact many textbooks do not bother writing the C1 term, preferring to remind the student at the end that
an indefinite integral problem necessitates a “+C.”
716 CHAPTER 7. ADVANCED INTEGRATION TECHNIQUES
Z π
Example 7.2.10 Compute x sin x dx.
−π
Solution: (Note how the negative signs cancel in the parts formula step.)
u=x dv = sin x dx
du = dx v = − cos x
Z π Z π
π
x sin x dx = (−x cos x)−π + cos x dx
−π −π
π
= [−π cos π] − [−(−π) cos(−π)] + sin x
−π
= (−π)(−1) − (π)(−1) + sin π − sin(−π)
=π+π+0−0
= 2π.
Rπ
In the example above, We could also have noticed that −π cos x dx is zero because we are
integrating over a whole period [−π, π] of cos x, and both sin x and cos x have definite integral
zero over any full period.
b
It is typical to compute that part u(x)v(x)z separately, but one could instead and separately
compute the entire antiderivative, and then evaluate at the two limits and take the difference:
Z π π
x sin x dx = (−x cos x + sin x) .
−π −π
Which method to use is a matter of bookkeeping preferences, and perhaps whether or not part
of the right-hand side of (7.18) is particularly simple.
The next example gives us several options along the way, though in each the original choices
of u and dv are the same.
Z
Example 7.2.11 Compute x tan−1 x dx = (I).
Solution: Again we have little choice on our selection of u and dv.
u = tan−1 x dv = x dx
1 1
du = 2 dx v = x2
x +1 2
10 Some texts leave out the “x =” parts, assuming they are understood, but we will continue to use the convention
that, unless otherwise stated, the “limits of integration” should match the differential’s variable. Another popular
way to write (7.18) avoids the issue:
Z b ˛b Z b
˛
u(x)v′ (x) dx = u(x)v(x)˛˛ − v(x)u′ (x) dx.
a a a
7.2. INTEGRATION BY PARTS 717
Z
(I) = uv − v du
Z
1 1 x2
= x2 tan−1 x − dx.
2 2 x2 + 1
Now this last integral can be found by rewriting the integrand using either polynomial long
division, or by a little cleverness:
x2 x2 + 1 − 1 x2 + 1 1 1
= = 2 − =1− 2 .
x2 +1 2
x +1 x + 1 x2 + 1 x +1
Thus
Z
1 2 1 1
(I) = x tan−1 x − 1− 2 dx
2 2 x +1
1 1 1
= x2 tan−1 x − x + tan−1 x + C.
2 2 2
Though our choice of u and dv was limited, our choice of v was not as limited. Recall that we
could have chosen any v = 21 x2 + C1 . In this particular integral, we could have saved ourselves
some effort if we had chosen v more strategically:
u = tan−1 x dv = x dx
1 1 2
du = 2 dx v= x +1
x +1 2
This gives
Z
(I) = uv − v du
Z 1 2
1 2 2 (x + 1)
−1
= x + 1 tan x − dx
2 x2 + 1
Z
1 2 1
= x + 1 tan−1 x − dx
2 2
1 2 1
= x + 1 tan−1 x − x + C,
2 2
as before (though rearranged).
Though rare, and not crucial, strategically adding a particular constant to the natural choice for
v can on occasion make for easier computations.
718 CHAPTER 7. ADVANCED INTEGRATION TECHNIQUES
Exercises
Z
Compute the following integrals, all of 14. xex/2 dx
which can be computed “by parts.”
Z Z
2
1. x sin x dx 15. x3 ex dx
Z Z
2. x2 sin x dx 16. x5 sin x3 dx
Z
Z
3. x cos x dx
17. x2 e3x dx
Z
4. x sec x tan x dx Z
18. ln x dx
Z
5. x sec2 x dx Z
Z 19. tan−1 x dx
6. x ln x dx Z
Z 20. sin−1 x dx
7. x tan−1 x dx Z p
Z 21. x 1 − x2 sin−1 x dx
8. x sec−1 x dx, x > 1
Z
Z 22. x3 sin 2x dx
−1
9. x sec x dx, x < 1
Z
Z
√ 23. sin2 x dx (Parts optional)
10. x 1 − x dx. (Parts optional)
Z Z
x 24. cos2 5x dx (Parts optional)
11. √ dx (Parts optional)
1−x
Z Z
12. x
xe dx 25. e5x cos 2x dx
Z Z
13. x sin 5x dx 26. sec3 x dx