## Section2.4Integration by Parts

We have already seen in Section 2.2.2 that recognizing the Product Rule can be useful, when we noticed that

\begin{equation*} \int \sec^3u+\sec u \tan^2u\,du=\sec u \tan u\text{.} \end{equation*}

As with substitution, we do not have to rely on insight or cleverness to discover such antiderivatives; there is a technique that will often help to uncover the Product Rule called Integration by Parts.

\begin{equation*} {d\over dx}f(x)g(x)=f'(x)g(x)+f(x)g'(x)\text{.} \end{equation*}

We can apply integration to this equation and obtain

\begin{equation*} f(x)g(x)=\int f'(x)g(x)\,dx +\int f(x)g'(x)\,dx\text{,} \end{equation*}

and then rewrite this as

\begin{equation*} \int f(x)g'(x)\,dx=f(x)g(x)-\int f'(x)g(x)\,dx\text{.} \end{equation*}

This may not seem particularly useful at first glance, but it turns out that in many cases we have an integral of the form

\begin{equation*} \int f(x)g'(x)\,dx \end{equation*}

but that

\begin{equation*} \int f'(x)g(x)\,dx \end{equation*}

is easier to integrate.

This technique for turning one integral into another is called Integration by Parts, and is usually written in more compact form.

Note:

1. To use this technique we need to identify likely candidates for $u=f(x)$ and $dv=g'(x)\,dx\text{.}$ When choosing $u$ and $dv\text{,}$ keep in mind that we need to be able to readily find an antiderivative for $dv$ and that $du$ becomes simpler than $u\text{.}$ Simpler could mean the power is reduced by one degree, or the original integral appears on the right side, or ...

2. After we have applied Integration by Parts, we then need to integrate $\ds \int v\,du\text{.}$ There is a danger to fall into a circular trap by choosing as the part to integrate ($v$) the term in the differential ($du$) from the first application of Integration by Parts. This does not provide you with any new information, but instead brings you back to the original integral. For example: To evaluate $\ds \int x^2\sin x\,dx$ we choose

\begin{equation*} u=x^2 \text{ and } v=\sin x\,dx \text{ so that } du=2x\,dx \text{ and } dv=-\cos x\,dx\text{,} \end{equation*}

then

\begin{equation*} \int x^2\sin x\,dx = -x^2\cos x + 2\int x\cos x\,dx\text{.} \end{equation*}

If we ignore that the new integral is simpler than the original integral, which would tell us to continue in the same manner of selecting $u$ and $dv\text{,}$ we may fall into the circular trap of choosing

\begin{equation*} u=\cos x \text{ and } v=x\,dx \text{ so that } du=-\sin x\,dx \text{ and } dv=\frac{x^2}{2}\,dx\text{,} \end{equation*}

so that

\begin{equation*} \begin{split} \int x^2\sin x\,dx \amp = -x^2\cos x + 2\int x\cos x\,dx \\ \amp = -x^2\cos x + 2\left(\cos x \frac{x^2}{2} + \int \frac{x^2}{2}\sin x\,dx\right) \\ \amp = \int x^2 \sin x\,dx. \end{split} \end{equation*}

This shows that with our carelessness we have wasted our time and are back at the beginning.

###### Example2.32. Product of a Linear Function and Logarithm.

Evaluate $\ds\int x\ln x\,dx\text{.}$

Solution

Let $u=\ln x$ so $du=1/x\,dx\text{.}$ Then we must let $dv=x\,dx$ so $\ds v=x^2/2$ and

\begin{equation*} \begin{split} \int x\ln x\,dx\amp={x^2\ln x\over 2}-\int {x^2\over2}{1\over x}\,dx\\ \amp= {x^2\ln x\over 2}-\int {x\over2}\,dx={x^2\ln x\over 2}-{x^2\over4}+C.\end{split} \end{equation*}
###### Example2.33. Inverse Trigonometric Function.

Evaluate $\ds\int \sin^{-1} x \, dx\text{.}$

Solution

Let $u=\sin^{-1} x$ so

\begin{equation*} du=\frac{1}{\sqrt{1-x^2}}\, dx\text{.} \end{equation*}

Then we must let $dv=\,dx$ so $v=x\text{.}$ Therefore,

\begin{equation*} \int \sin^{-1} x\,dx = x\sin^{-1} x-\int \frac{x}{\sqrt{1-x^2}}\,dx\text{.} \end{equation*}

Now use substitution with $u = 1-x^2$ and $du = -2x\, dx\text{.}$ Then

\begin{equation*} \begin{split} \int \frac{x}{\sqrt{1-x^2}}\,dx \amp = -\frac{1}{2}\int\frac{1}{\sqrt u}\,du\\ \amp =-\sqrt{u}+C\\ \amp =-\sqrt{1-x^2}+C. \end{split} \end{equation*}

Altogether, we find that

\begin{equation*} \int \sin^{-1} x\,dx = x\sin^{-1} x+\sqrt{1-x^2}+C\text{.} \end{equation*}
###### Example2.34. Secant Cubed (again).

Evaluate $\ds\int\sec^3 x\,dx\text{.}$

Solution

Of course we already know the answer to this, but we needed to be clever to discover it. Here we'll use the new technique to discover the antiderivative. Let $u=\sec x$ and $\ds dv=\sec^2 x\,dx\text{.}$ Then $du=\sec x\tan x$ and $v=\tan x$ and

\begin{align*} \int\sec^3 x\,dx\amp = \sec x\tan x-\int \tan^2x\sec x\,dx\\ \amp = \sec x\tan x-\int (\sec^2x-1)\sec x\,dx\\ \amp = \sec x\tan x-\int \sec^3x\,dx +\int\sec x\,dx\text{.} \end{align*}

At first this looks useless—we're right back to $\ds \int\sec^3x\,dx\text{.}$ But looking more closely, we notice that we can add this integral to both sides and are left to deal with the integral $\ds \int \sec x\,dx\text{.}$

\begin{align*} \int\sec^3x\,dx\amp = \sec x\tan x-\int \sec^3x\,dx +\int\sec x\,dx\\ \int\sec^3x\,dx+\int \sec^3x\,dx\amp = \sec x\tan x +\int\sec x\,dx\\ 2\int\sec^3x\,dx\amp = \sec x\tan x +\int\sec x\,dx\\ \int\sec^3x\,dx\amp = {\sec x\tan x\over2} +{1\over2}\int\sec x\,dx \end{align*}

Now we use our knowledge of $\ds\int \sec x\,dx$ to conclude that

\begin{equation*} \int\sec^3 x\,dx = {\sec x\tan x\over2} +{\ln|\sec x+\tan x|\over2}+C\text{.} \end{equation*}
###### Example2.35. Product of a Polynomial and Trigonometric Function.

Evaluate $\ds\int x^2\sin x\,dx\text{.}$

Solution

Let $u=x^2\text{,}$ $dv=\sin x\,dx\text{;}$ then $du=2x\,dx$ and $v=-\cos x\text{.}$ Now

\begin{equation*} \ds \int x^2\sin x\,dx=-x^2\cos x+\int 2x\cos x\,dx\text{.} \end{equation*}

This is better than the original integral since the power of $x$ has been reduced by one degree, but we need to do Integration by Parts again. Let $u=2x\text{,}$ $dv=\cos x\,dx\text{;}$ then $du=2$ and $v=\sin x\text{,}$ and

\begin{align*} \int x^2\sin x\,dx\amp = -x^2\cos x+\int 2x\cos x\,dx\\ \amp = -x^2\cos x+ 2x\sin x - \int 2\sin x\,dx\\ \amp = -x^2\cos x+ 2x\sin x + 2\cos x + C\text{.} \end{align*}

### Subsection2.4.1Tabular Method

Such repeated use of Integration by Parts is fairly common, but it can be a bit tedious to accomplish, and it is easy to make errors, especially sign errors involving the subtraction in the formula. There is a nice tabular method to accomplish the calculation that minimizes the chance for error and speeds up the whole process. We illustrate with the previous example. Here is the table:

\begin{equation*} \begin{array}{ccc} \textbf{ sign} \amp u\amp dv\\\hline \text{+} \amp x^2 \amp \sin x \\ \text{-} \amp 2x \amp -\cos x \\ \text{+} \amp 2 \amp -\sin x \\ \text{-} \amp 0 \amp \cos x \end{array} \end{equation*}

To form this table, we start with $u$ at the top of the second column and repeatedly compute the derivative; starting with $dv$ at the top of the third column, we repeatedly compute the antiderivative. In the first column, we place a “$-$” in every second row. To form the second table we combine the first and second columns by ignoring the boundary; if you do this by hand, you may simply start with two columns and add a “$-$” to every second row.

Alternatively, we can use the following table:

To compute with this second table we begin at the top. Multiply the first entry in column $u$ by the second entry in column $dv$ to get $\ds -x^2\cos x\text{,}$ and add this to the integral of the product of the second entry in column $u$ and second entry in column $dv\text{.}$ This gives:

\begin{equation*} -x^2\cos x+\int 2x\cos x\,dx\text{,} \end{equation*}

or exactly the result of the first application of Integration by Parts. Since this integral is not yet easy, we return to the table. Now we multiply twice on the diagonal, $\ds (x^2)(-\cos x)$ and $(-2x)(-\sin x)$ and then once straight across, $(2)(-\sin x)\text{,}$ and combine these as

\begin{equation*} -x^2\cos x+2x\sin x-\int 2\sin x\,dx\text{,} \end{equation*}

giving the same result as the second application of Integration by Parts. While this integral is easy, we may return yet once more to the table. Now multiply three times on the diagonal to get $\ds (x^2)(-\cos x)\text{,}$ $(-2x)(-\sin x)\text{,}$ and $(2)(\cos x)\text{,}$ and once straight across, $(0)(\cos x)\text{.}$ We combine these as before to get

\begin{equation*} -x^2\cos x+2x\sin x +2\cos x+\int 0\,dx= -x^2\cos x+2x\sin x +2\cos x+C\text{.} \end{equation*}

Typically we would fill in the table one line at a time, until the “straight across” multiplication gives an easy integral. If we can see that the $u$ column will eventually become zero, we can instead fill in the whole table; computing the products as indicated will then give the entire integral, including the “$+C$”, as above.

##### Exercises for Section 2.4.

Evaluate the following indefinite integrals. Hint

The original integral may appear in your solution process.

1. $\ds\int xe^{x^2}\,dx$

$\ds (1/2)e^{x^2} +C$
Solution

We will solve this integral using a simple substitution:

\begin{equation*} u = x^2, \text{ with } du = 2x\,dx\text{.} \end{equation*}

Then:

\begin{equation*} \begin{split} \int x e^{x^2}\,dx \amp = \frac{1}{2}\int e^u\,du\\ \amp = \frac{1}{2} e^u + C\\ \amp = \frac{1}{2} e^{x^2} + C. \end{split} \end{equation*}
2. $\ds\int \sin^2 x\,dx$

$(x/2)-\sin(2x)/4 +C=$$(x/2)-(\sin x\cos x)/2+C$
Solution

We will solve using integration by parts (although this integral is more easily solved using a trigonometric identity). Take

\begin{equation*} \begin{array}{cc} u = \sin x \amp dv = \sin x \,dx \\ du = \cos x \, dx \amp v = -\cos x \end{array} \end{equation*}

Therefore,

\begin{equation*} \int \sin^2x \, dx = -\sin x \cos x + \int \cos^2 x \, dx\text{.} \end{equation*}

Now, let $\cos^2x = 1-\sin^2 x\text{.}$ Thus,

\begin{equation*} \begin{split} \int \sin^2 x \, dx \amp = -\sin x \cos x + \int \left(1-\sin^2 x\right) \, dx \\ 2 \int \sin ^2 x \, dx \amp = -\sin x \cos x + x + C \\ \int \sin ^2 x \, dx \amp = -\frac{1}{2}\sin x \cos x + \frac{x}{2} + \hat{C}. \end{split} \end{equation*}
3. $\ds\int x\arctan x\,dx$

$\ds (x^2\arctan x +\arctan x -x)/2+C$
Solution

Recall that $\diff{}{x} \arctan x = \frac{1}{x^2+1}\text{.}$ We will solve this integral using integration by parts, with

\begin{equation*} \begin{array}{cc} u = \arctan x \amp dv = x \,dx \\ du = \frac{1}{x^2+1} \, dx \amp v = \frac{x^2}{2} \end{array} \end{equation*}

Therefore,

\begin{equation*} \int x\arctan x \,dx = \frac{x^2\arctan x}{2} - \frac{1}{2}\int \frac{x^2}{x^2+1} \,dx\text{.} \end{equation*}

Now, rewrite

\begin{equation*} \frac{x^2}{x^2+1} = 1 - \frac{1}{x^2+1}\text{.} \end{equation*}

Then:

\begin{equation*} \begin{split} \int x\arctan x \,dx \amp = \frac{x^2\arctan x}{2} - \frac{1}{2} \int \,dx + \frac{1}{2}\int \frac{1}{x^2+1}\,dx \\ \amp = \frac{x^2\arctan x}{2} - \frac{x}{2} +\frac{1}{2}\arctan x +C \end{split} \end{equation*}
4. $\ds\int x\sin^2 x\,dx$

$\ds x^2/4-(\cos^2 x)/4-(x\sin x\cos x)/2+C$
Solution

We rewrite the integrand:

\begin{equation*} \int x\sin^2 x \,dx =\int \frac{x}{2}\left(1-\cos(2x)\right) = \frac{1}{2}\int x\,dx-\frac{1}{2} \int x \cos (2x)\,dx\text{.} \end{equation*}

Now, use the method of integration by parts with

\begin{equation*} \begin{array}{cc} u = x \amp dv = \cos 2x \,dx \\ du = dx \amp v = \frac{1}{2}\sin(2x) \end{array} \end{equation*}

Therefore,

\begin{equation*} \begin{split} \int x\sin^2 x \,dx \amp = \frac{1}{4} x^2 - \frac{1}{4} x \sin(2x) + \frac{1}{4} \int \sin(2x)\,dx\\ \amp = \frac{1}{4} x^2 - \frac{1}{4} x \sin(2x) + \frac{1}{8} \cos(2x) + C \end{split} \end{equation*}
5. $\ds\int x\sin x\cos x\,dx$

$\ds x/4-(x\cos^2 x)/2+(\cos x\sin x)/4+C$
Solution

Recall that $2\sin x \cos x = \sin(2x)\text{.}$ Then

\begin{equation*} \int x\sin x \cos x \, dx = \frac{1}{2}\int x\sin(2x)\,dx\text{.} \end{equation*}

We use the method of integration by parts with

\begin{equation*} \begin{array}{cc} u = x \amp dv = \sin(2x) \,dx \\ du = \,dx \amp v = -\frac{\cos(2x)}{2} \end{array} \end{equation*}

This gives

\begin{equation*} \begin{split} \int x\sin x \cos x \, dx \amp = \frac{1}{2}\int x\sin(2x)\,dx\\ \amp = -\frac{x}{4} \cos(2x) + \frac{1}{4}\int \cos(2x)\,dx\\ \amp = -\frac{x}{4} \cos(2x) + \frac{1}{8}\sin(2x) + C \end{split} \end{equation*}

Evaluate the following indefinite integrals.

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

$\cos x+x\sin x+C$
Solution

We use the method of integration by parts: Let

\begin{equation*} \begin{array}{cc} u = x \amp dv = \cos x\,dx \\ du = \, dx \amp v = \sin x \end{array} \end{equation*}

This gives

\begin{equation*} \begin{split} \int x\cos x\,dx \amp = x\sin x - \int \sin x\,dx \\ \amp = x\sin x + \cos x + C. \end{split} \end{equation*}
2. $\ds\int x^2\cos x\,dx$

$\ds x^2\sin x-2 \sin x+2x\cos x +C$
Solution

Solve using integration by parts: Let

\begin{equation*} \begin{array}{cc} u = x^2 \amp dv = \cos x\,dx \\ du = 2x \, dx \amp v = \sin x \end{array} \end{equation*}

So,

\begin{equation*} \int x^2 \cos x \, dx = x^2\sin x - 2\int x \sin x \, dx\text{.} \end{equation*}

Now to evaluate the second integral, take

\begin{equation*} \begin{array}{cc} u = x \amp dv = \sin x\,dx\\ du = dx \amp v = -\cos x \end{array} \end{equation*}

Thus,

\begin{equation*} \int x \sin x \, dx = -x\cos x + \int \cos x \, dx = -x\cos x + \sin x + C\text{.} \end{equation*}

All together, we have that

\begin{equation*} \int x^2 \cos x \, dx = x^2\sin x + 2x\cos x - 2\sin x + \hat{C}\text{.} \end{equation*}
3. $\ds\int xe^x\,dx$

$\ds (x-1)e^x +C$
Solution

Take

\begin{equation*} \begin{array}{cc} u = x \amp dv = e^x\,dx \\ du = \,dx \amp v = e^x \end{array} \end{equation*}

Therefore,

\begin{equation*} \begin{split} \int xe^x\,dx \amp = xe^x - \int e^x \, dx \\ \amp = xe^x - e^x + C. \end{split} \end{equation*}
4. $\ds\int \ln x\,dx$

$x\ln x-x +C$
Solution

Let

\begin{equation*} \begin{array}{cc} u = \ln x \amp dv = dx \\ du = \frac{1}{x}\,dx \amp v = x \end{array} \end{equation*}

Then,

\begin{equation*} \begin{split} \int \ln x \,dx \amp = x\ln x - \int \frac{x}{x}\,dx \\ \amp = x\ln x - x + C. \end{split} \end{equation*}
5. $\ds\int x^3\sin x\,dx$

$\ds -x^3\cos x+3x^2\sin x+6x\cos x-6\sin x+C$
Solution

We use the method of integration by parts. First, let

\begin{equation*} \begin{array}{cc} u = x^3 \amp dv = \sin x\,dx \\ du = 3x^2 \, dx \amp v = -\cos x \end{array} \end{equation*}

Then

\begin{equation*} \int x^3\sin x \,dx = -x^3\cos x + 3\int x^2 \cos x \,dx\text{.} \end{equation*}

To solve the second integral, we will use integration by parts again with:

\begin{equation*} \begin{array}{cc} u = x^2 \amp dv = \cos x\,dx \\ du = 2x \, dx \amp v = \sin x \end{array} \end{equation*}

So,

\begin{equation*} \int x^2 \cos x \, dx = x^2\sin x - 2\int x \sin x \, dx\text{.} \end{equation*}

Now apply integration by parts a third time with

\begin{equation*} \begin{array}{cc} u = x \amp dv = \sin x\,dx\\ du = dx \amp v = -\cos x \end{array} \end{equation*}

Thus,

\begin{equation*} \int x \sin x \, dx = -x\cos x + \int \cos x \, dx = -x\cos x + \sin x + C\text{.} \end{equation*}

All together, we have that

\begin{equation*} \int x^3\sin x \, dx = -x^3\cos x + 3x^2\sin x + 6x\cos x -6 \sin x + C\text{.} \end{equation*}
6. $\ds\int x^3\cos x\,dx$

$\ds x^3\sin x+3x^2\cos x-6x\sin x -6\cos x+C$
Solution

We use the method of integration by parts. First, let

\begin{equation*} \begin{array}{cc} u = x^3 \amp dv = \cos x\,dx \\ du = 3x^2 \, dx \amp v = \sin x \end{array} \end{equation*}

Therefore, we have

\begin{equation*} \int x^3\cos x \,dx = x^3\sin x - 3\int x^2\sin x\,dx\text{.} \end{equation*}

Now use integration by parts again with

\begin{equation*} \begin{array}{cc} u = x^2 \amp dv = \sin x\,dx \\ du = 2x \, dx \amp v = -\cos x \end{array} \end{equation*}

Now we have

\begin{equation*} \begin{split} \int x^3\cos x \,dx \amp = x^3\sin x - 3\left(-x^2\cos x + 2\int x\cos x\,dx\right) \\ \amp = x^3\sin x +3 x^2\cos x - 6 \int x \cos x \,dx \end{split} \end{equation*}

We will need to use integration by parts a third time, with

\begin{equation*} \begin{array}{cc} u = x \amp dv = \cos x\,dx \\ du = \, dx \amp v = \sin x \end{array} \end{equation*}

This gives us

\begin{equation*} \begin{split} \int x^3\cos x \,dx \amp = x^3\sin x +3 x^2\cos x - 6 \int x \cos x \,dx \\ \amp = x^3\sin x +3 x^2\cos x - 6\left(x\sin x - \int \sin x\right)\\ \amp = x^3\sin x +3 x^2\cos x - 6x\sin x - 6\cos x + C. \end{split} \end{equation*}
7. $\ds\int \arctan(\sqrt x)\,dx$

$x\arctan(\sqrt x)+\arctan(\sqrt x)-\sqrt{x}+C$
Solution

Recall that

\begin{equation*} \diff{}{x} \arctan(\sqrt{x}) = \frac{1}{1+x} \cdot \frac{1}{2\sqrt{x}}\text{.} \end{equation*}

Now let

\begin{equation*} \begin{array}{cc} u = \arctan(\sqrt{x}) \amp dv = \,dx \\ du = \frac{1}{2\sqrt{x}(x+1)}\, dx \amp v = x \end{array} \end{equation*}

This gives

\begin{equation*} \begin{split} \int \arctan(\sqrt{x})\,dx \amp = x\arctan(\sqrt{x}) - \int \frac{x}{2\sqrt{x}(x+1)}\,dx\\ \amp = x\arctan(\sqrt{x}) - \frac{1}{2} \int \frac{\sqrt{x}}{x+1}\,dx \end{split} \end{equation*}

To solve the second integral, make the substitution $u = \sqrt{x}\text{:}$ (

\begin{equation*} \begin{split} \int \frac{\sqrt{x}}{x+1}\,dx \amp = 2 \int \frac{u^2}{u^2+1}\,du \\ \amp = 2 \int \,du - 2\int \frac{1}{u^2+1}\,du \\ \amp = 2u - 2 \arctan(u) + C\\ \amp = 2\sqrt{x} - 2\arctan(\sqrt{x} + C \end{split} \end{equation*}

All together, we have:

\begin{equation*} \int \arctan(\sqrt{x})\,dx = x\arctan(\sqrt{x}) - \sqrt{x} + \arctan(\sqrt{x}) + C\text{.} \end{equation*}
8. $\ds\int \sin(\sqrt x)\,dx$

$2\sin(\sqrt x)-2\sqrt x\cos(\sqrt x)+C$
Solution

First, use the subsititution \​(\theta=\sqrt{x}\) with $d\theta = \frac{1}{2\sqrt{x}}\,dx\text{.}$ This gives

\begin{equation*} \int \sin(\sqrt{x})\,dx = \int \sin\theta \cdot 2\theta \,d\theta = 2\int \theta \sin\theta \,d\theta\text{.} \end{equation*}

We now try to integrate by parts with

\begin{equation*} \begin{array}{cc} u = \theta \amp dv = \sin\,d\theta \\ du = d\theta \amp v = -\cos\theta \end{array} \end{equation*}

Therefore, we have

\begin{equation*} \begin{split} \int \theta \sin\theta \,d\theta \amp = -\theta\cos\theta + \int \cos \theta \,d\theta \\ \amp = -\theta\cos\theta + \sin \theta \end{split} \end{equation*}

Returning to the $x$ variable, we find

\begin{equation*} \int \sin(\sqrt{x})\,dx = 2\left(-\sqrt{x} \cos(\sqrt{x}) + \sin(\sqrt{x})\right) + C\text{.} \end{equation*}
9. $\ds\int\sec^2 x\csc^2 x\,dx$

$\sec x\csc x-2\cot x+C$
Solution

We recall that

\begin{equation*} int \sec^2 x \,dx = \tan x\text{,} \end{equation*}

and so let's try taking

\begin{equation*} \begin{array}{cc} u = \csc^2 x \amp dv = \sec^2 x\,dx \\ du = -2\csc^2 x \cot x \amp v = \tan x \end{array} \end{equation*}

This gives

\begin{equation*} \begin{split} \int \sec^2 x \csc^2 x\,dx \amp = \tan x \csc^2x + 2 \int \tan x \csc^2 x \cot x \,dx\\ \amp = \tan x \csc^2x + 2 \int \csc^2 x\,dx\\ \amp = \tan x \csc^2x - 2 \cot x + C\\ \amp = \sec x \csc x - 2 \cot x + C \end{split} \end{equation*}