Integration by Parts

by Justin Skycak on

We can apply integration by parts whenever an integral would be made simpler by differentiating some expression within the integral, at the cost of anti-differentiating another expression within the integral.

This post is a chapter in the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Integration by Parts. Justin Math: Calculus. https://justinmath.com/integration-by-parts/


Integration by parts is another technique for simplifying integrals. We can apply integration by parts whenever an integral would be made simpler by differentiating some expression within the integral, at the cost of anti-differentiating another expression within the integral. The formula for integration by parts is given below:

$\begin{align*} \int u \, dv = uv - \int v \, du \end{align*}$


The formula is really just a direct consequence of the product rule – we can obtain it by applying the product rule to a product $uv$, integrating with respect to $x$, and rearranging a bit.

$\begin{align*} \frac{d}{dx} \left[ uv \right] &= u\frac{dv}{dx} + v\frac{du}{dx} \\ \int \frac{d}{dx} \left[ uv \right] \, dx &= \int u\frac{dv}{dx} \, dx + \int v\frac{du}{dx} \, dx \\ uv &= \int u \, dv + \int v \, du \\ \int u \, dv &= uv - \int v \, du \end{align*}$


Demonstration

To see why integration by parts is useful, consider the integral $\int xe^x \, dx$. If we differentiate the $x$ term, then the term goes away, and if we integrate the $e^x$ term, the term stays the same. Therefore, by applying integration by parts, we can simplify the integral.

We choose $u=x$ and $dv = e^x \, dx$. Since $u=x$, we have $\frac{du}{dx}=1$, so $du=dx$. Since $dv = e^x \, dx$, we have $v = \int e^x \, dx = e^x$. (We ignore the constant of integration now because we’re saving it for the very end.) Substituting this information into the integration by parts formula, we are able to evaluate the integral.

$\begin{align*} \int x e^x \, dx &= xe^x - \int 1e^x \, dx \\ &= xe^x - \int e^x \, dx \\ &= xe^x - e^x + C \\ &= (x-1)e^x + C \end{align*}$


Repeated Application

Sometimes, we may have to perform integration by parts more than once.

For example, in the following integral, the first integration by parts reduces the $x^2$ to $2x$, and the second integration by parts reduces the $2x$ to $2$, which finally simplifies the integral to a point where we can solve it.

$\begin{align*} \int x^2 \sin x \, dx \end{align*}$


To start off, we choose $u=x^2$ and $dv = \sin x \, dx$. Then $du = 2x \, dx$ and $v = -\cos x$, and the integral simplifies a bit.

$\begin{align*} &\int x^2 \sin x \, dx \\ &= x^2 (-\cos x) - \int (-\cos x) 2x \, dx \\ &= -x^2 \cos x + \int 2x \cos x \, dx \end{align*}$


For the final round of integration by parts, we choose $u=2x$ and $dv = \cos x \, dx$. Then $du = 2 \, dx$ and $v = \sin x$, and the integral simplifies a bit more, to a point where we can solve it.

$\begin{align*} &= -x^2 \cos x + \left( 2x \sin x - \int 2 \sin x \, dx \right) \\ &= -x^2 \cos x + 2x \sin x + 2 \cos x + C \\ &= 2x \sin x + (2-x^2) \cos x + C \end{align*}$


Cyclic Cases

Other times, integration by parts will never simplify an integral to a point where it can be directly computed.

For example, in the integral

$\begin{align*} \int e^x \cos x \, dx \end{align*}$


differentiating the $e^x$ term will not reduce its complexity because it just stays $e^x$, and differentiating the $\cos x$ term will not reduce its complexity because it just flips back and forth between $\sin x$ and $\cos x$.

However, we can use integration by parts to set up a recurrence equation, which can be used to solve algebraically for the integral. Choosing $u=\cos x$ and $dv = e^x \, dx$ we have $du = -\sin x \, dx$ and $v=e^x$.

$\begin{align*} &\int e^x \cos x \, dx \\ &= e^x \cos x - \int -e^x \sin x \, dx \\ &= e^x \cos x + \int e^x \sin x \, dx \end{align*}$


We perform one more round of integration by parts with $u=\sin x$ and $dv = e^x \, dx$, so that we have $du = \cos x \, dx$ and $v = e^x$.

$\begin{align*} &= e^x \cos x + \left( e^x \sin x - \int e^x \cos x \, dx \right) \\ &= (\sin x + \cos x)e^x - \int e^x \cos x \, dx \end{align*}$


Now that the original integral has reappeared in our expression, we can solve for it algebraically.

$\begin{align*} \int e^x \cos x \, dx &= (\sin x + \cos x)e^x - \int e^x \cos x \, dx \\ 2 \int e^x \cos x \, dx &= (\sin x + \cos x)e^x \\ \int e^x \cos x \, dx &= \frac{1}{2} (\sin x + \cos x)e^x \end{align*}$


Then, since the integral is an indefinite integral, we just need to add a constant at the end.

$\begin{align*} \int e^x \cos x \, dx &= \frac{1}{2} (\sin x + \cos x)e^x + C \end{align*}$


Exercises

Use integration by parts to compute the following integrals. (You can view the solution by clicking on the problem.)

$\begin{align*} 1) \hspace{.5cm} \int x^2 e^x \, dx \end{align*}$
Solution:
$\begin{align*} (x^2-2x+2)e^x+C \end{align*}$


$\begin{align*} 2) \hspace{.5cm} \int x \ln x \, dx \end{align*}$
Solution:
$\begin{align*} \frac{1}{4}x^2(2 \ln x - 1) + C \end{align*}$


$\begin{align*} 3) \hspace{.5cm} \int (x+1) \cos x \, dx \end{align*}$
Solution:
$\begin{align*} (x+1)\sin x + \cos x + C \end{align*}$


$\begin{align*} 4) \hspace{.5cm} \int (2x^2-3x) e^x \, dx \end{align*}$
Solution:
$\begin{align*} (2x^2-7x+7)e^x + C \end{align*}$


$\begin{align*} 5) \hspace{.5cm} \int x^5e^{x^3} \, dx \end{align*}$
Solution:
$\begin{align*} \frac{1}{3} (x^3-1)e^{x^3} + C \end{align*}$


$\begin{align*} 6) \hspace{.5cm} \int e^x \sin x \, dx \end{align*}$
Solution:
$\begin{align*} \frac{1}{2}(\sin x - \cos x)e^x + C \end{align*}$


$\begin{align*} 7) \hspace{.5cm} \int \left( x \ln x \right)^2 \, dx \end{align*}$
Solution:
$\begin{align*} \frac{1}{27} x^3 \left[ 9(\ln x)^2 - 6 \ln x + 2 \right] + C \end{align*}$


$\begin{align*} 8) \hspace{.5cm} \int e^{2x} \sin \left( e^x \right) \, dx \end{align*}$
Solution:
$\begin{align*} \sin \left( e^x \right) - e^x \cos \left( e^x \right) + C \end{align*}$


$\begin{align*} 9) \hspace{.5cm} \int \arctan \left( \frac{1}{x} \right) \, dx \end{align*}$
Solution:
$\begin{align*} \frac{1}{2} \ln (x^2+1) + x \arctan \left( \frac{1}{x} \right) + C \end{align*}$


$\begin{align*} 10) \hspace{.5cm} \int \sin (2x) \cos (3x) \, dx \end{align*}$
Solution:
$\begin{align*} \frac{1}{2} \cos x - \frac{1}{10} \cos 5x + C \end{align*}$



This post is a chapter in the book Justin Math: Calculus. Suggested citation: Skycak, J. (2019). Integration by Parts. Justin Math: Calculus. https://justinmath.com/integration-by-parts/