Skip to main content

Section 3.1 Integration by Parts

Subsection 3.1.1 Overview

Integration by parts is the counterpart to the product rule for differentiation, applied to antiderivatives. It moves a derivative from one factor in a product to another factor when that change makes the resulting integral simpler.
Recall the product rule in differential form:
\begin{equation*} d(uv) = u\,dv + v\,du. \end{equation*}
Integrating both sides yields the following relationship between two integrals:
\begin{equation} \int u\,dv = uv - \int v\,du.\tag{3.1} \end{equation}
This formula is useful for evaluating \(\int u\,dv\) whenever \(\int v\,du\) is easier to compute.
By making the variable explicit, Equation (3.1) reads:
\begin{equation} \int u(x)v'(x)\,dx = u(x)v(x) - \int v(x)u'(x)\,dx.\tag{3.2} \end{equation}
When integration by parts can be applied (i.e., \(u(x)\) and \(v(x)\) are differentiable functions), it follows from the Fundamental Theorem of Calculus that the analogous relation holds for definite integrals:
\begin{equation*} \int_a^b u(x)v'(x)\,dx = \left. u(x)v(x) \right|_a^b - \int_a^b v(x)u'(x)\,dx. \end{equation*}

Example 3.2.

Let us compute the indefinite integral \(\int \ln(x)\,dx\) using integration by parts (IBP). Comparing \(\ln(x)\,dx\) with \(u\,dv\text{,}\) we set \(u=\ln(x)\) and \(dv = dx\text{.}\) Then \(du = \frac{1}{x}dx\) and we can choose \(v(x)=x\text{.}\) Applying Equation (3.1) gives
\begin{equation*} \begin{aligned} \int \ln(x)\,dx &= x\ln(x) - \int x\,d(\ln(x)) \\ &= x\ln(x) - \int x \cdot \frac{1}{x}\,dx \\ &= x\ln(x) - \int dx \\ &= x\ln(x) - x + C. \end{aligned} \end{equation*}

Checkpoint 3.3.

Find the indefinite integral \(\ds \int x\cos(x)\,dx\text{.}\)
Solution.
Set \(u=x\text{,}\) so \(du=dx\text{.}\) Let \(dv = \cos(x)\,dx\text{,}\) which implies \(v = \sin(x)\text{.}\) Applying IBP (3.1) yields:
\begin{equation*} \begin{aligned} \int x\cos(x)\,dx &= x\sin(x) - \int \sin(x)\,dx \\ &= x\sin(x) - (-\cos(x)) + C \\ &= x\sin(x) + \cos(x) + C. \end{aligned} \end{equation*}

Checkpoint 3.4.

Find the indefinite integral \(\ds \int x^2\sin(x)\,dx\text{.}\)
Hint.
Set \(u=x^2\) and \(dv = \sin(x)\,dx\text{.}\) Then apply IBP twice.

Example 3.5.

As another example, let us compute \(\int e^x \cos(x)\,dx\text{.}\) Let \(u = e^x\) and \(dv = \cos(x)\,dx\text{.}\) Then \(du = e^x\,dx\) and \(v = \sin(x)\text{.}\) Applying IBP yields:
\begin{equation*} \int e^x \cos(x)\,dx = e^x\sin(x) - \int e^x \sin(x)\,dx. \end{equation*}
At first glance, it seems we have made no progress since \(\int e^x \sin(x)\,dx\) appears as difficult as the original problem. However, applying IBP again to this new integral with \(u=e^x\) and \(dv = \sin(x)\,dx\) (so \(v = -\cos(x)\)), we get:
\begin{equation*} \int e^x \sin(x)\,dx = -e^x \cos(x) + \int e^x \cos(x)\,dx. \end{equation*}
For simplicity, let \(I_c = \int e^x \cos(x)\,dx\) and \(I_s = \int e^x \sin(x)\,dx\text{.}\) The equations above become:
\begin{equation*} \begin{cases} I_c &= e^x \sin(x) - I_s \\ I_s &= -e^x \cos(x) + I_c \end{cases} \end{equation*}
Substituting the second equation into the first:
\begin{equation*} \begin{aligned} I_c &= e^x \sin(x) - (-e^x \cos(x) + I_c) \\ I_c &= e^x \sin(x) + e^x \cos(x) - I_c \\ 2I_c &= e^x(\sin(x) + \cos(x)) \end{aligned} \end{equation*}
Solving for \(I_c\) (and similarly for \(I_s\)), we find:
\begin{equation*} I_c = \frac{e^x}{2}(\sin(x) + \cos(x)) + C, \quad I_s = \frac{e^x}{2}(\sin(x) - \cos(x)) + C. \end{equation*}

Checkpoint 3.6.

Recompute \(\int e^x\cos(x)\,dx\) by IBP. Start with \(u=\cos(x)\) and \(dv = e^x\,dx\text{.}\) In the second application, use \(u=\sin(x)\) and \(dv = e^x\,dx\text{.}\)
What happens if you begin with \(u = e^x\text{,}\) \(dv = \cos(x)\,dx\) and then switch to \(u=\sin(x)\text{,}\) \(dv = e^x\,dx\) in the second step?
In some situations, IBP leads to relations called reduction formulas. For instance, using IBP, we can derive:
\begin{equation*} \begin{aligned} \int \sin^n(x)\,dx &= -\sin^{n-1}(x)\cos(x) + (n-1)\int \sin^{n-2}(x)\cos^2(x)\,dx \\ &= -\sin^{n-1}(x)\cos(x) + (n-1)\int \sin^{n-2}(x)(1-\sin^2(x))\,dx \\ &= -\sin^{n-1}(x)\cos(x) + (n-1)\int \sin^{n-2}(x)\,dx \\ &\phantom{=}- (n-1)\int \sin^n(x)\,dx. \end{aligned} \end{equation*}
Let \(S_k = \int \sin^k(x)\,dx\text{.}\) Rearranging the terms gives:
\begin{equation} S_n = -\frac{1}{n}\sin^{n-1}(x)\cos(x) + \frac{n-1}{n}S_{n-2}.\tag{3.3} \end{equation}
Each application of (3.3) reduces the power of the integrand by 2. Eventually, the problem reduces to finding either \(I_1=\int \sin(x)\,dx\) (when \(n\) is odd) or \(I_0=\int dx\) (when \(n\) is even), both of which are elementary.

Example 3.7.

As an example, let us compute the integral \(\int \sin^3(x)\,dx\text{.}\) Using the reduction formula with \(n=3\text{:}\)
\begin{equation*} \begin{aligned} \int \sin^3(x)\,dx &= S_3 = -\frac{1}{3}\sin^2(x)\cos(x) + \frac{2}{3}S_1 \\ &= -\frac{1}{3}\sin^2(x)\cos(x) + \frac{2}{3}\int \sin(x)\,dx \\ &= -\frac{1}{3}\sin^2(x)\cos(x) - \frac{2}{3}\cos(x) + C. \end{aligned} \end{equation*}
See ExerciseΒ 3.5.3 for reduction formulas involving powers of other trigonometric functions.

Example 3.8.

ExampleΒ 3.2 naturally leads to the following reduction formula for the integral of powers of \(\ln(x)\text{.}\) Let \(L_n = \int (\ln(x))^n\,dx\text{.}\) Then:
\begin{equation*} \begin{aligned} L_n &= x(\ln(x))^n - \int x\,d((\ln(x))^n) \\ &= x(\ln(x))^n - \int x \cdot n(\ln(x))^{n-1} \cdot \frac{1}{x}\,dx \\ &= x(\ln(x))^n - nL_{n-1}. \end{aligned} \end{equation*}
For instance, applying this reduction formula for \(n=3\text{:}\)
\begin{equation*} \begin{aligned} L_3 &= x(\ln(x))^3 - 3L_2 \\ &= x(\ln(x))^3 - 3(x(\ln(x))^2 - 2L_1) \\ &= x(\ln(x))^3 - 3x(\ln(x))^2 + 6L_1 \\ &= x(\ln(x))^3 - 3x(\ln(x))^2 + 6(x\ln(x) - x) + C \\ &= x(\ln(x))^3 - 3x(\ln(x))^2 + 6x\ln(x) - 6x + C. \end{aligned} \end{equation*}

Example 3.9.

Let us find the integral \(\ds \int x\arctan(2x)\,dx\) using integration by parts. Since the antiderivative of \(\arctan(2x)\) is not readily available, we choose \(u=\arctan(2x)\) and \(dv = x\,dx\text{.}\)
Then \(du = \frac{2}{1+4x^2}\,dx\text{,}\) and we can take \(v=x^2/2\text{.}\) Applying IBP:
\begin{equation*} \begin{aligned} \int x\arctan(2x)\,dx &= \frac{x^2\arctan(2x)}{2} - \int \frac{x^2}{1+4x^2}\,dx. \end{aligned} \end{equation*}
To integrate the rational function \(\frac{x^2}{1+4x^2}\text{,}\) we perform algebraic manipulation:
\begin{equation*} \frac{x^2}{1+4x^2} = \frac{1}{4} \cdot \frac{4x^2}{1+4x^2} = \frac{1}{4} \left(\frac{1+4x^2-1}{1+4x^2}\right) = \frac{1}{4} \left(1 - \frac{1}{1+4x^2}\right). \end{equation*}
Thus,
\begin{equation*} \int \frac{x^2}{1+4x^2}\,dx = \frac{1}{4}\left(x - \frac{1}{2}\arctan(2x)\right). \end{equation*}
Therefore, the original indefinite integral is:
\begin{equation*} \begin{aligned} \frac{x^2\arctan(2x)}{2} - \left( \frac{x}{4} - \frac{1}{8}\arctan(2x) \right) + C \\ = \frac{x^2\arctan(2x)}{2} - \frac{x}{4} + \frac{1}{8}\arctan(2x) + C. \end{aligned} \end{equation*}

Checkpoint 3.10.

Compute the definite integral \(\ds \int_1^{\sqrt{3}} 9\arctan(1/x)\,dx\text{.}\)
Hint.
Use IBP with \(u=\arctan(1/x)\) and \(dv=9\,dx\text{.}\) Then simplify \(du\) and compute the resulting logarithmic integral.
Solution.
Let \(u=\arctan(1/x)\) and \(dv=9\,dx\text{.}\) Then \(v=9x\) and \(du= -\frac{1}{x^2+1}\,dx\) since \(\frac{d}{dx}\arctan(1/x)=\frac{-1/x^2}{1+(1/x)^2}=-\frac{1}{x^2+1}\text{.}\) By IBP,
\begin{equation*} \begin{aligned} \int_1^{\sqrt{3}} 9\arctan(1/x)\,dx &= \left. 9x\arctan(1/x) \right|_1^{\sqrt{3}} - \int_1^{\sqrt{3}} 9x\left(-\frac{1}{x^2+1}\right)\,dx \\ &= \left. 9x\arctan(1/x) \right|_1^{\sqrt{3}} + 9\int_1^{\sqrt{3}} \frac{x}{x^2+1}\,dx \\ &= \left. 9x\arctan(1/x) \right|_1^{\sqrt{3}} + \frac{9}{2}\left. \ln(x^2+1) \right|_1^{\sqrt{3}}. \end{aligned} \end{equation*}
Evaluate the boundary terms:
\begin{equation*} \arctan(1/\sqrt{3})=\pi/6,\quad \arctan(1)=\pi/4, \end{equation*}
so
\begin{equation*} \begin{aligned} \left. 9x\arctan(1/x) \right|_1^{\sqrt{3}} &= 9\left(\sqrt{3}\cdot \frac{\pi}{6} - \frac{\pi}{4}\right) \\ &= \frac{3\pi}{4}(2\sqrt{3}-3), \end{aligned} \end{equation*}
and
\begin{equation*} \frac{9}{2}\left. \ln(x^2+1) \right|_1^{\sqrt{3}} = \frac{9}{2}\ln\!\left(\frac{4}{2}\right)=\frac{9}{2}\ln 2. \end{equation*}
Therefore,
\begin{equation*} \int_1^{\sqrt{3}} 9\arctan(1/x)\,dx = \frac{3\pi}{4}(2\sqrt{3}-3) + \frac{9}{2}\ln 2. \end{equation*}