# Integration by Parts

## Introduction

Let's say we want to integrate

${\displaystyle \int x^{2}e^{x^{3}}~dx.}$

Here, we can compute this antiderivative by using  ${\displaystyle u-}$substitution.

While  ${\displaystyle u-}$substitution is an important integration technique, it will not help us evaluate all integrals.

For example, consider the integral

${\displaystyle \int xe^{x}~dx.}$

There is no substitution that will allow us to integrate this integral.

We need another integration technique called integration by parts.

The formula for integration by parts comes from the product rule for derivatives.

Recall from the product rule,

${\displaystyle (f(x)g(x))'=f'(x)g(x)+f(x)g'(x).}$

Then, we have

${\displaystyle {\begin{array}{rcl}\displaystyle {f(x)g(x)}&=&\displaystyle {\int (f(x)g(x))'~dx}\\&&\\&=&\displaystyle {\int f'(x)g(x)+f(x)g'(x)~dx}\\&&\\&=&\displaystyle {\int f'(x)g(x)~dx+\int f(x)g'(x)~dx.}\end{array}}}$

If we solve the last equation for the second integral, we obtain

${\displaystyle \int f(x)g'(x)~dx=f(x)g(x)-\int f'(x)g(x)~dx.}$

This formula is the formula for integration by parts.

But, as it is currently stated, it is long and hard to remember.

So, we make a substitution to obtain a nicer formula.

Let  ${\displaystyle u=f(x)}$  and  ${\displaystyle dv=g'(x)~dx.}$

Then,  ${\displaystyle du=f'(x)~dx}$  and  ${\displaystyle v=g(x).}$

Plugging these into our formula, we obtain

${\displaystyle \int u~dv=uv-\int v~du.}$

## Warm-Up

Evaluate the following integrals.

1)   ${\displaystyle \int xe^{x}~dx}$

Solution:
We have two options when doing integration by parts.
We can let  ${\displaystyle u=x}$  or  ${\displaystyle u=e^{x}.}$
In this case, we let  ${\displaystyle u}$  be the polynomial.
So, we let  ${\displaystyle u=x}$  and  ${\displaystyle dv=e^{x}~dx.}$
Then,  ${\displaystyle du=dx}$  and  ${\displaystyle v=e^{x}.}$
Hence, by integration by parts, we get
${\displaystyle {\begin{array}{rcl}\displaystyle {\int xe^{x}~dx}&=&\displaystyle {xe^{x}-\int e^{x}~dx}\\&&\\&=&\displaystyle {xe^{x}-e^{x}+C.}\end{array}}}$
${\displaystyle xe^{x}-e^{x}+C}$

2)   ${\displaystyle \int x\cos(2x)~dx}$

Solution:

We have a choice to make.

We can let  ${\displaystyle u=x}$  or  ${\displaystyle u=\cos(2x).}$
In this case, we let  ${\displaystyle u}$  be the polynomial.
So, we let  ${\displaystyle u=x}$  and  ${\displaystyle dv=\cos(2x)~dx.}$
Then,  ${\displaystyle du=dx.}$
To find  ${\displaystyle v,}$  we need to use  ${\displaystyle u-}$substitution. So,
${\displaystyle v=\int \cos(2x)~dx={\frac {1}{2}}\sin(2x).}$
Hence, by integration by parts, we get
${\displaystyle {\begin{array}{rcl}\displaystyle {\int x\cos(2x)~dx}&=&\displaystyle {{\frac {1}{2}}x\sin(2x)-\int {\frac {1}{2}}\sin(2x)~dx}\\&&\\&=&\displaystyle {{\frac {1}{2}}x\sin(2x)+{\frac {1}{4}}\cos(2x)+C,}\end{array}}}$
where we use  ${\displaystyle u-}$ substitution to evaluate the last integral.
${\displaystyle {\frac {1}{2}}x\sin(2x)+{\frac {1}{4}}\cos(2x)+C}$

3)   ${\displaystyle \int \ln x~dx}$

Solution:
We have a choice to make.
We can let  ${\displaystyle u=\ln x}$  or  ${\displaystyle dv=\ln x~dx.}$
In this case, we don't want to let  ${\displaystyle dv=\ln x~dx}$  since we don't know how to integrate  ${\displaystyle \ln x}$  yet.
So, we let  ${\displaystyle u=\ln x}$  and  ${\displaystyle dv=1~dx.}$
Then,  ${\displaystyle du={\frac {1}{x}}~dx}$  and  ${\displaystyle v=x.}$
Hence, by integration by parts, we get
${\displaystyle {\begin{array}{rcl}\displaystyle {\int \ln x~dx}&=&\displaystyle {x\ln(x)-\int x{\bigg (}{\frac {1}{x}}{\bigg )}~dx}\\&&\\&=&\displaystyle {x\ln(x)-\int 1~dx}\\&&\\&=&\displaystyle {x\ln(x)-x+C.}\end{array}}}$
Note: The domain of the function  ${\displaystyle \ln x}$  is  ${\displaystyle (0,\infty ).}$
So, this integral is defined for  ${\displaystyle x>0.}$
${\displaystyle x\ln(x)-x+C}$

## Exercise 1

Evaluate  ${\displaystyle \int x\sec ^{2}x~dx.}$

Since we know the antiderivative of  ${\displaystyle \sec ^{2}x,}$

we let  ${\displaystyle u=x}$  and  ${\displaystyle dv=\sec ^{2}x~dx.}$

Then,  ${\displaystyle du=dx}$  and  ${\displaystyle v=\tan x.}$

Using integration by parts, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int x\sec ^{2}x~dx}&=&\displaystyle {x\tan x-\int \tan x~dx}\\&&\\&=&\displaystyle {x\tan x-\int {\frac {\sin x}{\cos x}}~dx.}\end{array}}}$

For the remaining integral, we use  ${\displaystyle u-}$substitution.

Let  ${\displaystyle u=\cos x.}$  Then,  ${\displaystyle du=-\sin x~dx.}$

So, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int x\sec ^{2}x~dx}&=&\displaystyle {x\tan x+\int {\frac {1}{u}}~du}\\&&\\&=&\displaystyle {x\tan x+\ln |u|+C}\\&&\\&=&\displaystyle {x\tan x+\ln |\cos x|+C.}\end{array}}}$

So, we have

${\displaystyle \int x\sec ^{2}x~dx=x\tan x+\ln |\cos x|+C.}$

## Exercise 2

Evaluate  ${\displaystyle \int {\frac {\ln x}{x^{3}}}~dx.}$

We start by letting  ${\displaystyle u=\ln x}$  and  ${\displaystyle dv={\frac {1}{x^{3}}}~dx.}$

Then,  ${\displaystyle du={\frac {1}{x}}~dx}$  and  ${\displaystyle v=-{\frac {1}{2x^{2}}}.}$

So, using integration by parts, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int {\frac {\ln x}{x^{3}}}~dx}&=&\displaystyle {-{\frac {\ln x}{2x^{2}}}-\int -{\frac {1}{2x^{2}}}{\bigg (}{\frac {1}{x}}{\bigg )}~dx}\\&&\\&=&\displaystyle {-{\frac {\ln x}{2x^{2}}}+\int {\frac {1}{2x^{3}}}~dx}\\&&\\&=&\displaystyle {-{\frac {\ln x}{2x^{2}}}-{\frac {1}{4x^{2}}}+C.}\end{array}}}$

So, we have

${\displaystyle \int {\frac {\ln x}{x^{3}}}~dx=-{\frac {\ln x}{2x^{2}}}-{\frac {1}{4x^{2}}}+C.}$

## Exercise 3

Evaluate  ${\displaystyle \int x{\sqrt {x+1}}~dx.}$

We start by letting  ${\displaystyle u=x}$  and  ${\displaystyle dv={\sqrt {x+1}}~dx.}$

Then,  ${\displaystyle du=dx.}$

To find  ${\displaystyle v,}$  we need to use  ${\displaystyle u-}$substitution. So,

${\displaystyle v=\int {\sqrt {x+1}}~dx={\frac {2}{3}}(x+1)^{\frac {3}{2}}.}$

Hence, by integration by parts, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int x{\sqrt {x+1}}~dx}&=&\displaystyle {{\frac {2}{3}}x(x+1)^{\frac {3}{2}}-\int {\frac {2}{3}}(x+1)^{\frac {3}{2}}~dx}\\&&\\&=&\displaystyle {{\frac {2}{3}}x(x+1)^{\frac {3}{2}}-{\frac {4}{15}}(x+1)^{\frac {5}{2}}+C,}\end{array}}}$

where we use  ${\displaystyle u-}$ substitution to evaluate the last integral.

So, we have

${\displaystyle \int x{\sqrt {x+1}}~dx={\frac {2}{3}}x(x+1)^{\frac {3}{2}}-{\frac {4}{15}}(x+1)^{\frac {5}{2}}+C.}$

## Exercise 4

Evaluate  ${\displaystyle \int x^{2}e^{-2x}~dx.}$

We start by letting  ${\displaystyle u=x^{2}}$  and  ${\displaystyle dv=e^{-2x}~dx.}$

Then,  ${\displaystyle du=2x~dx.}$

To find  ${\displaystyle v,}$  we need to use  ${\displaystyle u-}$substitution. So,

${\displaystyle v=\int e^{-2x}~dx={\frac {e^{-2x}}{-2}}.}$

Hence, by integration by parts, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int x^{2}e^{-2x}~dx}&=&\displaystyle {{\frac {x^{2}e^{-2x}}{-2}}-\int 2x{\bigg (}{\frac {e^{-2x}}{-2}}{\bigg )}~dx}\\&&\\&=&\displaystyle {{\frac {x^{2}e^{-2x}}{-2}}+\int xe^{-2x}~dx.}\end{array}}}$

Now, we need to use integration by parts a second time.

Let  ${\displaystyle u=x}$  and  ${\displaystyle dv=e^{-2x}~dx.}$

Then,  ${\displaystyle du=dx}$  and  ${\displaystyle v={\frac {e^{-2x}}{-2}}.}$

Therefore, using integration by parts again, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int x^{2}e^{-2x}~dx}&=&\displaystyle {{\frac {x^{2}e^{-2x}}{-2}}+{\frac {xe^{-2x}}{-2}}-\int {\frac {e^{-2x}}{-2}}~dx}\\&&\\&=&\displaystyle {{\frac {x^{2}e^{-2x}}{-2}}+{\frac {xe^{-2x}}{-2}}+{\frac {e^{-2x}}{-4}}+C.}\end{array}}}$

So, we have

${\displaystyle \int x^{2}e^{-2x}~dx={\frac {x^{2}e^{-2x}}{-2}}+{\frac {xe^{-2x}}{-2}}+{\frac {e^{-2x}}{-4}}+C.}$

## Exercise 5

Evaluate  ${\displaystyle \int e^{3x}\sin(2x)~dx.}$

We begin by letting  ${\displaystyle u=\sin(2x)}$  and  ${\displaystyle dv=e^{3x}~dx.}$

Then,  ${\displaystyle du=2\cos(2x)~dx.}$

To find  ${\displaystyle v,}$  we need to use  ${\displaystyle u-}$substitution. So,

${\displaystyle v=\int e^{3x}~dx={\frac {e^{3x}}{3}}.}$

Hence, by integration by parts, we have

${\displaystyle {\begin{array}{rcl}\displaystyle {\int e^{3x}\sin(2x)~dx}&=&\displaystyle {{\frac {e^{3x}\sin(2x)}{3}}-\int {\frac {2}{3}}\cos(2x)e^{3x}~dx}\\&&\\&=&\displaystyle {{\frac {e^{3x}\sin(2x)}{3}}-{\frac {2}{3}}\int \cos(2x)e^{3x}~dx.}\end{array}}}$

Now, we need to use integration by parts a second time.

Let  ${\displaystyle u=\cos(2x)}$  and  ${\displaystyle dv=e^{3x}~dx.}$

Then,  ${\displaystyle du=-2\sin(2x)~dx}$  and  ${\displaystyle v={\frac {e^{3x}}{3}}.}$

Therefore, using integration by parts again, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int e^{3x}\sin(2x)~dx}&=&\displaystyle {{\frac {e^{3x}\sin(2x)}{3}}-{\frac {2}{3}}{\bigg [}{\frac {\cos(2x)e^{3x}}{3}}+\int {\frac {2}{3}}\sin(2x)e^{3x}~dx{\bigg ]}}\\&&\\&=&\displaystyle {{\frac {e^{3x}\sin(2x)}{3}}-{\frac {2\cos(2x)e^{3x}}{9}}-{\frac {4}{9}}\int e^{3x}\sin(2x)~dx.}\end{array}}}$

Now, we have the exact same integral that we had at the beginning of the problem.

So, we add this integral to the other side of the equation.

When we do this, we get

${\displaystyle {\frac {13}{9}}\int e^{3x}\sin(2x)~dx={\frac {e^{3x}\sin(2x)}{3}}-{\frac {2\cos(2x)e^{3x}}{9}}.}$

Therefore, we get

${\displaystyle \int e^{3x}\sin(2x)~dx={\frac {9}{13}}{\bigg (}{\frac {e^{3x}\sin(2x)}{3}}-{\frac {2\cos(2x)e^{3x}}{9}}{\bigg )}+C.}$

## Exercise 6

Evaluate  ${\displaystyle \int \sin(2x)\cos(3x)~dx.}$

For this problem, we use a similar process as Exercise 5.

We use integration by parts twice, which produces the same integral given to us in the problem.

Then, we solve for our integral.

We begin by letting  ${\displaystyle u=\sin(2x)}$  and  ${\displaystyle dv=\cos(3x)~dx.}$

Then,  ${\displaystyle du=2\cos(2x)~dx.}$

To find  ${\displaystyle v,}$  we need to use  ${\displaystyle u-}$substitution. So,

${\displaystyle v=\int \cos(3x)~dx={\frac {1}{3}}\sin(3x).}$

Hence, by integration by parts, we have

${\displaystyle {\begin{array}{rcl}\displaystyle {\int \sin(2x)\cos(3x)~dx}&=&\displaystyle {{\frac {1}{3}}\sin(2x)\sin(3x)-\int {\frac {2}{3}}\cos(2x)\sin(3x)~dx}\\&&\\&=&\displaystyle {{\frac {1}{3}}\sin(2x)\sin(3x)-{\frac {2}{3}}\int \cos(2x)\sin(3x)~dx.}\end{array}}}$

Now, we need to use integration by parts a second time.

Let  ${\displaystyle u=\cos(2x)}$  and  ${\displaystyle dv=\sin(3x)~dx.}$

Then,  ${\displaystyle du=-2\sin(2x)~dx}$  and  ${\displaystyle v={\frac {-\cos(3x)}{3}}.}$

Therefore, using integration by parts again, we get

${\displaystyle {\begin{array}{rcl}\displaystyle {\int \sin(2x)\cos(3x)~dx}&=&\displaystyle {{\frac {1}{3}}\sin(2x)\sin(3x)-{\frac {2}{3}}{\bigg [}{\frac {-\cos(2x)\cos(3x)}{3}}-\int {\frac {2}{3}}\sin(2x)\cos(3x)~dx{\bigg ]}}\\&&\\&=&\displaystyle {{\frac {1}{3}}\sin(2x)\sin(3x)+{\frac {2\cos(2x)\cos(3x)}{9}}+{\frac {4}{9}}\int \sin(2x)\cos(3x)~dx.}\end{array}}}$

Now, we have the exact same integral that we had at the beginning of the problem.

So, we subtract this integral to the other side of the equation.

When we do this, we get

${\displaystyle {\frac {5}{9}}\int \sin(2x)\cos(3x)~dx={\frac {1}{3}}\sin(2x)\sin(3x)+{\frac {2\cos(2x)\cos(3x)}{9}}.}$

Therefore, we get

${\displaystyle \int e^{3x}\sin(2x)~dx={\frac {9}{5}}{\bigg (}{\frac {1}{3}}\sin(2x)\sin(3x)+{\frac {2\cos(2x)\cos(3x)}{9}}{\bigg )}+C.}$