Skip to main content
Logo image

APEX Calculus

Section 6.2 Integration by Parts

Here’s a simple integral that we can’t yet evaluate:
\begin{equation*} \int x\cos(x) \,dx\text{.} \end{equation*}
It’s a simple matter to take the derivative of the integrand using the Product Rule, but there is no Product Rule for integrals. However, this section introduces Integration by Parts, a method of integration that is based on the Product Rule for derivatives. It will enable us to evaluate this integral.
The Product Rule says that if \(u\) and \(v\) are functions of \(x\text{,}\) then \((uv)' = u'v + uv'\text{.}\) For simplicity, we’ve written \(u\) for \(u(x)\) and \(v\) for \(v(x)\text{.}\) Suppose we integrate both sides with respect to \(x\text{.}\) This gives
\begin{equation*} \int (uv)'\,dx = \int (u'v+uv')\,dx\text{.} \end{equation*}
By the Fundamental Theorem of Calculus, the left side integrates to \(uv\text{.}\) The right side can be broken up into two integrals, and we have
\begin{equation*} uv = \int u'v\,dx + \int uv'\,dx\text{.} \end{equation*}
Solving for the second integral we have
\begin{equation*} \int uv'\,dx = uv - \int u'v\,dx\text{.} \end{equation*}
Using differential notation, we can write \(du = u'(x)dx\) and \(dv=v'(x)dx\) and the expression above can be written as follows:
\begin{equation*} \int u\,dv = uv - \int v\,du\text{.} \end{equation*}
This is the Integration by Parts formula. For reference purposes, we state this in a theorem.
Let’s try an example to understand our new technique.

Example 6.2.2. Integrating using Integration by Parts.

Evaluate \(\ds\int x\cos(x) \, dx\text{.}\)
The key to Integration by Parts is to identify part of the integrand as “\(u\)” and part as “\(dv\text{.}\)” Regular practice will help one make good identifications, and later we will introduce some principles that help. For now, let \(u=x\) and \(dv=\cos(x) \, dx\text{.}\)
It is generally useful to make a small table of these values as done below. Right now we only know \(u\) and \(dv\) as shown on the left of Figure 6.2.3; on the right we fill in the rest of what we need. If \(u = x\text{,}\) then \(du = dx\text{.}\) Since \(dv = \cos(x)\, dx\text{,}\) \(v\) is an antiderivative of \(\cos(x)\text{.}\) We choose \(v = \sin(x)\text{.}\)
\begin{align*} u\amp = x \amp v\amp =\mathord{?}\\ du\amp = \mathord{?} \amp dv\amp =\cos(x) \, dx \end{align*}
\begin{align*} u\amp = x \amp v\amp =\sin(x)\\ du\amp = dx \amp dv\amp =\cos(x) \, dx \end{align*}
Figure 6.2.3. Setting up Integration by Parts
Now substitute all of this into the Integration by Parts formula, giving
\begin{equation*} \int x\cos(x)\,dx = x\sin(x) - \int \sin(x) \,dx\text{.} \end{equation*}
We can then integrate \(\sin(x)\) to get \(-\cos(x) + C\) and overall our answer is
\begin{equation*} \int x\cos(x)\, dx = x\sin(x) + \cos(x) + C\text{.} \end{equation*}
Note how the antiderivative contains a product, \(x\sin(x)\text{.}\) This product is what makes Integration by Parts necessary.
We can check our work by taking the derivative:
\begin{align*} \lzoo{x}{x\sin(x) + \cos(x) + C} \amp =x\cos(x)+\sin(x)-\sin(x)+0\\ \amp = x\cos(x)\text{.} \end{align*}
You may wonder what would have happened in Example 6.2.2 if we had chosen our \(u\) and \(dv\) differently. If we had chosen \(u=\cos(x)\) and \(dv=x \, dx\) then \(du=-\sin(x)\, dx\) and \(v=x^2/2\text{.}\) Our second integral is not simpler than the first; we would have
\begin{equation*} \int x\cos(x)\,dx=\cos(x)\frac{x^2}{2}-\int \frac{x^2}{2}\left(-\sin(x)\right)\,dx\text{.} \end{equation*}
The only way to approach this second integral would be yet another integration by parts.
Example 6.2.2 demonstrates how Integration by Parts works in general. We try to identify \(u\) and \(dv\) in the integral we are given, and the key is that we usually want to choose \(u\) and \(dv\) so that \(du\) is simpler than \(u\) and \(v\) is hopefully not too much more complicated than \(dv\text{.}\) This will mean that the integral on the right side of the Integration by Parts formula, \(\int v\,du\) will be simpler to integrate than the original integral \(\int u\,dv\text{.}\)
In the example above, we chose \(u=x\) and \(dv=\cos(x)\,dx\text{.}\) Then \(du=dx\) was simpler than \(u\) and \(v=\sin(x)\) is no more complicated than \(dv\text{.}\) Therefore, instead of integrating \(x\cos(x) \,dx\text{,}\) we could integrate \(\sin(x)\,dx\text{,}\) which we knew how to do.
A useful mnemonic for helping to determine \(u\) is “LIATE,” where
L = Logarithmic, I = Inverse Trig., A = Algebraic (polynomials, roots, power functions), T = Trigonometric, and E = Exponential.
If the integrand contains both a logarithmic and an algebraic term, in general letting \(u\) be the logarithmic term works best, as indicated by L coming before A in LIATE.
We now consider another example.

Example 6.2.4. Integrating using Integration by Parts.

Evaluate \(\displaystyle \int x e^x\,dx\text{.}\)
The integrand contains an Algebraic term (\(x\)) and an Exponential term (\(e^x\)). Our mnemonic suggests letting \(u\) be the algebraic term, so we choose \(u=x\) and \(dv=e^x\,dx\text{.}\) Then \(du=dx\) and \(v=e^x\) as indicated by the tables below.
\begin{align*} u\amp = x \amp v\amp =\mathord{?}\\ du\amp = \mathord{?} \amp dv\amp =e^x \, dx \end{align*}
\begin{align*} u\amp = x \amp v\amp =e^x\\ du\amp = dx \amp dv\amp =e^x \, dx \end{align*}
Figure 6.2.5. Setting up Integration by Parts
We see \(du\) is simpler than \(u\text{,}\) while there is no change in going from \(dv\) to \(v\text{.}\) This is good. The Integration by Parts formula gives
\begin{equation*} \int x e^x\,dx = xe^x - \int e^x\,dx\text{.} \end{equation*}
The integral on the right is simple; our final answer is
\begin{equation*} \int xe^x\, dx = xe^x - e^x + C\text{.} \end{equation*}
Note again how the antiderivatives contain a product term.

Example 6.2.6. Integrating using Integration by Parts.

Evaluate \(\displaystyle \int x^2\cos(x) \,dx\text{.}\)
The mnemonic suggests letting \(u=x^2\) instead of the trigonometric function, hence \(dv=\cos(x)\,dx\text{.}\) Then \(du=2x\,dx\) and \(v=\sin(x)\) as shown below.
\begin{align*} u\amp = x^2 \amp v\amp =\mathord{?}\\ du\amp = \mathord{?} \amp dv\amp =\cos(x) \, dx \end{align*}
\begin{align*} u\amp = x^2 \amp v\amp =\sin(x)\\ du\amp = 2x\, dx \amp dv\amp =\cos(x) \, dx \end{align*}
Figure 6.2.7. Setting up Integration by Parts
The Integration by Parts formula gives
\begin{equation*} \int x^2\cos(x)\,dx = x^2\sin(x) - \int 2x\sin(x)\,dx\text{.} \end{equation*}
At this point, the integral on the right is indeed simpler than the one we started with, but to evaluate it, we need to do Integration by Parts again. Here we choose \(r=2x\) and \(ds=\sin(x)\) and fill in the rest below. (We are choosing new names since we have already used \(u\) and \(v\text{.}\) Our integration by parts formula is now \(\int r\,ds=rs-\int s\,dr\text{.}\))
\begin{align*} u\amp = 2x \amp v\amp =\text{?}\\ du\amp = \text{?} \amp dv\amp =\sin(x)\, dx \end{align*}
\begin{align*} u\amp = 2x \amp v\amp =-\cos(x)\\ du\amp = 2\, dx \amp dv\amp =\sin(x)\, dx \end{align*}
Figure 6.2.8. Setting up Integration by Parts (again)
\begin{equation*} \int x^2\cos(x)\,dx = x^2\sin(x) - \left(-2x\cos(x) - \int -2\cos(x)\,dx\right)\text{.} \end{equation*}
The integral all the way on the right is now something we can evaluate. It evaluates to \(-2\sin(x)\text{.}\) Then going through and simplifying, being careful to keep all the signs straight, our answer is
\begin{equation*} \int x^2\cos(x)\, dx = x^2\sin(x) + 2x\cos(x) - 2\sin(x) + C\text{.} \end{equation*}

Example 6.2.9. Integrating using Integration by Parts.

Evaluate \(\displaystyle \int e^x\cos(x) \,dx\text{.}\)
This is a classic problem. Our mnemonic suggests letting \(u\) be the trigonometric function instead of the exponential. In this particular example, one can let \(u\) be either \(\cos(x)\) or \(e^x\text{;}\) to demonstrate that we do not have to follow LIATE, we choose \(u=e^x\) and hence \(dv = \cos(x)\,dx\text{.}\) Then \(du=e^x\,dx\) and \(v=\sin(x)\) as shown below.
\begin{align*} u\amp = e^x \amp v\amp =\mathord{?}\\ du\amp = \mathord{?} \amp dv\amp =\cos(x) \, dx \end{align*}
\begin{align*} u\amp = e^x \amp v\amp =\sin(x)\\ du\amp = e^x \amp dv\amp =\cos(x) \, dx \end{align*}
Figure 6.2.10. Setting up Integration by Parts
Notice that \(du\) is no simpler than \(u\text{,}\) going against our general rule (but bear with us). The Integration by Parts formula yields
\begin{equation*} \int e^x\cos(x)\, dx = e^x\sin(x) - \int e^x\sin(x)\,dx\text{.} \end{equation*}
The integral on the right is not much different than the one we started with, so it seems like we have gotten nowhere. Let’s keep working and apply Integration by Parts to the new integral, using \(u=e^x\) and \(dv = \sin(x)\,dx\text{.}\) This leads us to the following:
\begin{align*} r\amp = e^x \amp s\amp =\mathord{?}\\ dr\amp = \mathord{?} \amp ds\amp =\sin(x) \, dx \end{align*}
\begin{align*} r\amp = e^x \amp s\amp =-\cos(x)\\ dr\amp = e^x\, dx \amp ds\amp =\sin(x) \, dx \end{align*}
Figure 6.2.11. Setting up Integration by Parts (again)
The Integration by Parts formula then gives:
\begin{align*} \int e^x\cos(x)\,dx \amp = e^x\sin(x) - \left(-e^x\cos(x) - \int -e^x\cos(x)\,dx\right)\\ \amp = e^x\sin(x)+ e^x\cos(x) - \int e^x\cos(x)\, dx\text{.} \end{align*}
It seems we are back right where we started, as the right hand side contains \(\int e^x\cos(x)\,dx\text{.}\) But this is actually a good thing.
Add \(\ds\int e^x\cos(x)\, dx\) to both sides. This gives
\begin{align*} 2\int e^x\cos(x) \, dx \amp = e^x\sin(x) + e^x\cos(x)\\ \end{align*}

Now divide both sides by 2 and then add the integration constant:

\begin{align*} \int e^x\cos(x) \, dx \amp = \frac{1}{2}\big(e^x\sin(x) + e^x\cos(x) \big)+C\text{.} \end{align*}
Simplifying a little, our answer is thus
\begin{equation*} \int e^x\cos(x)\, dx = \frac12e^x\left(\sin(x) + \cos(x)\right)+C\text{.} \end{equation*}

Example 6.2.12. Integrating using Integration by Parts: antiderivative of \(\ln(x)\).

Evaluate \(\int \ln(x)\,dx\text{.}\)
One may have noticed that we have rules for integrating the familiar trigonometric functions and \(e^x\text{,}\) but we have not yet given a rule for integrating \(\ln(x)\text{.}\) That is because \(\ln(x)\) can’t easily be integrated with any of the rules we have learned up to this point. But we can find its antiderivative by a clever application of Integration by Parts. Set \(u=\ln(x)\) and \(dv=dx\text{.}\) This is a good, sneaky trick to learn as it can help in other situations. This determines \(du=(1/x)\,dx\) and \(v=x\) as shown below.
\begin{align*} u\amp = \ln(x) \amp v\amp =\mathord{?}\\ du\amp = \mathord{?} \amp dv\amp =1 \, dx \end{align*}
\begin{align*} u\amp = \ln(x) \amp v\amp =x\\ du\amp = 1/x\, dx \amp dv\amp =1 \, dx \end{align*}
Figure 6.2.13. Setting up Integration by Parts
Putting this all together in the Integration by Parts formula, things work out very nicely:
\begin{equation*} \int \ln(x)\,dx = x\ln(x) - \int x\,\frac1x\,dx\text{.} \end{equation*}
The new integral simplifies to \(\int 1\,dx\text{,}\) which is about as simple as things get. Its integral is \(x+C\) and our answer is
\begin{equation*} \int \ln(x) \, dx = x\ln(x) - x + C\text{.} \end{equation*}

Example 6.2.14. Integrating using Int. by Parts: antiderivative of \(\arctan x\).

Evaluate \(\displaystyle \int \arctan x \,dx\text{.}\)
The same sneaky trick we used above works here. Let \(u=\arctan x\) and \(dv=dx\text{.}\) Then \(du=1/(1+x^2)\,dx\) and \(v=x\text{.}\) The Integration by Parts formula gives
\begin{equation*} \int \arctan x \,dx = x\arctan x - \int \frac x{1+x^2}\,dx\text{.} \end{equation*}
The integral on the right can be solved by substitution. Taking \(w=1+x^2\text{,}\) we get \(dw=2x\,dx\text{.}\) The integral then becomes
\begin{equation*} \int \arctan x \,dx = x\arctan x - \frac12\int \frac 1{w}\,dw\text{.} \end{equation*}
The integral on the right evaluates to \(\ln\abs{w}+C\text{,}\) which becomes \(\ln(1+x^2)+C\) (we can drop the absolute values as \(1+x^2\) is always positive). Therefore, the answer is
\begin{equation*} \int \arctan x\, dx = x\arctan x - \frac12\ln(1+x^2) + C\text{.} \end{equation*}

Substitution Before Integration.

When taking derivatives, it was common to employ multiple rules (such as using both the Quotient and the Chain Rules). It should then come as no surprise that some integrals are best evaluated by combining integration techniques. In particular, here we illustrate making an “unusual” substitution first before using Integration by Parts.

Example 6.2.15. Integration by Parts after substitution.

Evaluate \(\ds \int \cos(\ln(x))\, dx\text{.}\)
The integrand contains a composition of functions, leading us to think Substitution would be beneficial. Letting \(u=\ln(x)\text{,}\) we have \(du = 1/x\, dx\text{.}\) This seems problematic, as we do not have a \(1/x\) in the integrand. But consider:
\begin{equation*} du = \frac 1x\, dx \quad \Rightarrow \quad x\cdot du = dx\text{.} \end{equation*}
Since \(u = \ln(x)\text{,}\) we can use inverse functions and conclude that \(x = e^u\text{.}\) Therefore we have that
\begin{align*} dx \amp = x\cdot du\\ \amp = e^u\, du\text{.} \end{align*}
We can thus replace \(\ln(x)\) with \(u\) and \(dx\) with \(e^u\, du\text{.}\) Thus we rewrite our integral as
\begin{equation*} \int \cos(\ln(x))\, dx = \int e^u\cos u \, du\text{.} \end{equation*}
We evaluated this integral on the right in Example 6.2.9. (This integral can also be found in a table of integrals). Using the result there, we have:
\begin{align*} \int \cos(\ln(x) )\, dx \amp = \int e^u\cos(u) \, du\\ \amp = \frac12e^u\big(\sin(u) + \cos(u) \big) + C\\ \amp = \frac12e^{\ln(x) } \big(\sin(\ln(x) ) + \cos(\ln(x) )\big)+C\\ \amp = \frac12x \big(\sin(\ln(x) ) + \cos(\ln(x) )\big)+C\text{.} \end{align*}

Definite Integrals and Integration By Parts.

So far we have focused only on evaluating indefinite integrals. Of course, we can use Integration by Parts to evaluate definite integrals as well, as Theorem 6.2.1 states. We do so in the next example.

Example 6.2.16. Definite integration using Integration by Parts.

Evaluate \(\displaystyle \int_1^2 x^2 \ln(x) \,dx\text{.}\)
Our mnemonic suggests letting \(u=\ln(x)\text{,}\) hence \(dv =x^2\,dx\text{.}\) We then get \(du = (1/x)\,dx\) and \(v=x^3/3\) as shown below.
\begin{align*} u\amp = \ln(x) \amp v\amp =\text{?}\\ du\amp = \text{?} \amp dv\amp =x^2\, dx \end{align*}
\begin{align*} u\amp = \ln(x)\amp v\amp =x^3/3\\ du\amp = 1/x\, dx \amp dv\amp =x^2\, dx \end{align*}
Figure 6.2.17. Setting up Integration by Parts
The Integration by Parts formula then gives
\begin{align*} \int_1^2 x^2 \ln(x)\,dx \amp = \left.\frac{x^3}3\ln(x)\right|_1^2 - \int_1^2 \frac{x^3}{3}\,\frac 1x\,dx\\ \amp = \left.\frac{x^3}3\ln(x)\right|_1^2 - \int_1^2 \frac{x^2}{3}\,dx\\ \amp = \left.\frac{x^3}3\ln(x)\right|_1^2 - \left.\frac{x^3}{9}\right|_1^2\\ \amp = \left.\left(\frac{x^3}3\ln(x) - \frac{x^3}{9}\right)\right|_1^2\\ \amp = \left(\frac83\ln(2) - \frac89\right)-\left(\frac13\ln(1) - \frac19\right)\\ \amp = \frac83\ln(2) - \frac79\\ \amp \approx 1.07\text{.} \end{align*}
In general, Integration by Parts is useful for integrating certain products of functions, like \(\int x e^x\,dx\) or \(\int x^3\sin(x)\,dx\text{.}\) It is also useful for integrals involving logarithms and inverse trigonometric functions.
As stated before, integration is generally more difficult than derivation. We are developing tools for handling a large array of integrals, and experience will tell us when one tool is preferable/necessary over another. For instance, consider the three similar-looking integrals
\begin{equation*} \int xe^x\,dx, \qquad \int x e^{x^2}\,dx \qquad \text{ and } \qquad \int xe^{x^3}\,dx\text{.} \end{equation*}
While the first is calculated easily with Integration by Parts, the second is best approached with Substitution. Taking things one step further, the third integral has no answer in terms of elementary functions, so none of the methods we learn in calculus will get us the exact answer.
Integration by Parts is a very useful method, second only to Substitution. In the following sections of this chapter, we continue to learn other integration techniques. Section 6.3 focuses on handling integrals containing trigonometric functions.

Exercises Exercises

Terms and Concepts

  • True
  • False
Integration by Parts is useful in evaluating integrands that contain products of functions.
  • True
  • False
Integration by Parts can be thought of as the “opposite of the Chain Rule.”
For what is “LIATE” useful?
  • True
  • False
If the integral that results from Integration by Parts appears to also need Integration by Parts, then a mistake was made in the original choice of “\(u\)”.


Exercise Group.
Evaluate the given indefinite integral.
\(\ds \int x\sin(x) \, dx\)
\(\ds \int xe^{-x}\, dx\)
\(\ds \int x^2\sin(x) \, dx\)
\(\ds \int x^3\sin(x) \, dx\)
\(\ds \int xe^{x^2}\, dx\)
\(\ds \int x^3e^{x}\, dx\)
\(\ds \int xe^{-2x}\, dx\)
\(\ds \int e^x\sin(x) \, dx\)
\(\ds \int e^{2x}\cos(x) \, dx\)
\(\ds \int {e^{5x}\sin\mathopen{}\left(9x\right)}\, dx\)
\(\ds \int {e^{6x}\cos\mathopen{}\left(6x\right)}\, dx\)
\(\ds \int \sin(x) \cos(x) \, dx\)
\(\ds \int {\sin^{-1}\mathopen{}\left(x\right)}\, dx\)
\(\ds \int {\tan^{-1}\mathopen{}\left(8x\right)}\, dx\)
\(\ds \int x\tan^{-1}(x) \, dx\)
\(\ds \int {\cos^{-1}\mathopen{}\left(x\right)}\, dx\)
\(\ds \int x\ln(x) \, dx\)
\(\ds \int {\left(x-3\right)\ln\mathopen{}\left(x\right)}\, dx\)
\(\ds \int {x\ln\mathopen{}\left(x+1\right)}\, dx\)
\(\ds \int x\ln(x^2)\, dx\)
\(\ds \int x^2\ln(x) \, dx\)
\(\ds \int \left(\ln(x) \right)^2\, dx\)
\(\ds \int {\ln^{2}\mathopen{}\left(x+7\right)}\, dx\)
\(\ds \int x\sec^2(x) \, dx\)
\(\ds \int x\csc^2(x) \, dx\)
\(\ds \int {x\sqrt{x-6}}\, dx\)
\(\ds \int {x\sqrt{x^{2}-4}}\, dx\)
\(\ds \int \sec(x) \tan(x) \, dx\)
\(\ds \int x\sec(x) \tan(x) \, dx\)
\(\ds \int x\csc(x) \cot(x) \, dx\)
Exercise Group.
Evaluate the indefinite integral after first making a substitution.
\(\ds \int {\cos\mathopen{}\left(\ln\mathopen{}\left(x\right)\right)}\, dx\)
\(\ds \int {e^{2x}\cos\mathopen{}\left(e^{x}\right)}\, dx\)
\(\ds \int {\cos\mathopen{}\left(\sqrt{x}\right)}\, dx\)
\(\ds \int \ln(\sqrt{x})\, dx\)
\(\ds \int e^{\sqrt{x}}\, dx\)
\(\ds \int e^{\ln(x) }\, dx\)
Exercise Group.
Evaluate the definite integral. Note: the corresponding indefinite integral appears in Exercises
\(\ds \int_0^{\pi} x\sin(x) \, dx\)
\(\ds \int_{-2}^{1} {xe^{-x}} \, dx\)
\(\ds \int_{-\pi/3}^{\pi/3} {x^{2}\sin\mathopen{}\left(x\right)} \, dx\)
\(\ds \int_{-\pi/2}^{\pi/2} {x^{3}\sin\mathopen{}\left(x\right)} \, dx\)
\(\ds \int_{0}^{{\sqrt{\ln\mathopen{}\left(2\right)}}} {xe^{x^{2}}} \, dx\)
\(\ds \int_0^1 x^3e^{x}\, dx\)
\(\ds \int_{1}^{3} {xe^{-2x}} \, dx\)
\(\ds \int_{0}^{\pi/2} {e^{x}\sin\mathopen{}\left(x\right)} \, dx\)
\(\ds \int_{-\pi}^{\pi} {e^{2x}\cos\mathopen{}\left(x\right)} \, dx\)