Skip to main content

Section 3.1 Integration by Parts

Integration by parts is the anti-derivative version of the product rule.
Recall the differential form version of the product rule looks like
\begin{equation*} d(uv) = udv + vdu. \end{equation*}
Taking indefinite integral on both sides and rearranging terms yields an equation between two classes of functions:
\begin{equation} \int u dv = uv - \int vdu. \tag{3.1} \end{equation}
It will be helpful for working out \(\int udv\) if, say, finding \(\int vdu\) is easier.
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. \label{eq_IBP-var} \end{equation*}
Also, 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 = u(x)v(x)\biggr\rvert_a^b - \int_a^b v(x)u'(x)\ dx. \end{equation*}

Example 3.1.

Let us use integration by parts to work out the indefinite integral \(\int \ln(x)\ dx\text{.}\) Comparing \(\ln(x)dx\) with \(udv\text{,}\) we can set \(u=\ln(x)\) and \(dv = dx\text{.}\) Clearly, \(v(x)=x\) is a function with \(dv=dx\text{.}\) Now according to Equation (3.1)
\begin{align*} \int \ln(x) dx & = x\ln(x) - \int x d\ln(x) \\ & = x\ln(x) - \int x \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.
\(u=x\)\(dv = \cos(x)dx\text{.}\)\(v(x)\)\(dv = \cos(x)dx\)\(\int \cos(x)dx\text{.}\)\(\frac{d}{dx} \sin(x) = \cos(x)\text{,}\)\(v=\sin(x)\text{.}\)(3.1)
\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 we take \(v = \sin(x)\text{.}\) So IBP yields,
\begin{equation*} \int e^x \cos(x) dx = e^x\sin(x) - \int e^x \sin(x)dx. \end{equation*}
At the first glance, we are getting nowhere since computing \(\int e^x \sin(x) dx\) is as hard as the original problem. However, applying IBP once more time with \(u=e^x\) and \(dv = \sin(x)\text{,}\) we get
\begin{equation*} \int e^x \sin(x)dx = -e^x \cos(x) + \int e^x \cos(x)dx \end{equation*}
For simplicity in notation, denote the integrals \(\int e^x \cos(x) dx\) and \(\int e^x \sin(x) dx \) by \(I_c\) and \(I_s\text{,}\) respectively. Then the two equation 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*}
Solving for \(I_c\) and \(I_s\) from them, get us
\begin{equation*} I_c = \frac{e^x}{2}(\sin(x) + \cos(x)) + C,\ 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 with \(u=\cos(x)\) and \(dv = e^x dx\text{.}\) (See also Exercise 3.5.5.) 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 use \(u=\sin(x)\text{,}\) and \(dv = e^x dx\) in the second application?
In some situations, IBP leads to relations called reduction formulas. For instance, using IBP we have
\begin{align*} \int \sin^n(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*}
Write \(S_k\) for the integral \(\int \sin^k(x)dx\) then the above relation can be rearranged as
\begin{equation} S_n = -\frac{1}{n}\sin^{n-1}(x) \cos(x) + \frac{n-1}{n}S_{n-2}. \tag{3.2} \end{equation}
Each application of (3.2) reduces to power of the integrand (in this case, by 2). Eventually, the problem becomes finding either \(I_1=\int \sin(x)dx\) (when \(n\) is odd) or \(I_0=\int dx\) (when \(n\) is even). Both of them we know how to solve.

Example 3.6.

As an example, let us compute the integral \(\int \sin^3(x) dx\text{.}\) For \(n=3\text{,}\) the reduction (3.2) reads
\begin{align*} \int \sin^3(x)dx &= I_3 = -\frac{1}{3}\sin^2(x)\cos(x) + \frac{2}{3}I_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 for powers of other trigonometric functions.

Example 3.7.

Example 3.1 naturally needs to the following reduction formula for the integral of powers of \(\ln(x)\text{.}\) Let us write \(L_n\) for the integral \(\ds \int (\ln(x))^n dx\text{.}\) Then
\begin{align*} L_n & = x(\ln(x))^n - \int xd(\ln(x))^n \\ &= x(\ln(x))^n - \int x n(\ln(x))^{n-1} \frac{1}{x} dx \\ &= x(\ln(x))^n - nL_{n-1}. \end{align*}
For instance, applying the reduction formula to \(n=3\text{,}\) we get
\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 + 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 antiderivates of \(\arctan(2x)\) is not readily available, this prompts us to try \(u=\arctan(2x)\) and \(dv = xdx\text{.}\) So, \(du = \dfrac{2 dx}{1+4x^2}\) and we can take \(v=x^2/2\) (this may seem odd at the first glance since the degree of \(x\) in the resulting integral is higher). Thus,
\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 carry out the division and get
\begin{equation*} \frac{x^2}{1+4x^2} = \frac{1}{4} \left(1 - \frac{1}{1+4x^2} \right). \end{equation*}
From the expression on the right hand side, one recognizes \(\frac{1}{4}\left(x - \frac{1}{2}\arctan(2x)\right)\) is an anit-derivative. Therefore, the original indefinite integral is evaluated to
\begin{gather*} \frac{x^2\arctan(2x)}{2} - \frac{x}{4} + \frac{1}{8}\arctan(2x)+C. \end{gather*}