Skip to main content

Section 3.1 Integration by Parts

Integration by parts is the counterpart to the product rule for differentiation, applied to antiderivatives.
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 the integral \(\int u\,dv\) whenever the integral \(\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.1.

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{.}\) According to Equation (3.1):
\begin{align*} \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{align*}

Checkpoint 3.2.

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{align*} \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{align*}

Checkpoint 3.3.

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.4.

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{align*} 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{align*}
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.5.

Compute \(\int e^x\cos(x)\,dx\) again using IBP, but this time start with \(u=\cos(x)\) and \(dv = e^x\,dx\text{.}\) Then, in the second application of IBP, use \(u=\sin(x)\) and \(dv = e^x\,dx\text{.}\)
What happens if we use \(u = e^x\text{,}\) \(dv = \cos(x)\,dx\) in the first application of IBP and then switch to \(u=\sin(x)\text{,}\) \(dv = e^x\,dx\) in the second application?
In some situations, IBP leads to relations called reduction formulas. For instance, using IBP, we can derive:
\begin{align*} \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 - (n-1)\int \sin^n(x)\,dx. \end{align*}
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.6.

As an example, let us compute the integral \(\int \sin^3(x)\,dx\text{.}\) Using the reduction formula with \(n=3\text{:}\)
\begin{align*} \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{align*}
See ExerciseΒ 3.5.3 for reduction formulas involving powers of other trigonometric functions.

Example 3.7.

ExampleΒ 3.1 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{align*} 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{align*}
For instance, applying this reduction formula for \(n=3\text{:}\)
\begin{align*} 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{align*}

Example 3.8.

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{align*} \int x\arctan(2x)\,dx &= \frac{x^2\arctan(2x)}{2} - \int \frac{x^2}{1+4x^2}\,dx. \end{align*}
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{gather*} \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{gather*}