Skip to main content

Section 7.4 Integration By Parts

We’ve seen now that Introduction to \(u\)-Substitution is a useful technique for undoing The Chain Rule. We set up the variable substitution with the specific goal of going backwards through the Chain Rule and antidifferentiating some composition of functions.
A reasonable next step is to ask: What other derivative rules can we “undo?” What other operations between functions should we think about? This brings us to Integration by Parts, the integration technique specifically for undoing Product Rule.

Subsection Discovering the Integration by Parts Formula

Activity 7.4.1. Discovering the Integration by Parts Formula.

The product rule for derivatives says that:
\begin{equation*} \ddx{u(x)\cdot v(x)} = \fillinmath{XXXXX} + \fillinmath{XXXXX}\text{.} \end{equation*}
We know that we intend to “undo” the product rule, so let’s try to reframe the product rule from a rule about derivatives to a rule about antiderivatives.
(a)
Antidifferentiate the product rule by antidifferentiating each side of the equation.
\begin{equation*} \begin{aligned} \int \left(\ddx{u\cdot v}\right)\;dx \amp= \int \fillinmath{XXXXX}+ \fillinmath{XXXXX} dx\\ \fillinmath{XXXXX} \amp= \int \fillinmath{XXXXX} dx + \int \fillinmath{XXXXX} dx \end{aligned} \end{equation*}
Hint.
Note that on the left side of this equation, you’re antidifferentiating a derivative. What will that give you? Then, on the right side, we’re just splitting up the terms of the product rule into two different integrals.
(b)
On the right side, we have two integrals. Since each of them has a product of functions (one function and a derivative of another), we can isolate one of them in this equation and create a formula for how to antidifferentiate a product of functions! Solve for \(\int u v'\;dx\text{.}\)
(c)
Look back at this formula for \(\int u v'\;dx\text{.}\) Explain how this is really the product rule for derivatives (without just undoing all of the steps we have just done).
We typically use the substitutions \(du = u'\;dx\) and \(dv=v'\;dx\) to rewrite the integrals.

Integration by Parts.

Suppose \(u(x)\) and \(v(x)\) are both differentiable functions. Then:
\begin{equation*} \int u\;dv = uv - \int v\;du\text{.} \end{equation*}
When we select the parts for our integral, we are selecting a function to be labeled \(u\) and a function to be labeled as \(dv\text{.}\) We begin with one of the pieces of the product rule, a function multiplied by some other function’s derivative. It is important to recognize that we do different things to these functions: for one of them, \(u\text{,}\) we need to find the derivative, \(du\text{.}\) For the other, \(dv\text{,}\) we need to find an antiderivative, \(b\text{.}\) Because of these differences, it is important to build some good intuition for how to select the parts.

Subsection Intuition for Selecting the Parts

Activity 7.4.2. Picking the Parts for Integration by Parts.

Let’s consider the integral:
\begin{equation*} \int x\sin(x)\;dx\text{.} \end{equation*}
We’ll investigate how to set up the integration by parts formula with the different choices for the parts.
(a)
We’ll start with selecting \(u=x\) and \(dv = \sin(x)\;dx\text{.}\) Fill in the following with the rest of the pieces:
\begin{equation*} \begin{array}{ll} u = x \amp v = \fillinmath{XXXXX}\\ du = \fillinmath{XXXXX} \amp dv = \sin(x)\;dx \end{array} \end{equation*}
(b)
Now, set up the integration by parts formula using your labeled pieces. Notice that the integration by parts formula gives us another integral. Don’t worry about antidifferentiating this yet, let’s just set up the pieces.
Hint.
\(\int u\;dv = uv - \int v\;du\)
(c)
Let’s swap the pieces and try the setup with \(u=\sin(x)\) and \(dv = x\;dx\text{.}\) Fill in the following with the rest of the pieces:
\begin{equation*} \begin{array}{ll} u = \sin(x) \amp v = \fillinmath{XXXXX}\\ du = \fillinmath{XXXXX} \amp dv = x\;dx \end{array} \end{equation*}
(d)
Now, set up the integration by parts formula using this setup.
Hint.
\(\int u\;dv = uv - \int v\;du\)
(e)
Compare the two results we have. Which setup do you think will be easier to move forward with? Why?
Hint.
When we say we need to keep moving forward with our setup, what we mean is that we have another integral to antidifferentiate. Which one will be easier to work with: \(\int (-\cos(x))\;dx\) or \(\int \left(\frac{x^2}{2}\cos(x)\right)\text{?}\)
(f)
Finalize your work with the setup you have chosen to find \(\int x\sin(x)\;dx\text{.}\)
What made things so much better when we chose \(u=x\) compared to \(dv = x\;dx\text{?}\) We know that the new integral from our integration by parts formula will be built from the new pieces, the derivative we find from \(u\) and the antiderivative we pick from \(dv\text{.}\) So when we differentiate \(u=x\text{,}\) we get a constant, compared to antidifferentiating \(dv = x\;dx\) and getting another power function, but with a larger exponent. We know this will be combined with a \(\cos(x)\) function no matter what (since the derivative and antiderivatives of \(\sin(x)\) only will differ in their sign). So picking the version that gets that second integral to be built from a trig function and a constant is going to be much nicer than a trig function and a power function. It was nice to pick \(x\) to be the piece that we found the derivative of!
Let’s practice this comparison with another example in order to build our intuition for picking the parts in our integration by parts formula.

Activity 7.4.3. Picking the Parts for Integration by Parts.

This time we’ll look at a very similar integral:
\begin{equation*} \int x\ln(x)\;dx\text{.} \end{equation*}
Again, we’ll set this up two different ways and compare them.
(a)
We’ll start with selecting \(u=x\) and \(dv = \ln(x)\;dx\text{.}\) Fill in the following with the rest of the pieces:
\begin{equation*} \begin{array}{ll} u = x \amp v = \fillinmath{XXXXX}\\ du = \fillinmath{XXXXX} \amp dv = \ln(x)\;dx \end{array} \end{equation*}
Hint.
You’re not forgetting how to antidifferentiate \(\ln(x)\text{.}\) This is just something we don’t know yet!
(b)
Ok, so here we have to swap the pieces and try the setup with \(u=\ln(x)\) and \(dv = x\;dx\text{,}\) since we only know how to differentiate \(\ln(x)\text{.}\) Fill in the following with the rest of the pieces:
\begin{equation*} \begin{array}{ll} u = \ln(x) \amp v = \fillinmath{XXXXX}\\ du = \fillinmath{XXXXX} \amp dv = x\;dx \end{array} \end{equation*}
(c)
Now set up the integration by parts formula using this setup.
Hint.
\(\int u\;dv = uv - \int v\;du\)
(e)
Finish this work to find \(\int x\ln(x)\;dx\text{.}\)
Hint.
Notice that \(\left(\frac{x^2}{2}\right)\left(\frac{1}{x}\right) = \frac{x}{2}\text{.}\)
So here, we didn’t actually get much choice. We couldn’t pick \(u=x\) in order to differentiate it (and get a constant to multiply into our second integral) since we don’t know how to antidifferentiate \(\ln(x)\) (yet: once we know how, it might be fun to come back to this problem and try it again with the parts flipped). But we can also notice that it ended up being fine to antidifferentiate \(x\text{:}\) the increased power from our power rule didn’t really matter much when we combined it with the derivative of the logarithm, since the derivative of the log is also a power function! So we were able to combine those easily and actually integrate that second integral.

Example 7.4.1.

Integrate the following:
(a)
\(\displaystyle\int x^2 e^x\;dx\)
Hint.
It doesn’t matter whether we differentiate or antidifferentiate \(e^x\text{,}\) since we’ll get the same thing. Let’s pick \(u=x^2\) so that we can differentiate it.
Solution.
\begin{equation*} \begin{array}{ll} u = x^2 & v = e^x\\ du = 2x\; dx & dv = e^x\;dx \end{array} \end{equation*}
\begin{equation*} \int x^2e^x\;dx = x^2e^x - \int 2xe^x \;dx \end{equation*}
We need to do more integration by parts!
\begin{equation*} \begin{array}{ll} u = 2x & v = e^x\\ du = 2\;dx & dv = e^x\;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int x^2e^x\;dx & = x^2e^x - \left(2xe^x - \int 2e^x\;dx\right)\\ & = x^2e^x-2xe^x+2e^x+C \end{aligned} \end{equation*}
(b)
\(\displaystyle \int 2x\tan^{-1}(x)\;dx\)
Hint.
We don’t know how to antidifferentiate \(\tan^{-1}(x)\text{,}\) but we do know how to differentiate it!
Solution.
\begin{equation*} \begin{array}{ll} u = \tan^{-1}(x) & v = x^2\\ du = \frac{1}{x^2+1}\;dx & dv = 2x\;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int 2x\tan^{-1}(x)\;dx & = x^2\tan^{-1}(x) - \int \frac{x^2}{x^2+1}\;dx\\ & = x^2\tan^{-1}(x) - \int \frac{(x^2+1)-1}{x^2+1}\;dx & \text{Alternatively, use long division.}\\ & = x^2\tan^{-1}(x) - \int 1 - \frac{1}{x^2+1}\;dx\\ & = x^2\tan^{-1}(x) - x + \tan^{-1}(x)+C \end{aligned} \end{equation*}

Subsection Some Flexible Choices for Parts

We’re going to look at a couple of examples where we can showcase some of the flexibility we have with our choices of parts. First, we’ll revisit Example 7.4.1. In this example, when we got to that second integral, we noticed that for the fraction \(\frac{x^2}{x^2+1}\text{,}\) we could either do some long division (since the degrees in the numerator and denominator are the same) or do some clever rewriting of the numerator. Either way, we know that this fraction is almost 1...It’s really \(1\pm\) some bit (in this case, the extra bit was a fraction \(\frac{1}{x^2+1}\)).
What if we chose our parts differently? Not the \(u\) and \(dv\) parts, though, since we still haven’t figured out how to antidifferentiate \(\tan^{-1}(x)\text{.}\) But we get one more choice!
Once we choose \(u\text{,}\) we don’t really get a separate choice for \(du\text{:}\) it’s simply the derivative of \(u\) with regard to \(x\) multiplied by the differential \(dx\text{.}\) But consider our choice of \(dv\text{,}\) and the subsequent process of finding \(v\text{.}\) Yes, there’s only one possible answer, but in a much more real sense, there isn’t just one possible answer. There are an infinite number of them! We know, due to the Mean Value Theorem and then later due to Theorem 4.1.7, that there are an infinite number of antiderivatives, all differing by, at most, a constant term. So let’s pick a more appropriate antiderivative!

Example 7.4.2.

Integrate \(\displaystyle \int 2x\tan^{-1}(x)\;dx\text{,}\) this time making a more intentional choice for \(v\text{.}\)
Hint.
Note that if we pick \(v = x^2+1\text{,}\) then the second integral will be just delightful.
Solution.
\begin{equation*} \begin{array}{ll} u = \tan^{-1}(x) & v = x^2+1\\ du = \frac{1}{x^2+1}\;dx & dv = 2x\;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int 2x\tan^{-1}(x)\;dx & = (x^2+1)\tan^{-1}(x) - \int \frac{x^2+1}{x^2+1}\;dx\\ & = x^2\tan^{-1}(x) + \tan^{-1}(x) - \int \;dx\\ & = x^2\tan^{-1}(x) + \tan^{-1}(x) - x + C \end{aligned} \end{equation*}
So we get the same thing, but didn’t have to think through the long division or the forced factoring. But the trade off here is that we almost have to see this coming to notice it. This flexibility doesn’t always come into play for us. But we can look at a different kind of flexibility.
We’ve looked at integrals with both \(\ln(x)\) and \(\tan^{-1}(x)\text{.}\) For these, and for other inverse functions specifically, we pick them to be the \(u\) part in our integration by parts problems because we don’t know how do antidifferentiate them.
So let’s look at \(\displaystyle \int \ln(x)\;dx\text{,}\) and we’ll solve this integral by, specifically, differentiating \(\ln(x)\) instead of antidifferentiating it.

Example 7.4.3. Antidifferentiating the Log Function.

Integrate \(\displaystyle \int \ln(x)\;dx\text{.}\)
Hint.
Pick \(u=\ln(x)\text{,}\) since we can differentiate it. What does that leave for \(dv\text{?}\)
Solution 1.
\begin{equation*} \begin{array}{ll} u = \ln(x) & v = x\\ du = \frac{1}{x}\;dx & dv = \;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int \ln(x)\;dx &= x\ln(x) - \int \frac{x}{x}\;dx\\ & = x\ln(x) - x + C \end{aligned} \end{equation*}
Solution 2.
An alternate approach is to use a substitution first. We’re going to be using a lot of different variable names here, so let’s use a \(t\)-substitution. Let \(t=\ln(x)\) so that \(dt=\frac{1}{x}\;dx\text{.}\) In order to induce this derivative of the log, let’s multiply by \(\frac{x}{x}\) inside the integral:
\begin{align*} \int \ln(x)\;dx\amp = \int \frac{x}{x}\ln(x)\;dx\\ \amp = \int x\underbrace{\ln(x)}_{t}\underbrace{\left(\frac{1}{x}\right)\;dx}_{dt}\\ t = \ln(x) \amp\longrightarrow x=e^t \\ \int x \ln(x)\left(\frac{1}{x}\right)\;dx \amp = \int te^t\;dt \end{align*}
This integral can be done using the standard integration by parts!
\begin{align*} u = t \amp v = e^t\\ du=dt \amp dv=e^t\;dt \\ \int te^t\;dt \amp = uv-\int v\;du \\ \amp = te^t - \int e^t\;dt\\ \amp = te^t - e^t +C \end{align*}
Now, we can substitute back to \(x\text{:}\)
\begin{equation*} te^t - e^t +C = x\ln(x)-x+C\text{.} \end{equation*}
We can use this same strategy to find antiderivatives of \(\tan^{-1}(x)\text{,}\) \(\sin^{-1}(x)\text{,}\) and eventually \(\sec^{-1}(x)\text{.}\)
Now that we know the antiderivative family for \(\ln(x)\text{,}\) we can revisit the problem in Activity 7.4.3, \(\displaystyle \int x\ln(x)\;dx\text{,}\) and try to work through the integration by parts when \(u=x\) and \(dv = \ln(x)\;dx\text{.}\)

Example 7.4.4.

Integrate \(\displaystyle \int x\ln(x)\;dx\text{.}\)
Solution.
\begin{equation*} \begin{array}{ll} u = x & v = x\ln(x)-x\\ du = \;dx & dv = \ln(x)\;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int x\ln(x)\;dx & = x(x\ln(x)-x) - \int x\ln(x)-x\;dx\\ & = x^2\ln(x)-x^2 - \int x\ln(x)\;dx + \int x \;dx\\ & = x^2\ln(x)-x^2 + \frac{x^2}{2} - \int x\ln(x)\;dx \end{aligned} \end{equation*}
Note that this last integral is really recognizable: it’s the one we started with! Let’s “solve” this equation for that integral by adding it to both sides of our equation.
\begin{equation*} \begin{aligned} 2\int x\ln(x)\;dx & = x^2\ln(x) - \frac{x^2}{2}\\ \int x\ln(x)\;dx & = \frac{x^2\ln(x)}{2} - \frac{x^2}{4} + C \end{aligned} \end{equation*}

Subsection Solving for the Integral

In this last example, we ended up seeing the original integral repeated when we did integration by parts. This is a useful technique, especially when we deal with functions that have a kind of “repeating” structure to their derivatives or antiderivatives. We’ll look at a couple of classic integrals where we see this kind of technique employed. Let’s have you explore this idea.

Activity 7.4.4. Squared Trig Functions.

Let’s look at two integrals. We’ll talk about both at the same time, since they’re similar.
\begin{equation*} \int \sin^2(x)\;dx \end{equation*}
\begin{equation*} \int \cos^2(x)\;dx \end{equation*}
(a)
What does it mean to “square” a trig function? Write these integrals in a different way, where the meaning of the “squared” exponent is more clear. What do you notice about the structure of these integrals, the operation in the integrand function? What does this mean about our choice of integration technique?
Hint.
\begin{align*} \int \sin^2(x)\;dx \amp = \int \sin(x)\sin(x)\;dx \\ \int \cos^2(x)\;dx \amp = \int \cos(x)\cos(x)\;dx \end{align*}
(b)
If you were to use integration by parts on these integrals, does your choice of \(u\) and \(dv\) even matter here? Why not?
Hint.
Is there a difference in the two functions being multiplied?
(c)
Apply the integration by parts formula to each. What do you notice?
Solution.
For the integral \(\displaystyle \int \sin^2(x)\;dx\text{:}\)
\begin{align*} u = \sin(x)\;\; \amp \;\;v = -\cos(x)\\ du = \cos(x)\;dx \;\;\amp \;\;dv= \sin(x)\;dx \\ \int \sin^2(x)\;dx \amp = -\sin(x)\cos(x)+\int \cos^2(x)\;dx \end{align*}
For the integral \(\displaystyle \int \cos^2(x)\;dx\text{:}\)
\begin{align*} u = \cos(x)\;\; \amp \;\;v = \sin(x)\\ du = -\sin(x)\;dx \;\;\amp \;\;dv= \cos(x)\;dx \\ \int \cos^2(x)\;dx \amp = \sin(x)\cos(x) + \int \sin^2(x)\;dx \end{align*}
(d)
Instead of applying another round of integration by parts to the resulting integral, use the Pythagorean identities to rewrite these integrals:
\begin{align*} \sin^2(x) \amp = 1-\cos^2(x)\\ \cos^2(x) \amp = 1-\sin^2(x) \end{align*}
(e)
You should notice that, in your equation for the integration of \(\displaystyle \sin^2(x)\;dx\text{,}\) you have another copy of \(\displaystyle \int \sin^2(x)\;dx\text{.}\) Similarly, in your equation for the integration of \(\displaystyle \cos^2(x)\;dx\text{,}\) you have another copy of \(\displaystyle \int \cos^2(x)\;dx\text{.}\)
Replace these integrals with a variable, like \(I\) (for “integral”). Can you “solve” for this variable (integral)?
Solution.
For \(\int \sin^2(x)\;dx\text{:}\)
\begin{align*} \int \sin^2(x)\;dx \amp = -\sin(x)\cos(x) + \int 1-\sin^2(x)\;dx\\ I \amp = -\sin(x)\cos(x) + \int 1 \;dx - \underbrace{\int \sin^2(x)\;dx}_{I}\\ I \amp = -\sin(x)\cos(x) + x - I\\ 2I \amp = -\sin(x)\cos(x)+x\\ I \amp = \dfrac{-\sin(x)\cos(x)+x}{2}+C \end{align*}
So we end up with:
\begin{equation*} \int \sin^2(x)\;dx = \frac{x-\sin(x)\cos(x)}{2}+C\text{.} \end{equation*}
For \(\int \cos^2(x)\;dx\text{:}\)
\begin{align*} \int \cos^2(x)\;dx \amp = \sin(x)\cos(x) + \int 1-\cos^2(x)\;dx\\ I \amp = \sin(x)\cos(x) + \int 1 \;dx - \underbrace{\int \cos^2(x)\;dx}_{I}\\ I \amp = \sin(x)\cos(x) + x - I\\ 2I \amp = \sin(x)\cos(x)+x\\ I \amp = \dfrac{\sin(x)\cos(x)+x}{2}+C \end{align*}
So we end up with:
\begin{equation*} \int \cos^2(x)\;dx = \frac{x+\sin(x)\cos(x)}{2}+C\text{.} \end{equation*}
This “solving for the integral” approach works well, but works best when we can see it coming. Notice that it happened here due to the repeating structure of the derivatives of the sine and cosine functions, as well as the Pythagorean identities. We can see some more examples of this in play with similar functions!

Example 7.4.5.

For each of the following integrals, use integration by parts to solve.
(a)
\(\displaystyle \int \sin(x)\cos(x)\;dx\)
Hint.
This one is pretty straightforward, since it doesn’t really matter what we select as our parts. Notice, though, that this isn’t the only way we can approach this! We can use \(u\)-substitution, or even rewrite this using a trigonometric identity.
Solution.
\begin{equation*} \begin{array}{ll} u = \sin(x) & v = \sin(x)\\ du = \cos(x)\;dx & dv = \cos(x)\;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int \sin(x)\cos(x)\;dx & = \sin^2(x) - \int \sin(x)\cos(x)\;dx\\ 2\int \sin(x)\cos(x)\;dx & = \sin^2(x)\\ \int \sin(x)\cos(x)\;dx & = \frac{\sin^2(x)}{2} + C \end{aligned} \end{equation*}
(b)
\(\displaystyle \int e^x\cos(x)\;dx\)
Solution.
\begin{equation*} \begin{array}{ll} u = e^x & v = \sin(x)\\ du = e^x\;dx & dv = \cos(x)\;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int e^x\cos(x)\;dx & = e^x\sin(x) - \int e^x\sin(x)\;dx \end{aligned} \end{equation*}
\begin{equation*} \begin{array}{ll} u = e^x & v = -\cos(x)\\ du = e^x\;dx & dv = \sin(x)\;dx \end{array} \end{equation*}
\begin{equation*} \begin{aligned} \int e^x\cos(x)\;dx & = e^x\sin(x) - \int e^x\sin(x)\;dx\\ \int e^x\cos(x)\;dx & = e^x\sin(x) + e^x\cos(x) - \int e^x\cos(x)\;dx\\ 2\int e^x\cos(x)\;dx & = e^x\sin(x) + e^x\cos(x)\\ \int e^x\cos(x)\;dx & = \frac{e^x\sin(x) + e^x\cos(x)}{2}+C \end{aligned} \end{equation*}
Notice that we can come up with a bunch of different examples that are similar to Example 7.4.5. If we put trigonometric functions inside our integral, we’ll have some options with how we approach them! We can use \(u\)-substitution, since the derivatives of trigonometric functions are other trigonometric functions. In Example 7.4.5, for instance, we could write \(u=\sin(x)\) and \(du = \cos(x)\;dx\text{,}\) or even chose \(u=\cos(x)\) and \(du = -\sin(x)\;dx\text{.}\)
The real issues will come when our integrand is not just a product of two trigonometric functions, but when they are products of trigonometric functions raised to exponents. We’ll have some combinations of these products (which maybe makes us think about integration by parts) and composition (which points towards \(u\)-substitution). In the next section, we’ll develop some strategies to deal with these kinds of integrals.

Practice Problems Practice Problems

1.

Explain how we build the Integration by Parts formula, as well as what the purpose of this integration strategy is.

2.

How do you choose options for \(u\) and \(dv\text{?}\) What are some good strategies to think about?

3.

Let’s say that you make a choice for \(u\) and \(dv\) and begin working through the Integration by Parts strategy. How can you tell if you’ve made a poor choice for your parts? Can you always tell?

5.

Evaluate the following definite integrals.
(a)
\(\dint_{x=1}^{x=e} x\ln(x)\;dx\)
(b)
\(\dint_{x=0}^{x=\pi/4} x\cos(2x)\;dx\)
(c)
\(\dint_{x=0}^{x=\ln(5)} xe^{x}\;dx\)

6.

In this problem, we’ll consider the integral \(\dint \sin^2(x)\;dx\text{.}\) We’ll integrate this in two different ways!
(a)
We know that:
\begin{equation*} \dint \sin^2(x)\;dx = \dint \sin(x)\sin(x)\;dx\text{.} \end{equation*}
Use the Integration by Parts strategy, and especially note that you can solve for the integral (Solving for the Integral).
(b)
We can use a trigonometric identity to rewrite the integral:
\begin{equation*} \sin^2(x) = \dfrac{1-\cos(2x)}{2}\text{.} \end{equation*}
So we have:
\begin{equation*} \int \sin^2(x)\;dx = \int \frac{1}{2} - \frac{1}{2}\cos(2x)\;dx\text{.} \end{equation*}
Use \(u\)-substitution.
(c)
Were your answers the same or different? Should they be the same? Why or why not? Are they connected somehow?
Hint.
They might be different, but they should only be different by, at most, a constant.

7.

For these next problems, we’ll use \(x=u^2\) and \(dx = 2u\;du\) to substitute into the integral as written. Then use Integration by Parts.
(a)
\(\dint \sin(\sqrt{x})\;dx\)