# Integration by Parts

*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 part of a series.*

**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:

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.

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

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

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.

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.

## 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

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

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

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

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

## 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 part of a series.*