# 6.2: Integration by Parts

\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

Here's a simple integral that we can't yet evaluate:

$$\int x\cos x \,dx.$$

It's a simple matter to take the derivative of the integrand using the Product Rule, but there is no Product Rule for integrals. However, this section introduces *Integration by Parts*, a method of integration that is based on the Product Rule for derivatives. It will enable us to evaluate this integral.

The Product Rule says that if \(u\) and \(v\) are functions of \(x\), then \((uv)' = u'v + uv'\). For simplicity, we've written \(u\) for \(u(x)\) and \(v\) for \(v(x)\). Suppose we integrate both sides with respect to \(x\). This gives

$$\int (uv)'\,dx = \int (u'v+uv')\,dx.$$

By the Fundamental Theorem of Calculus, the left side integrates to \(uv\). The right side can be broken up into two integrals, and we have

$$uv = \int u'v\,dx + \int uv'\,dx.$$

Solving for the second integral we have

$$\int uv'\,dx = uv - \int u'v\,dx.$$

Using differential notation, we can write \(du = u'(x)dx\) and \(dv=v'(x)dx\) and the expression above can be written as follows:

$$\int u\,dv = uv - \int v\,du.$$

This is the Integration by Parts formula. For reference purposes, we state this in a theorem.

Theorem \(\PageIndex{1}\): Integration by Parts

Let \(u\) and \(v\) be differentiable functions of \(x\) on an interval \(I\) containing \(a\) and \(b\). Then

$$\int u\ dv = uv - \int v\ du,$$

and *integration by parts*

$$\int_{x=a}^{x=b} u\ dv = uv\Big|_a^b - \int_{x=a}^{x=b}v\ du.$$

Let's try an example to understand our new technique.

Example \(\PageIndex{1}\): Integrating using Integration by Parts

Evaluate \(\int x\cos{x}\ dx\).

**Solution**

The key to Integration by Parts is to identify part of the integrand as "\(u\)" and part as "\(dv\)." Regular practice will help one make good identifications, and later we will introduce some principles that help. For now, let \(u=x\) and \(dv=\cos{x}\ dx\).

It is generally useful to make a small table of these values as done below. Right now we only know \(u\) and \(dv\) as shown on the left of Figure \(\PageIndex{1}\); on the right we fill in the rest of what we need. If \(u = x\), then \(du = dx\). Since \(dv = \cos x\ dx\), \(v\) is an antiderivative of \(\cos x\). We choose \(v = \sin x\).

**Figure \(\PageIndex{1}\):** Setting up integration by parts.

$$\int x\cos x\,dx = x\sin x - \int \sin x \,dx.$$

We can then integrate \(\sin x\) to get \(-\cos x + C\) and overall our answer is

$$\int x\cos x\ dx = x\sin x + \cos x + C.$$

Note how the antiderivative contains a product, \(x\sin x\). This product is what makes Integration by Parts necessary.

The example above demonstrates how Integration by Parts works in general. We try to identify \(u\) and \(dv\) in the integral we are given, and the key is that we usually want to choose \(u\) and \(dv\) so that \(du\) is simpler than \(u\) and \(v\) is hopefully not too much more complicated than \(dv\). This will mean that the integral on the right side of the Integration by Parts formula, \(\int v\,du\) will be simpler to integrate than the original integral \(\int u\,dv\).

In the example above, we chose \(u=x\) and \(dv=\cos x\,dx\). Then \(du=dx\) was simpler than \(u\) and \(v=\sin x\) is no more complicated than \(dv\). Therefore, instead of integrating \(x\cos x \,dx\), we could integrate \(\sin x\,dx\), which we knew how to do.

A useful mnemonic for helping to determine \(u\) is "LIATE," where

\[L = \textbf{L}ogarithmic, I = \textbf{I}nverse Trig., A = \textbf{A}lgebraic (polynomials),\]

\[T = \textbf{T}rigonometric, and E = \textbf{E}xponential.\]

If the integrand contains both a logarithmic and an algebraic term, in general letting \(u\) be the logarithmic term works best, as indicated by L coming before A in LIATE.

We now consider another example.

Example \(\PageIndex{2}\): Integrating using Integration by Parts

Evaluate \(\int x e^x\,dx\).

**Solution**

The integrand contains an **A**lgebraic term (\(x\)) and an \textbf{E}xponential term (\(e^x\)). Our mnemonic suggests letting \(u\) be the algebraic term, so we choose \(u=x\) and \(dv=e^x\,dx\). Then \(du=dx\) and \(v=e^x\) as indicated by the tables below.

**Figure \(\PageIndex{2}\):** Setting up Integration by Parts.

We see \(du\) is simpler than \(u\), while there is no change in going from \(dv\) to \(v\). This is good. The Integration by Parts formula gives

$$\int x e^x\,dx = xe^x - \int e^x\,dx.$$

The integral on the right is simple; our final answer is

$$\int xe^x\ dx = xe^x - e^x + C.$$

Note again how the antiderivatives contain a product term.

Example \(\PageIndex{3}\): Integrating using Integration by Parts

Evaluate \(\int x^2\cos x \,dx\).

**Solution**

The mnemonic suggests letting \(u=x^2\) instead of the trigonometric function, hence \(dv=\cos x\,dx\). Then \(du=2x\,dx\) and \(v=\sin x\) as shown below.

**Figure \(\PageIndex{3}\):** Setting up Integration by Parts.

The Integration by Parts formula gives

$$\int x^2\cos x\,dx = x^2\sin x - \int 2x\sin x\,dx.$$

At this point, the integral on the right is indeed simpler than the one we started with, but to evaluate it, we need to do Integration by Parts again. Here we choose \(u=2x\) and \(dv=\sin x\) and fill in the rest below.

**Figure \(\PageIndex{4}\):** Setting up Integration by Parts.

The integral all the way on the right is now something we can evaluate. It evaluates to \(-2\sin{x}\). Then going through and simplifying, being careful to keep all the signs straight, our answer is

$$\int x^2\cos x\ dx = x^2\sin x + 2x\cos x - 2\sin x + C.$$

Example \(\PageIndex{4}\): Integrating using Integration by Parts

Evaluate \(\int e^x\cos x \,dx\).

**Solution**

This is a classic problem. Our mnemonic suggests letting \(u\) be the trigonometric function instead of the exponential. In this particular example, one can let \(u\) be either \(\cos x\) or \(e^x\); to demonstrate that we do not have to follow LIATE, we choose \(u=e^x\) and hence \(dv = \cos x\,dx\). Then \(du=e^x\,dx\) and \(v=\sin x\) as shown below.

**Figure \(\PageIndex{5}\):** Setting up Integration by Parts.

Notice that \(du\) is no simpler than \(u\), going against our general rule (but bear with us). The Integration by Parts formula yields

$$\int e^x\cos x\ dx = e^x\sin x - \int e^x\sin x\,dx.$$

The integral on the right is not much different than the one we started with, so it seems like we have gotten nowhere. Let's keep working and apply Integration by Parts to the new integral, using \(u=e^x\) and \(dv = \sin x\,dx\). This leads us to the following:

**Figure \(\PageIndex{6}\)**: Setting up Integration by Parts.

The Integration by Parts formula then gives:

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

It seems we are back right where we started, as the right hand side contains \(\int e^x\cos x\,dx\). But this is actually a good thing.

Add \(\int e^x\cos x\ dx\) to both sides. This gives

\[\begin{align*} 2\int e^x\cos x\ dx & = e^x\sin x + e^x\cos x \\ \text{Now divide both sides by 2:}

\int e^x\cos x\ dx & = \frac{1}{2}\big(e^x\sin x + e^x\cos x\big).\end{align*}\]

Simplifying a little and adding the constant of integration, our answer is thus

$$\int e^x\cos x\ dx = \frac12e^x\left(\sin x + \cos x\right)+C.$$

Example \(\PageIndex{5}\): Integrating using Integration by Parts: antiderivative of \(\ln x\)

Evaluate \(\int \ln x\,dx\).

**Solution**

One may have noticed that we have rules for integrating the familiar trigonometric functions and \(e^x\), but we have not yet given a rule for integrating \(\ln x\). That is because \(\ln x\) can't easily be integrated with any of the rules we have learned up to this point. But we can find its antiderivative by a clever application of Integration by Parts. Set \(u=\ln x\) and \(dv=dx\). This is a good, sneaky trick to learn as it can help in other situations. This determines \(du=(1/x)\,dx\) and \(v=x\) as shown below.

**Figure \(\PageIndex{7}\):** Setting up Integration by Parts.

Putting this all together in the Integration by Parts formula, things work out very nicely:

$$\int \ln x\,dx = x\ln x - \int x\,\frac1x\,dx.$$

The new integral simplifies to \(\int 1\,dx\), which is about as simple as things get. Its integral is \(x+C\) and our answer is

$$\int \ln x\ dx = x\ln{x} - x + C.$$

Example \(\PageIndex{6}\): Integrating using Int. by Parts: antiderivative of \(\arctan x\)

Evaluate \(\int \arctan x \,dx\).

**Solution**

The same sneaky trick we used above works here. Let \(u=\arctan x\) and \(dv=dx\). Then \(du=1/(1+x^2)\,dx\) and \(v=x\). The Integration by Parts formula gives

$$\int \arctan x \,dx = x\arctan x - \int \frac x{1+x^2}\,dx.$$

The integral on the right can be solved by substitution. Taking \(u=1+x^2\), we get \(du=2x\,dx\). The integral then becomes

$$\int \arctan x \,dx = x\arctan x - \frac12\int \frac 1{u}\,du.$$

The integral on the right evaluates to \(\ln|u|+C\), which becomes \(\ln(1+x^2)+C\). Therefore, the answer is

$$\int \arctan x\ dx = x\arctan x - \ln(1+x^2) + C.$$

### Substitution Before Integration

When taking derivatives, it was common to employ multiple rules (such as using both the Quotient and the Chain Rules). It should then come as no surprise that some integrals are best evaluated by combining integration techniques. In particular, here we illustrate making an "unusual" substitution first before using Integration by Parts.

Example \(\PageIndex{7}\): Integration by Parts after substitution

Evaluate \(\int \cos(\ln x)\ dx\).

**Solution**

The integrand contains a composition of functions, leading us to think Substitution would be beneficial. Letting \(u=\ln x\), we have \(du = 1/x\ dx\). This seems problematic, as we do not have a \(1/x\) in the integrand. But consider:

$$du = \frac 1x\ dx \Rightarrow x\cdot du = dx.$$

Since \(u = \ln x\), we can use inverse functions and conclude that \(x = e^u\). Therefore we have that

\[\begin{align*} dx &= x\cdot du \\ &= e^u\ du.\end{align*}\]

We can thus replace \(\ln x\) with \(u\) and \(dx\) with \(e^u\ du\). Thus we rewrite our integral as

$$\int \cos(\ln x)\ dx = \int e^u\cos u \ du.$$

We evaluated this integral in Example \(\PageIndex{4}\). Using the result there, we have:

\[\begin{align*}\int \cos(\ln x)\ dx &= \int e^u\cos u \ du \\ &= \frac12e^u\big(\sin u + \cos u\big) + C \\&= \frac12e^{\ln x} \big(\sin(\ln x) + \cos (\ln x)\big)+C\\ &= \frac12x \big(\sin(\ln x) + \cos (\ln x)\big)+C.\end{align*}\]

### Definite Integrals and Integration By Parts

So far we have focused only on evaluating indefinite integrals. Of course, we can use Integration by Parts to evaluate definite integrals as well, as Theorem \(\PageIndex{1}\) states. We do so in the next example.

Example \(\PageIndex{8}\): Definite integration using Integration by Parts

Evaluate \(\int_1^2 x^2 \ln x \,dx\).

**Solution**

Our mnemonic suggests letting \(u=\ln x\), hence \(dv =x^2\,dx\).

We then get \(du = (1/x)\,dx\) and \(v=x^3/3\) as shown below.

**Figure \(\PageIndex{8}\):** Setting up Integration by Parts.

The Integration by Parts formula then gives

\[\begin{align*} \int_1^2 x^2 \ln x\,dx &= \frac{x^3}3\ln x\bigg|_1^2 - \int_1^2 \frac{x^3}{3}\,\frac 1x\,dx \\&= \frac{x^3}3\ln x\bigg|_1^2 - \int_1^2 \frac{x^2}{3}\,dx \\ &= \frac{x^3}3\ln x\bigg|_1^2 - \frac{x^3}{9}\bigg|_1^2\\&= \left(\frac{x^3}3\ln x - \frac{x^3}{9}\right)\bigg|_1^2\\ &= \left(\frac83\ln 2 - \frac89\right)-\left(\frac13\ln 1 - \frac19\right) \\ &= \frac83\ln 2 - \frac79 \\ &\approx 1.07.\end{align*}\]

In general, Integration by Parts is useful for integrating certain products of functions, like \(\int x e^x\,dx\) or \(\int x^3\sin x\,dx\). It is also useful for integrals involving logarithms and inverse trigonometric functions.

As stated before, integration is generally more difficult than derivation. We are developing tools for handling a large array of integrals, and experience will tell us when one tool is preferable/necessary over another. For instance, consider the three similar--looking integrals

$$\int xe^x\,dx, \qquad \int x e^{x^2}\,dx \qquad \text{and} \qquad \int xe^{x^3}\,dx.$$

While the first is calculated easily with Integration by Parts, the second is best approached with Substitution. Taking things one step further, the third integral has no answer in terms of elementary functions, so none of the methods we learn in calculus will get us the exact answer.

Integration by Parts is a very useful method, second only to substitution. In the following sections of this chapter, we continue to learn other integration techniques. The next section focuses on handling integrals containing trigonometric functions.

### Contributors

Gregory Hartman (Virginia Military Institute). Contributions were made by Troy Siemers and Dimplekumar Chalishajar of VMI and Brian Heinold of Mount Saint Mary's University. This content is copyrighted by a Creative Commons Attribution - Noncommercial (BY-NC) License. http://www.apexcalculus.com/

Integrated by Justin Marshall.