# 5.4: Integration by Parts

- Page ID
- 107826

- How do we evaluate indefinite integrals that involve products of basic functions such as \(\int x \sin(x) \, dx\) and \(\int x e^x \, dx\text{?}\)
- What is the method of integration by parts and how can we consistently apply it to integrate products of basic functions?
- How does the algebraic structure of functions guide us in identifying \(u\) and \(dv\) in using integration by parts?

In Section 5.3, we learned the technique of \(u\)-substitution for evaluating indefinite integrals. For example, the indefinite integral \(\int x^3 \sin(x^4) \, dx\) is perfectly suited to \(u\)-substitution, because one factor is a composite function and the other factor is the derivative (up to a constant) of the inner function. Recognizing the algebraic structure of a function can help us to find its antiderivative.

Next we consider integrands with a different elementary algebraic structure: a product of basic functions. For instance, suppose we are interested in evaluating the indefinite integral

\[ \int x \sin(x) \, dx\text{.} \nonumber \]

The integrand is the product of the basic functions \(f(x) = x\) and \(g(x) = \sin(x)\text{.}\) We know that it is relatively complicated to compute the derivative of the product of two functions, so we should expect that antidifferentiating a product should be similarly involved. Intuitively, we expect that evaluating \(\int x \sin(x) \, dx\) will involve somehow reversing the Product Rule.

To that end, in Preview Activity \(\PageIndex{1}\) we refresh our understanding of the Product Rule and then investigate some indefinite integrals that involve products of basic functions.

In Section 2.3, we developed the Product Rule and studied how it is employed to differentiate a product of two functions. In particular, recall that if \(f\) and \(g\) are differentiable functions of \(x\text{,}\) then

- For each of the following functions, use the Product Rule to find the function's derivative. Be sure to label each derivative by name (e.g., the derivative of \(g(x)\) should be labeled \(g'(x)\)).
- \(\displaystyle g(x) = x\sin(x)\)
- \(\displaystyle h(x) = xe^x\)
- \(\displaystyle p(x) = x\ln(x)\)
- \(\displaystyle q(x) = x^2 \cos(x)\)
- \(\displaystyle r(x) = e^x \sin(x)\)

- Use your work in (a) to help you evaluate the following indefinite integrals. Use differentiation to check your work.
- \(\displaystyle \int xe^x + e^x \, dx\)
- \(\displaystyle \int e^x(\sin(x) + \cos(x)) \, dx\)
- \(\displaystyle \int 2x\cos(x) - x^2 \sin(x) \, dx\)
- \(\displaystyle \int x\cos(x) + \sin(x) \, dx\)
- \(\displaystyle \int 1 + \ln(x) \, dx\)

- Observe that the examples in (b) work nicely because of the derivatives you were asked to calculate in (a). Each integrand in (b) is precisely the result of differentiating one of the products of basic functions found in (a). To see what happens when an integrand is still a product but not necessarily the result of differentiating an elementary product, we consider how to evaluate
\[ \int x\cos(x) \, dx\text{.} \nonumber \]
- First, observe that
\[ \frac{d}{dx} \left[ x\sin(x) \right] = x\cos(x) + \sin(x)\text{.} \nonumber \]
Integrating both sides indefinitely and using the fact that the integral of a sum is the sum of the integrals, we find that

\[ \int \left(\frac{d}{dx} \left[ x\sin(x) \right] \right) \, dx = \int x\cos(x) \, dx + \int \sin(x) \, dx\text{.} \nonumber \]In this last equation, evaluate the indefinite integral on the left side as well as the rightmost indefinite integral on the right.

- In the most recent equation from (i.), solve the equation for the expression \(\int x \cos(x) \, dx\text{.}\)
- For which product of basic functions have you now found the antiderivative?

- First, observe that

## Reversing the Product Rule: Integration by Parts

Problem (c) in Preview Activity \(\PageIndex{1}\) provides a clue to the general technique known as Integration by Parts, which comes from reversing the Product Rule. Recall that the Product Rule states that

Integrating both sides of this equation indefinitely with respect to \(x\text{,}\) we find

On the left side of Equation (\(\PageIndex{1}\)), we have the indefinite integral of the derivative of a function. Temporarily omitting the constant that may arise, we have

We solve for the first indefinite integral on the left to generate the rule

Often we express Equation (\(\PageIndex{3}\)) in terms of the variables \(u\) and \(v\text{,}\) where \(u = f(x)\) and \(v = g(x)\text{.}\) In differential notation, \(du = f'(x) \, dx\) and \(dv = g'(x) \, dx\text{,}\) so we can state the rule for Integration by Parts in its most common form as follows:

\[ \int u \, dv = uv - \int v \, du\text{.} \nonumber \]

To apply integration by parts, we look for a product of basic functions that we can identify as \(u\) and \(dv\text{.}\) If we can antidifferentiate \(dv\) to find \(v\text{,}\) and evaluating \(\int v \, du\) is not more difficult than evaluating \(\int u \, dv\text{,}\) then this substitution usually proves to be fruitful. To demonstrate, we consider the following example.

Evaluate the indefinite integral

using integration by parts.

**Answer**-
When we use integration by parts, we have a choice for \(u\) and \(dv\text{.}\) In this problem, we can either let \(u = x\) and \(dv = \cos(x) \, dx\text{,}\) or let \(u = \cos(x)\) and \(dv = x \, dx\text{.}\) While there is not a universal rule for how to choose \(u\) and \(dv\text{,}\) a good guideline is this: do so in a way that \(\int v \, du\) is at least as simple as the original problem \(\int u \, dv\text{.}\)

This leads us to choose

^{ 1 }\(u = x\) and \(dv = \cos(x) \, dx\text{,}\) from which it follows that \(du = 1 \, dx\) and \(v = \sin(x)\text{.}\) With this substitution, the rule for integration by parts tells us that\[ \int x \cos(x) \, dx = x \sin(x) - \int \sin(x) \cdot 1 \, dx\text{.} \nonumber \]Observe that if we considered the alternate choice, and let \(u = \cos(x)\) and \(dv = x \, dx\text{,}\) then \(du = -\sin(x) \, dx\) and \(v = \frac{1}{2}x^2\text{,}\) from which we would write \(\int x\cos(x) \, dx = \frac{1}{2}x^2 \cos(x) - \int \frac{1}{2}x^2 (-\sin(x)) \, dx\text{.}\) Thus we have replaced the problem of integrating \(x \cos(x)\) with that of integrating \(\frac{1}{2}x^2 \sin(x)\text{;}\) the latter is clearly more complicated, which shows that this alternate choice is not as helpful as the first choice.All that remains to do is evaluate the (simpler) integral \(\int \sin(x) \cdot 1 \, dx\text{.}\) Doing so, we find

\[ \int x \cos(x) \, dx = x \sin(x) - (-\cos(x)) + C = x\sin(x) + \cos(x) + C\text{.} \nonumber \]Observe that when we get to the final stage of evaluating the last remaining antiderivative, it is at this step that we include the integration constant, \(+C\text{.}\)

The general technique of integration by parts involves trading the problem of integrating the product of two functions for the problem of integrating the product of two related functions. That is, we convert the problem of evaluating \(\int u \, dv\) to that of evaluating \(\int v \, du\text{.}\) This clearly shapes our choice of \(u\) and \(v\text{.}\) In Example \(\PageIndex{1}\), the original integral to evaluate was \(\int x \cos(x) \,dx\text{,}\) and through the substitution provided by integration by parts, we were instead able to evaluate \(\int \sin(x) \cdot 1 \, dx\text{.}\) Note that the original function \(x\) was replaced by its derivative, while \(\cos(x)\) was replaced by its antiderivative.

Evaluate each of the following indefinite integrals. Check each antiderivative that you find by differentiating.

- \(\displaystyle \int te^{-t} \, dt\)
- \(\displaystyle \int 4x \sin(3x) \, dx\)
- \(\displaystyle \int z \sec^2(z) \,dz\)
- \(\displaystyle \int x \ln(x) \, dx\)

## Some Subtleties with Integration by Parts

Sometimes integration by parts is not an obvious choice, but the technique is appropriate nonetheless. Integration by parts allows us to replace one function in a product with its derivative while replacing the other with its antiderivative. For instance, consider evaluating

Initially, this problem seems ill-suited to integration by parts, since there does not appear to be a product of functions present. But if we note that \(\arctan(x) = \arctan(x) \cdot 1\text{,}\) and realize that we know the derivative of \(\arctan(x)\) as well as the antiderivative of \(1\text{,}\) we see the possibility for the substitution \(u = \arctan(x)\) and \(dv = 1 \, dx\text{.}\) We explore this substitution further in Activity \(\PageIndex{3}\).

In a related problem, consider \(\int t^3 \sin(t^2) \, dt\text{.}\) Observe that there is a composite function present in \(\sin(t^2)\text{,}\) but there is not an obvious function-derivative pair, as we have \(t^3\) (rather than simply \(t\)) multiplying \(\sin(t^2)\text{.}\) In this problem we use both \(u\)-substitution and integration by parts. First we write \(t^3 = t \cdot t^2\) and consider the indefinite integral

We let \(z = t^2\) so that \(dz = 2t \, dt\text{,}\) and thus \(t \, dt = \frac{1}{2} \, dz\text{.}\) (We are using the variable \(z\) to perform a “\(z\)-substitution” first so that we may then apply integration by parts.) Under this \(z\)-substitution, we now have

The resulting integral can be evaluated by parts. This, too, is explored further in Activity \(\PageIndex{3}\).

These problems show that we sometimes must think creatively in choosing the variables for substitution in integration by parts, and that we may need to use substitution for an additional change of variables.

Evaluate each of the following indefinite integrals, using the provided hints.

- Evaluate \(\int \arctan(x) \, dx\) by using Integration by Parts with the substitution \(u = \arctan(x)\) and \(dv = 1 \, dx\text{.}\)
- Evaluate \(\int \ln(z) \,dz\text{.}\) Consider a similar substitution to the one in (a).
- Use the substitution \(z = t^2\) to transform the integral \(\int t^3 \sin(t^2) \, dt\) to a new integral in the variable \(z\text{,}\) and evaluate that new integral by parts.
- Evaluate \(\int s^5 e^{s^3} \, ds\) using an approach similar to that described in (c).
- Evaluate \(\int e^{2t} \cos(e^t) \, dt\text{.}\) You will find it helpful to note that \(e^{2t} = e^t \cdot e^t\text{.}\)

## Using Integration by Parts Multiple Times

Integration by parts is well suited to integrating the product of basic functions, allowing us to trade a given integrand for a new one where one function in the product is replaced by its derivative, and the other is replaced by its antiderivative. The goal in this trade of \(\int u \, dv\) for \(\int v \, du\) is that the new integral be simpler to evaluate than the original one. Sometimes it is necessary to apply integration by parts more than once in order to evaluate a given integral.

Evaluate \(\int t^2 e^t \, dt\text{.}\)

**Answer**-
Let \(u = t^2\) and \(dv = e^t \, dt\text{.}\) Then \(du = 2t \, dt\) and \(v = e^t\text{,}\) and thus

\[ \int t^2 e^t \, dt = t^2 e^t - \int 2t e^t \, dt\text{.} \nonumber \]The integral on the right side is simpler to evaluate than the one on the left, but it still requires integration by parts. Now letting \(u = 2t\) and \(dv = e^t \, dt\text{,}\) we have \(du = 2\, dt\) and \(v = e^t\text{,}\) so that

\[ \int t^2 e^t \, dt = t^2 e^t - \left( 2t e^t - \int 2 e^t \, dt \right)\text{.} \nonumber \](Note the parentheses, which remind us to distribute the minus sign to the entire value of the integral \(\int 2t e^t \, dt\text{.}\)) The final integral on the right is a basic one; evaluating that integral and distributing the minus sign, we find

\[ \int t^2 e^t \, dt = t^2 e^t - 2t e^t + 2 e^t + C\text{.} \nonumber \]

Of course, even more than two applications of integration by parts may be necessary. In the preceding example, if the integrand had been \(t^3e^t\text{,}\) we would have had to use integration by parts three times.

Next, we consider the slightly different scenario.

Evaluate \(\int e^t \cos(t) \, dt\text{.}\)

**Answer**-
We can choose to let \(u\) be either \(e^t\) or \(\cos(t)\text{;}\) we pick \(u = \cos(t)\text{,}\) and thus \(dv = e^t \, dt\text{.}\) With \(du = -\sin(t) \, dt\) and \(v = e^t\text{,}\) integration by parts tells us that

\[ \int e^t \cos(t) \, dt = e^t \cos(t) - \int e^t (-\sin(t))\, dt\text{,} \nonumber \]or equivalently that

\[ \int e^t \cos(t) \, dt = e^t \cos(t) + \int e^t \sin(t) \, dt\text{.}\label{xdY}\tag{\(\PageIndex{1}\)4} \]The new integral has the same algebraic structure as the original one. While the overall situation isn't necessarily better than what we started with, it hasn't gotten worse. Thus, we proceed to integrate by parts again. This time we let \(u = \sin(t)\) and \(dv = e^t \, dt\text{,}\) so that \(du = \cos(t) \, dt\) and \(v = e^t\text{,}\) which implies

\[ \int e^t \cos(t) \, dt = e^t \cos(t) + \left( e^t \sin(t) - \int e^t \cos(t) \, dt \right)\text{.}\label{dlh}\tag{\(\PageIndex{1}\)5} \]We seem to be back where we started, as two applications of integration by parts has led us back to the original problem, \(\int e^t \cos(t) \, dt\text{.}\) But if we look closely at Equation (\(\PageIndex{1}\)5), we see that we can use algebra to solve for the value of the desired integral. Adding \(\int e^t \cos(t) \, dt\) to both sides of the equation, we have

\[ 2 \int e^t \cos(t) \, dt = e^t \cos(t) + e^t \sin(t)\text{,} \nonumber \]and therefore

\[ \int e^t \cos(t) \, dt = \frac{1}{2} \left( e^t \cos(t) + e^t \sin(t) \right) + C\text{.} \nonumber \]Note that since we never actually encountered an integral we could evaluate directly, we didn't have the opportunity to add the integration constant \(C\) until the final step.

Evaluate each of the following indefinite integrals.

- \(\displaystyle \int x^2 \sin(x) \, dx\)
- \(\displaystyle \int t^3 \ln(t) \, dt\)
- \(\displaystyle \int e^z \sin(z) \, dz\)
- \(\displaystyle \int s^2 e^{3s} \, ds\)
- \(\int t \arctan(t) \,dt\) (
*Hint:*At a certain point in this problem, it is very helpful to note that \(\frac{t^2}{1+t^2} = 1 - \frac{1}{1+t^2}\text{.}\))

## Evaluating Definite Integrals Using Integration by Parts

We can use the technique of integration by parts to evaluate a definite integral.

Evaluate

\[ \int_0^{\pi/2} t\sin(t) \, dt\text{.} \nonumber \]

**Answer**-
One option is to find an antiderivative (using indefinite integral notation) and then apply the Fundamental Theorem of Calculus to find that

\begin{align*} \int_0^{\pi/2} t\sin(t) \, dt =\mathstrut & \left( -t \cos(t) + \sin(t) \right) \bigg\vert_0^{\pi/2}\\[4pt] =\mathstrut & \left( -\frac{\pi}{2} \cos(\frac{\pi}{2}) + \sin(\frac{\pi}{2}) \right) - \left( -0 \cos(0) + \sin(0) \right)\\[4pt] =\mathstrut & 1\text{.} \end{align*}Alternatively, we can apply integration by parts and work with definite integrals throughout. With this method, we must remember to evaluate the product \(uv\) over the given limits of integration. Using the substitution \(u = t\) and \(dv = \sin(t) \, dt\text{,}\) so that \(du = dt\) and \(v = -\cos(t)\text{,}\) we write

\begin{align*} \int_0^{\pi/2} t\sin(t) \, dt =\mathstrut & -t \cos(t) \bigg\vert_0^{\pi/2} - \int_0^{\pi/2} (-\cos(t)) \, dt\\[4pt] =\mathstrut & -t \cos(t) \bigg\vert_0^{\pi/2} + \sin(t) \bigg\vert_0^{\pi/2}\\[4pt] =\mathstrut & \left( -\frac{\pi}{2} \cos(\frac{\pi}{2}) + \sin(\frac{\pi}{2}) \right) - \left( -0 \cos(0) + \sin(0) \right)\\[4pt] =\mathstrut & 1\text{.} \end{align*}

As with any substitution technique, it is important to use notation carefully and completely, and to ensure that the end result makes sense.

## When \(u\)-substitution and Integration by Parts Fail to Help

Both integration techniques we have discussed apply in relatively limited circumstances. It is not hard to find examples of functions for which neither technique produces an antiderivative; indeed, there are many, many functions that appear elementary but that do not have an elementary algebraic antiderivative. For instance, neither \(u\)-substitution nor integration by parts proves fruitful for the indefinite integrals

While there are other integration techniques, some of which we will consider briefly, none of them enables us to find an algebraic antiderivative for \(e^{x^2}\) or \(x \tan(x)\text{.}\) We do know from the Second Fundamental Theorem of Calculus that we can construct an integral antiderivative for each function; \(F(x) = \int_0^x e^{t^2} \, dt\) is an antiderivative of \(f(x) = e^{x^2}\text{,}\) and \(G(x) = \int_0^{x} t \tan(t) \, dt\) is an antiderivative of \(g(x) = x \tan(x)\text{.}\) But finding an elementary algebraic formula that doesn't involve integrals for either \(F\) or \(G\) turns out not only to be impossible through \(u\)-substitution or integration by parts, but indeed impossible altogether. Antidifferentiation is much harder in general than differentiation.

## Summary

- Through the method of integration by parts, we can evaluate indefinite integrals that involve products of basic functions such as \(\int x \sin(x) \, dx\) and \(\int x \ln(x) \, dx\text{.}\) Using a substitution enables us to trade one of the functions in the product for its derivative, and the other for its antiderivative, in an effort to find a different product of functions that is easier to integrate.
- If the algebraic structure of an integrand is a product of basic functions in the form \(\int f(x) g'(x) \, dx\text{,}\) we can use the substitution \(u = f(x)\) and \(dv = g'(x) \,dx\) and apply the rule
\[ \int u \, dv = uv - \int v \, du \nonumber \]
to evaluate the original integral \(\int f(x) g'(x) \, dx\) by instead evaluating

\[ \int v \, du = \int f'(x) g(x) \, dx\text{.} \nonumber \] - When deciding to integrate by parts, we have to select both \(u\) and \(dv\text{.}\) That selection is guided by the overall principle that the new integral \(\int v \, du\) not be more difficult than the original integral \(\int u \, dv\text{.}\) In addition, it is often helpful to recognize if one of the functions present is much easier to differentiate than antidifferentiate (such as \(\ln(x)\)), in which case that function often is best assigned the variable \(u\text{.}\) In addition, \(dv\) must be a function that we can antidifferentiate.