Skip to main content

Section 7.1 Integration by Parts

In this section, we will learn a method to evaluate integrals called the Integration by Parts, which is derived from the Product Rule from derivatives.

Investigation 7.1.1.

How would you evaluate the integral
\begin{equation*} \int x\cos(x)\, dx \end{equation*}

(a)

Math would be so much easier if we could just take the integral of the two functions in the integrand separately. So let’s do it! What would be the answer if we were to integrate each factor separately?
Solution.
If we were to integrate each function separately, then we would obtain
\begin{align*} \int x\cos(x)\, dx \amp= \left(\int x\, dx\right)\left(\int \cos(x)\, dx\right) \\ \amp= \frac{x^2}{2}\cdot \sin(x) + C \end{align*}

(b)

Now check the answer you got from part (a). Is this a correct antiderivative of \(y = x\cos(x)\text{?}\)
Solution.
If \(y = \dfrac{x^2}{2}\cdot \sin(x) + C\) were the general antiderivative of \(y = x\cos(x)\text{,}\) then it would imply that
\begin{equation*} \frac{d}{dx}\left(\frac{x^2}{2}\cdot\sin(x)\right) = x\cos(x) \end{equation*}
Yet, by the Product Rule of derivative, we know that
\begin{align*} \frac{d}{dx}\left(\frac{x^2}{2}\cdot\sin(x)\right) \amp= \frac{d}{dx}\left(\frac{x^2}{2}\right)\cdot \sin(x) + \frac{x^2}{2}\cdot \frac{d}{dx}\left(\sin(x)\right) \\ \amp= x\sin(x) + \frac{x^2}{2}\cos(x) \end{align*}
See that the derivative of \(y = \frac{x^2}{2}\cdot \sin(x) + C\) clearly doesn’t equal to the integrand. Hence, we know that \(y = \frac{x^2}{2}\cdot \sin(x) + C\) is NOT the general antiderivative of \(y = x\cos(x)\text{.}\)
So we know that our method of integrating the function by integrating each factor separately is incorrect.

(c)

Then what is the correct answer to this integral?
Hint.
This may seem like a totally irrelevant hint but what is the derivative of
\begin{equation*} y = x\sin(x) + \cos(x) + 1 \end{equation*}
Solution.
Let’s take the derivative of the function \(y = x\sin(x) + \cos(x) + 1\) given in the hint.
\begin{align*} y' \amp= \left(x\sin(x) + \cos(x) + 1\right)' \\ \amp= \left(x\sin(x)\right)' + \left(\cos(x)\right)' + (1)' \amp\amp\text{by linearity} \\ \amp= (x)'\sin(x) + x\left(\sin(x)\right)' + \left(\cos(x)\right)' \amp\amp\text{by the Product Rule}\\ \amp= \sin(x) + x\cos(x) - \sin(x) \\ \amp= x\cos(x) \end{align*}
This implies that \(y = x\sin(x) + \cos(x) + 1\) is an antiderivative of \(y = x\cos(x)\text{.}\)
Recall that all antiderivatives of a function only differ by a constant (that is why we needed the \(+C\) to denote the general antiderivative). Hence, we know that
\begin{equation*} \int x\cos(x)\, dx = x\sin(x) + \cos(x) + C \end{equation*}
See that we can’t just simply integrate each factor of the integrand when integrating a factor of two functions. We will need a new method that allows us to integrate a product of two functions.

Subsection Formula to integrate the product of two functions

Recall we learned a fancy formula, called the product rule, to take the derivative of a product of two functions back in calculus 1. For demonstration purposes, let’s call these two functions \(u\) and \(v\text{.}\) If we wanted to take the derivative of \(u v\text{,}\) then the product rule tells us that
\begin{equation*} \frac{d}{dx}\left(uv\right) = \frac{du}{dx}\cdot v + u\cdot \frac{dv}{dx} \end{equation*}
If we want to spin this around using calculus 2 language about antiderivatives, then we can say that \(\dfrac{du}{dx}\cdot v + u\cdot \dfrac{dv}{dx}\) is an antiderivative of \(uv\text{.}\) Symbolically, this means that
\begin{equation*} uv = \int\left(\frac{du}{dx}\cdot v + u\cdot \frac{dv}{dx} \right)\, dx \end{equation*}
By the linearity of integral and a bit of the abuse of notation to treat the derivative symbols as fractions, we will obatin
\begin{align*} uv \amp= \int\left(\frac{du}{dx}\cdot v + u\cdot \frac{dv}{dx} \right)\, dx \\ \amp= \int \frac{du}{dx}\cdot v\, dx + \int u\cdot\frac{dv}{dx}\, dx \\ \amp= \int \frac{du}{\cancel{dx}}\cdot v\, \cancel{dx} + \int u\cdot\frac{dv}{\cancel{dx}}\, \cancel{dx} \\ \amp= \int v\, du + \int u\, dv \end{align*}
This is the equation we obtained.
\begin{equation*} \int v\, du + \int u\, dv = uv \end{equation*}
You may be wondering... why talking about derivatives at all? Isn’t the purpose of this section to come up with a way to integrate the product of two functions?
Well the magic comes when we subtract the \(\int v\, du\) on both sides of the equation. We will then obtain
\begin{equation*} \int u\, dv = uv - \int v\, du \end{equation*}
This is our formula to integrate the product of two functions! The name of this formula is called the Integration by Parts!
You may also wonder why we call this formula "integration by parts". That is because we didn’t fully integrate the integrand using this formula. After using this formula, there is still a resulting integral that needs to be evaluated. So technically speaking we only integrated parts of the integrand using this formula and we need to do more work to evaluate the resulting integral.

Subsection Integration by Parts (Indefinite Version)

Now we have a fancy formula to help us integrate the product of two functions. Let’s look at a couple examples on how to use this formula.

Example 7.1.2.

Evaluate the indefinite integral \(\displaystyle \int x\sin(x)\, dx\)
Hint.
Notice that the left-hand side of the integration by parts formula says \(\displaystyle \int u\, dv\text{.}\) To use this formula, we will need to first determine what \(u\) and \(dv\) are.
Solution.
Let’s pick \(u = x\text{,}\) which is one of the factor in the integrand. Then the \(dv\) is forced to be \(\sin(x)\, dx\text{.}\)
Observing the integration by parts formula, we also need to know what \(du\) and \(v\) are in order to use this formula.
We can obtain \(du\) by taking the derivative of \(u\text{.}\) That is,
\begin{equation*} u = x \qquad \implies\qquad \frac{du}{dx} = 1 \qquad \implies\qquad du = dx \end{equation*}
To obtain \(v\text{,}\) we can integrate \(dv\text{.}\) That is,
\begin{equation*} dv = \sin(x)\, dx \quad \implies\quad \frac{dv}{dx} = \sin(x) \quad \implies\quad v = -\cos(x) \end{equation*}
To sum up, we have the following components:
\begin{align*} u \amp= x \amp\amp dv = \sin(x)\, dx \\ du \amp= dx \amp\amp \;\; v= -\cos(x) \end{align*}
We can now put all the components together using the integration by parts formula.
\begin{align*} \int x\sin(x)\, dx \amp = x\cdot -\cos(x) - \int -\cos(x)\, dx\\ \amp= -x\cos(x) + \int\cos(x)\, dx \end{align*}
Using the integration by parts formula results in an easier integral that we can deal with!
Now we put everything together, we can evaluate the integral as follows.
\begin{align*} \int x\sin(x)\, dx \amp= -x\cos(x) + \int \cos(x)\, dx \\ \amp= -x\cos(x) + \sin(x) + C \end{align*}
Notice that we will still end up with an integral to deal with after using the integration by parts formula. That is, this method is useful only if the resulting integral is easier to evaluate (or at least not more complicated than the original integral).
Strategically speaking, we want to pick a \(u\) such that
But that doesn’t really answer the question on how to pick the \(u\) strategically to make the process work out (and/or make the problem easier). There is a "LIPET" test to help us pick a good \(u\text{.}\) LIPET is an acronym that tells us how we should pick the \(u\) in the following order:
Well... Exponential and Trigonometric functions are equally complicated when picking them to be the \(u\text{...}\)

Example 7.1.3.

Evaluate the indefinite integral \(\displaystyle \int x\ln(x)\, dx\)
Hint.
We are in the section of integration by parts so this is probably the method we should use to evaluate this integral.
In order to use the integration by parts formula, we will need to pick a \(u\) and let the rest of the integral be the \(dv\text{.}\) What type of functions are we seeing in the integrand and which one should we pick to be the \(u\) by the LIPET test?
Solution.
Notice that there is a power function and a logarithmic function in the integrand. By the LIPET test, we should pick \(u\) to be the logarithmic function.
Let \(u = \ln(x)\text{.}\) Then we have
\begin{align*} u \amp= \ln(x) \amp\amp dv = x \, dx \\ du \amp= \frac{1}{x}\, dx \amp\amp \;\; v= \frac{x^2}{2} \end{align*}
Using the integration by parts formula, we obtain
\begin{align*} \int x\ln(x)\, dx \amp= \ln(x)\cdot \frac{x^2}{2} - \int \frac{x^2}{2}\cdot \frac{1}{x}\, dx \\ \amp= \frac{x^2}{2}\ln(x) -\frac{1}{2}\int x\, dx \\ \amp= \frac{x^2}{2}\ln(x) - \frac{1}{2}\cdot \frac{x^2}{2} + C\\ \amp= \frac{x^2}{2}\ln(x) - \frac{x^2}{4} + C \end{align*}
But... can we pick \(u = x\) if we are feeling a bit rebellious and don’t want to follow the LIPET test in the previous example? The short answer is that it depends... If we pick \(u = x\) in the previous example, then the \(dv\) will be forced to be \(\ln(x)\, dx\) and we actually don’t know what the indefinite integral of \(\ln(x)\) is yet (so we would get stuck in the setup when finding the \(v\)).
We will integrate \(\ln(x)\) in the next example. When you know what the indefinite integral of \(\ln(x)\) is, I encourage you to try picking \(u = x\) in the previous example and see how much more work you need to deal with. Then you will realize that the LIPET test does save us a lot of work.

Example 7.1.4.

Evaluate the indefinite integral \(\displaystyle \int \ln(x)\, dx\)
Hint.
Since we are in the section of integration by parts, this is probably going to be the method we are using in this problem.
Yet there is only one single function in the integrand... We have to pick a function to be \(u\) and let the rest of the integral to be \(dv\text{...}\) What choice of the function do we have as our \(u\text{?}\)
Solution.
Well there is only one function in the integrand so this is going to be our only choice of \(u\text{...}\)
Let \(u = \ln(x)\text{.}\) Then we have
\begin{align*} u \amp= \ln(x) \amp\amp dv = dx \\ du \amp= \frac{1}{x}\, dx \amp\amp \;\; v= x \end{align*}
Using the integration by parts formula, we obtain
\begin{align*} \int\ln(x)\, dx \amp= \ln(x)\cdot x - \int x\cdot \frac{1}{x}\, dx \\ \amp= x\ln(x) - \int \, dx \\ \amp= x\ln(x) - x + C \end{align*}
Now we have one more formula that can go into your integral formula sheet!
A question you may have now is whether we can always evaluate the resulting integral easily.
The short answer is no. The resulting integral is just another regular integral that may need to be evaluated using fancy methods.
But a rule of thumb here is that the resulting integral should NOT be more complicated than the original integral. We don’t want to make the problem even worse to deal with.

Example 7.1.6.

Evaluate the indefinite integral \(\displaystyle \int x^2\sin(x)\, dx\)
Hint.
The method we should use to evaluate this integral will be integration by parts (we are covering this section now!). Then we will need to pick a \(u\) and let the rest of the integral be the \(dv\text{.}\) By the LIPET test, what should we pick for the \(u\text{?}\)
Solution.
Notice that there is a power function and a trigonometric function in the integrand. By the LIPET test, we should pick \(u\) to be the power function.
Let \(u = x^2\text{.}\) Then we have
\begin{align*} u \amp= x^2 \amp\amp dv = \sin(x)\, dx \\ du \amp= 2x\, dx \amp\amp \;\; v= -\cos(x) \end{align*}
Using the integration by parts formula, we obtain
\begin{align*} \int x^2\sin(x)\, dx \amp= x^2\cdot -\cos(x) - \int -\cos(x)\cdot 2x\, dx \\ \amp= -x^2\cos(x) + 2\int x\cos(x)\, dx \end{align*}
Now let’s observe the resulting integral \(\int x\cos(x)\, dx\text{.}\) This integral looks super familiar! We knew this indefinite integral equals to \(x\sin(x) + \cos(x) + C\) back from the investigation in this section!
If this observation isn’t obvious, we can always evaluate this integral using integration by parts again.
This implies that
\begin{align*} \int x^2\sin(x)\, dx \amp= -x^2\cos(x) + 2\int x\cos(x)\, dx \\ \amp= -x^2\cos(x) + 2x\sin(x) + 2\cos(x) + C \end{align*}
In the above example, notice that the resulting integral is still a bit complicated in the sense that you need to use the integration by parts (if you didn’t make the observation about the investigation). But the good news is that this resulting integral is easier compared to the original integral because we have successfully removed the square from it.

Example 7.1.7.

Evaluate the indefinite integral \(\displaystyle \int x^3\sin(x)\, dx\)
Hint.
You may find a pattern here that using integration by parts will chip away the power one at a time. Then how many times do we need to use the integration by parts to evaluate this integral fully?
Solution.
We will need to use the integration by parts formula three times to fully evaluate this integral. It is kind of tedious to do the same thing three times in a row (feel free to try it out if this sounds like a good challenge for you!).
Instead, we will evaluate this integral using a shortcut called the tabular method. As the name of this method suggests, this is a method that tracks the \(u\) (and its derivatives) and the \(dv\) (and its antiderivatives) in a table.
We will set up the table as follows:
  • The first column consists of alternating signs (mainly because of the minus sign in the formula);
  • The secound column consists of \(u\) and its consecutive derivatives until it reaches \(0\text{;}\)
  • The third column consists of \(dv\) and its consecutive antiderivatives until it reaches the row containing \(0\) as the consecutive derivatives of \(u\text{.}\)
Then the answer will be the sum of the product of cells connecting by the arrows.
As an example, below is the table constructed to evaluate the integral given in the prompt:
Sign \(\boldsymbol{u}\) \(\boldsymbol{dv}\)
\(+\) \(\rightarrow\) \(x^3\) \(\searrow\) \(\sin(x)\,dx\)
\(-\) \(\rightarrow\) \(3x^2\) \(\searrow\) \(-\cos(x)\)
\(+\) \(\rightarrow\) \(6x\) \(\searrow\) \(-\sin(x)\)
\(-\) \(\rightarrow\) \(6\) \(\searrow\) \(\cos(x)\)
\(+\) \(0\) \(\sin(x)\)
Then the answer is
\begin{align*} \int x^3 \sin(x)\, dx \amp = x^3\cdot -\cos(x) - 3x^2\cdot -\sin(x) + 6x \cos(x) - 6 \sin(x) + C \\ \amp = -x^3 \cos(x) + 3x^2 \sin(x) + 6x \cos(x) - 6 \sin(x) + C \end{align*}
But Richard... What if the resulting integral is equally complicated as the original integral... Well the good news is that we can sometimes deal with this case using a smart trick, which is to treat the evaluation process as an equation (this will allow us to solve for the integral).

Example 7.1.8.

Evaluate the indefinite integral \(\displaystyle \int e^x\sin(x)\, dx\)
Hint.
Notice that there are two functions being multiplied together in the integrand, which is an exponential function and a trigonometric function. By the LIPET test, which one should we pick to be the \(u\) and what the \(dv\) is?
Solution.
It turns out that it doesn’t matter which function we pick to be our \(u\) and the problem is equally complicated. For demonstration purposes, let’s follow the LIPET test and pick \(u\) to be the exponential function. I will encourage you to solve this problem again by picking the \(u\) to be the trigonometric function. Then you can compare and contrast the work (they are mostly the same anyways).
Let \(u = e^x\text{.}\) Then we have
\begin{align*} u \amp= e^x \amp\amp dv = \sin(x)\, dx \\ du \amp= e^x\, dx \amp\amp \;\; v= -\cos(x) \end{align*}
Using the integration by parts formula, we obtain
\begin{align*} \int e^x\sin(x)\, dx \amp= e^x\cdot -\cos(x) - \int -\cos(x)\cdot e^x\, dx \\ \amp= -e^x\cos(x) + \int e^x\cos(x)\, dx \end{align*}
Hmm the resulting integral seems equally complicated in the sense that we still have an exponential function and an trigonometric function in it (but the only difference is that the \(\sin(x)\) became an \(\cos(x)\)).
Let’s try using the integration by parts formula again to the resulting integral and see if it will lead us somewhere.
Let \(\widetilde{u} = e^x\text{.}\) Then we have
\begin{align*} \widetilde{u} \amp= e^x \amp\amp d\widetilde{v} = \cos(x)\, dx \\ d\widetilde{u} \amp= e^x\, dx \amp\amp \;\; \widetilde{v}= \sin(x) \end{align*}
Using the integration by parts formula, we obtain
\begin{align*} \int e^x\cos(x)\, dx \amp= e^x\sin(x) - \int e^x\sin(x) \, dx \end{align*}
Let’s put everything together, and we obtain the following
\begin{equation*} \int e^x\sin(x)\, dx = -e^x\cos(x) + e^x\sin(x) - \int e^x\sin(x)\, dx \end{equation*}
Well the resulting integral ended up being the same as the original integral. So we are in a loop using the integration by parts. Does it mean this problem is unsolvable and we just have to give up?
Of course not! Richard is coming to your rescue! Richard is feeling lazy and he doesn’t want to keep on writing (or in this case, tying) the integral all the time, so he will just call it \(I\text{.}\) That is, let’s define
\begin{equation*} I = \int e^x\sin(x)\, dx \end{equation*}
Then the last line of our work will become the following equation:
\begin{equation*} I = -e^x\cos(x) + e^x\sin(x) - I \end{equation*}
Remember the goal here is to figure out what \(I\) is. This seems like an equation that we can totally solve for \(I\text{.}\)
Adding \(I\) on both sides and then divide both sides of the equation by 2, we obtain
\begin{equation*} I = \frac{1}{2}\left(-e^x\cos(x) + e^x\sin(x)\right) \end{equation*}
This implies that
\begin{equation*} \int e^x\sin(x)\, dx = \frac{1}{2}\left(-e^x\cos(x) + e^x\sin(x)\right) + C \end{equation*}
Ha! We did it! We evaluated the integral!
Observe that the trick in the previous example is to treat the integral as a variable and solve for it if the integration by pats loops you back to the same integral.

Subsection Integration by parts OR \(\boldsymbol{u}\)-sub?

Now that we have learned two fancy methods to evaluate integrals, integration by parts and \(u\)-sub. How do I know which one I should use when evaluating integrals?

Example 7.1.9.

Determine which method, integration by parts or \(u\)-sub, is applicable to the following indefinite integral
\begin{equation*} \int x\cos\left(x^2\right)\, dx \end{equation*}
Hint. Probably not a very useful hint...
Trust your gut and just pick one! If the method you picked doesn’t work, then try the other one! Be bold! This is just a math question, not a life or death situation!
Solution.
Let’s try using the integration by parts first since we are covering this section now. I am seeing a power function and a trigonometric (ish) function being multiplied in the integrand. By the LIPET test, I will pick \(u = x\text{,}\) which implies that \(dv = \cos\left(x^2\right)\, dx\text{.}\)
Hmm but I am stuck now since I don’t know what \(v\) is... (and it turns out that we can’t integrate \(\cos\left(x^2\right)\) anyways...). But that’s okay! At least we can rule out a bad method!
Now let’s try using \(u\)-sub here. Let \(u = x^2\text{.}\) Then \(du = 2x\, dx\text{,}\) which implies that \(x\, dx = \frac{du}{2}\text{.}\) We obtain
\begin{align*} \int x\cos\left(x^2\right)\, dx \amp= \int \cos(u)\cdot \frac{du}{2} \\ \amp= \frac{1}{2}\cos(u)\, du \\ \amp= \frac{1}{2}\sin(u) + C \\ \amp= \frac{1}{2}\sin\left(x^2\right) + C \end{align*}

Example 7.1.10.

Determine which method, integration by parts or \(u\)-sub, is applicable to the following indefinite integral
\begin{equation*} \int x^2\cos\left(x\right)\, dx \end{equation*}
Solution.
I am going to be bold and try using the integration by parts again. By the LIPET test, we will pick \(u\) to be \(x^2\text{.}\)
Let \(u = x^2\text{.}\) Then we have
\begin{align*} u \amp= x^2 \amp\amp dv = \cos(x)\, dx \\ du \amp= 2x\, dx \amp\amp \;\; v= \sin(x) \end{align*}
Using the integration by parts formula, we obtain
\begin{align*} \int x^2\cos(x)\, dx \amp= x^2\sin(x) - \int \sin(x)\cdot 2x\, dx \\ \amp= x^2\sin(x) - 2\int x\sin(x)\, dx \end{align*}
Hey! The resulting integral is easier and we actually know what the integral of \(x\sin(x)\) is! We found it out in one of the previous examples. Using the result from that example, we obtain
\begin{align*} \int x^2\cos(x)\, dx \amp= x^2\sin(x) - 2\int x\sin(x) \\ \amp= x^2\sin(x) + x\cos(x) - \sin(x) + C \end{align*}
We just picked a method and it works out after all! Yay!
I am sure some of you can find some patterns here. We will summarize all the methods and some strategies to evaluate integrals later in Section 7.6 so I won’t go too in dept in this section.
The takeaway message here is to be bold and pick a method. Don’t be afraid to switch methods if one doesn’t work (or when you get stuck).

Subsection Integration by Parts (Definite Version)

There is not much to say in this part since the only additional step to do here is to plug in the limits of integration and do the subtraction...
Remember that the variable doesn’t change when using the integration by parts formula (the variable remains to be \(x\) throughout the whole process) so we don’t need to adjust the limits of integration.
We will wrap up this section by looking at an example of evaluating a definite integral using integration by parts.

Example 7.1.12.

Evaluate the definite integral \(\displaystyle \int_0^1 \arctan(x)\, dx\)
Hint.
This is similar to one of the previous examples that there is only one function in the integrand... So there is only one choice we have for our \(u\text{...}\)
Solution.
Our only choice of \(u\) is the \(\arctan(x)\text{...}\)
Let \(u = \arctan(x)\text{.}\) Then we have
\begin{align*} u \amp= \arctan(x) \amp\amp dv = \, dx \\ du \amp= \frac{1}{1 + x^2}\, dx \amp\amp \;\; v= x \end{align*}
Using the integration by parts formula, we obtain
\begin{align*} \int_0^1 \arctan(x)\, dx \amp= x\arctan(x)\bigg|_0^1 - \int_0^1 \frac{x}{1 + x^2}\, dx \\ \amp= \frac{\pi}{4} - \int_0^1 \frac{x}{1 + x^2}\, dx \end{align*}
Recall we evaluated the resulting integral back in SectionΒ 5.8 using \(u\)-sub. For your convenience, I will include the result below:
\begin{equation*} \int \frac{x}{1 + x^2}\, dx = \frac{1}{2}\ln\left(1 + x^2\right) + C \end{equation*}
This implies that
\begin{align*} \int_0^1\arctan(x)\, dx \amp= \frac{\pi}{4} - \frac{1}{2}\left(\ln\left(1 + x^2\right)\right)\bigg|_0^1 \\ \amp= \frac{\pi}{4} - \frac{1}{2}\ln(2) \end{align*}

Worksheet Some Exercises for this section

I included some practice problems that cover some main concepts in this section. You don’t need to turn it in, but I highly encourage you to work on this with your classmates. I may take problems here to be your in-class practice problems, homework problems, and/or exam problems. Reach out to Richard for help if you get stuck or have any questions.
I will only include the final answer to some of the problems for you to check your result. If you want to check your work, talk to Richard and he is happy to discuss the process with you.

Exercise Group.

Evaluate the following indefinite integral using integration by parts.

Exercise Group.

Evaluate the following indefinite integral using multiple methods indicated in the hint below.
P.S.: I encourage you to try evaluating the following integral in a different way (be rebellious and adventurous a bit). We will talk about strategies in evaluating integrals in Section 7.6 where one of the important idea is that there may be multiple strategies to evaluate an integral.

Exercise Group.

Evaluate the following definite integral. Make sure your notation is clear and correct.