# Calculus: Integrals IV

## Integration By Parts

Just as the chain rule has an integration counterpart, $u$-substitution, so, too, does the product rule: integration by parts.  Remember the form of the product rule:

$$\dfrac{d}{dx}(uv) = \dfrac{du}{dx}v + u\dfrac{dv}{dx}$$

Rearranging this equation gives the following:

$$u\dfrac{dv}{dx} = \dfrac{d}{dx}(uv) - \dfrac{du}{dx}v$$

Integrating with respect then yields the following integral:

$$\int u \, \dfrac{dv}{dx} \, dx = \int\dfrac{d}{dx}uv \, dx - \int v \dfrac{du}{dx} \, dx$$

Which simplifies to the following:

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

Note that the terms $dv$ and $du$ are shorthand for $\dfrac{dv}{dx} \, dx$ and $\dfrac{du}{dx} \, dx$, since the $dx$ terms "cancel" each other out - the equation is identical to the one above it. This final equation is know as integration by parts, and it gives the integral of the product of two function as a new combination of their respective integrals and derivatives. Note that, like the chain rule, the product rule substitutes one integral for another, where the new one is hopefully easier to solve.

The trick with using the product rule is to pick which term in the product is the $u$ term and which is the $dv$ term such that the integral on the right-hand side of the equation is simpler than the one on the left-hand side. For example, if one term in the product is a polynomial, it will be the best choice for the $u$ term, since repeatedly differentiating it will eventually produce a constant. In contrast, integrating it will only produce a more complicated polynomial, so it will make a poor choice for the $dv$ term. And in case you were wondering from, yes, sometimes integration by parts needs to be applied recursively until the integral on the right-hand side of the equation is simple enough to evaluate directly.

Some tips for using integration by parts:

• Write out all the $u$, $du$, $v$, and $dv$ terms. The organizational benefit is worth the extra 5 seconds it takes to write down.
• When applying integration by parts recursively, make sure the term getting integrated remains the term getting integrated, and the term getting differentiated remains the term getting differentiated. Otherwise you will undo with one step what you just accomplished in the previous.
• When applying integration by parts recursively, write out the entire integral each time. Don't forget to use parentheses - the last thing you want to goof up is a mission-critical sign change.
• Watch Stand and Deliver.

## Problems

1. Evaluate: $\displaystyle\int xe^x \, dx$

$\displaystyle\int xe^x \, dx$

Let $u = x$   and   $dv = e^x \, dx$ such that $du = dx$   and $v=e^x$. Now substitute back into the original equation:

$\displaystyle\int xe^x \, dx = \int udv \\ \displaystyle\int xe^x \, dx = uv - \int vdu \\ \displaystyle\int xe^x \, dx = x e^x - \int e^x dx \\ \displaystyle\int xe^x \, dx = x e^x - e^x + c \\$

2. Evaluate: $\displaystyle\int x\sin(x) \, dx$

Let $u = x$   and   $dv = \sin(x) \, dx$ such that $du = dx$   and $v=-\cos(x)$. Now substitute back into the original equation:

$\displaystyle\int x\sin(x) \, dx = \int udv \\ \displaystyle\int x\sin(x) \, dx = uv - \int vdu \\ \displaystyle\int x\sin(x) \, dx = -x \cos(x) - \int -\cos(x) \, dx \\ \displaystyle\int x\sin(x) \, dx = -x \cos(x) + \int \cos(x) \, dx \\ \displaystyle\int x\sin(x) \, dx = -x \cos(x) + \sin(x) + c \\$
3. Evaluate: $\displaystyle\int \ln(x) \, dx$

$\displaystyle\int \ln(x) \, dx$

Let $u = \ln(x)$   and   $dv = dx$ such that $du = \dfrac{1}{x} \, dx$   and $v=x$. Now substitute back into the original equation:

$\displaystyle\int \ln(x) \, dx = \displaystyle\int u \, dv \\ \displaystyle\int \ln(x) \, dx = uv - \int v \, du \\ \displaystyle\int \ln(x) \, dx = x \ln(x) - \displaystyle\int \dfrac{1}{x}x \, dx \\ \displaystyle\int \ln(x) \, dx = x \ln(x) - \displaystyle\int 1\cdot \, dx \\ \displaystyle\int \ln(x) \, dx = x \ln(x) - x + c \\$

4. Evaluate: $\displaystyle\int x\ln(x) \, dx$

$\displaystyle\int \ln(x) \, dx$

Let $u = \ln(x)$   and   $dv = xdx$ such that $du = \dfrac{1}{x}dx$   and $v=x^2$. Now substitute back into the original equation:

$\displaystyle\int \ln(x) \, dx = \int u \, dv \\ \displaystyle\int \ln(x) \, dx = uv - \int v \, du \\ \displaystyle\int \ln(x) \, dx = x^2 \ln(x) - \int \dfrac{1}{x}x^2 \, dx \\ \displaystyle\int \ln(x) \, dx = x^2 \ln(x) - \int x \, dx \\ \displaystyle\int \ln(x) \, dx = x^2 \ln(x) - \dfrac{1}{2}x^2 + c \\$

5. Evaluate: $\displaystyle\int x^2\ln(x) \, dx$

$\displaystyle\int x^2\ln(x) \, dx$

Let $u = \ln(x)$   and   $dv = x^2 \, dx$ such that $du = \dfrac{1}{x} \, dx$   and $v=\dfrac{1}{3}x^3$. Now substitute back into the original equation:

$\displaystyle\int x^2\ln(x) \, dx = \int u \, dv \\ \displaystyle\int x^2\ln(x) \, dx = uv - \int v \, du \\ \displaystyle\int x^2\ln(x) \, dx = \dfrac{1}{3}x^3 \ln(x) - \int \dfrac{1}{x}\dfrac{1}{3}x^3 \, dx \\ \displaystyle\int x^2\ln(x) \, dx = \dfrac{1}{3}x^3 \ln(x) - \int \dfrac{1}{3}x^2 \, dx \\ \displaystyle\int x^2\ln(x) \, dx = \dfrac{1}{3}x^3 \ln(x) - \dfrac{1}{9}x^3 + c \\$

6. Evaluate: $\displaystyle\int x^2e^{x+1} \, dx$

$\displaystyle\int x^2e^{x+1} \, dx = \int x^2e^xe \, dx \\ \displaystyle\int x^2e^{x+1} \, dx = e \displaystyle\int x^2e^x \, dx \\$

Let $u = x^2$   and   $dv = e^x \, dx$ such that $du = 2xdx$   and $v=e^x$. Now substitue back into the original equation:

$\displaystyle\int x^2e^{x+1} \, dx = e\displaystyle\int u \, dv \\ \displaystyle\int x^2e^{x+1} \, dx = e\left( uv - \int vdu \right)\\ \displaystyle\int x^2e^{x+1} \, dx = e\left(x^2e^x - \int 2xe^x dx \right)\\$

Guess what? You have to do integration by parts again! Let $u = x$   and   $dv = e^x \, dx$ such that $du = dx$   and   $v = e^x$. Now substitue back into the original equation:

$\displaystyle\int x^2e^{x+1} \, dx = e\left(x^2e^x - \left( xe^x - \displaystyle\int e^xdx \right)\right) \\ \displaystyle\int x^2e^{x+1} \, dx = e\left(x^2e^x - xe^x + \displaystyle\int e^xdx \right)\\ \displaystyle\int x^2e^{x+1} \, dx = e\left(x^2e^x - xe^x + e^x + c\right) \\ \displaystyle\int x^2e^{x+1} \, dx = x^2e^{x+1} - xe^{x+1} + e^{x+1} + c \\$

7. Evaluate: $\displaystyle\int e^x\cos(x) \, dx$

$\displaystyle\int e^x\cos(x) \, dx$

Let $u = e^x$   and   $dv = \cos(x) \, dx$ such that $du = e^x \, dx$   and $v=\sin(x)$. Now substitute back into the original equation:

$\displaystyle\int e^x\cos(x) \, dx = \int u \, dv \\ \displaystyle\int e^x\cos(x) \, dx = uv - \int v \, du \\ \displaystyle\int e^x\cos(x) \, dx = e^x \sin(x) - \int e^x\sin(x) \, dx \\$

Let $u = e^x$   and   $dv = \sin(x)dx$ such that $du = e^xdx$   and $v=-\cos(x)$. Now substitute back into the original equation:

$\displaystyle\int e^x\cos(x) \, dx = e^x\sin(x) - \int udv \\ \displaystyle\int e^x\cos(x) \, dx = e^x\sin(x) - \left( uv - \int vdu \right) \\ \displaystyle\int e^x\cos(x) \, dx = e^x\sin(x) - \left( -e^x\cos(x) - \int -\cos(x)e^x dx \right) \\ \displaystyle\int e^x\cos(x) \, dx = e^x\sin(x) - \left( -e^x\cos(x) + \int \cos(x)e^x dx \right) \\ \displaystyle\int e^x\cos(x) \, dx = e^x\sin(x) + e^x\cos(x) - \int \cos(x)e^x dx \\ 2\displaystyle\int e^x\cos(x) \, dx = e^x\sin(x) + e^x\cos(x) \\ \displaystyle\int e^x\cos(x) \, dx = \dfrac{1}{2}\left(e^x\sin(x) + e^x\cos(x)\right) + c\\$
8. Evaluate: $\displaystyle\int e^{2x}\sin(x) \, dx$

$\displaystyle\int e^{2x}\sin(x) \, dx$

Let $u = e^{2x}$   and   $dv = \sin(x) \, dx$ Such that $du = 2e^{2x} \, dx$   and   $v = -\cos(x)$. Now substitute back into the original equation.

$\displaystyle\int e^{2x}\sin(x) \, dx = \displaystyle\int u \, dv \\ \displaystyle\int e^{2x}\sin(x) \, dx = uv - \displaystyle\int v \, du \\ \displaystyle\int e^{2x}\sin(x) \, dx = -e^{2x}\cos(x) - \displaystyle\int -\cos(x)2e^{2x} \, dx \\ \displaystyle\int e^{2x}\sin(x) \, dx = -e^{2x}\cos(x) + 2\displaystyle\int e^{2x}\cos(x) \, dx \\$

Let $u = e^{2x}$   and   $dv = \cos(x) \, dx$ such that $du = 2e^{2x} \, dx$   and   $v = \sin(x)$. Now substitute back into the original equation.

$\displaystyle\int e^{2x}\sin(x) \, dx = -e^{2x}\cos(x) + 2 \displaystyle\int u \, dv \\ \displaystyle\int e^{2x}\sin(x) \, dx = -e^{2x}\cos(x) + 2 \left(uv - \displaystyle\int v \, du \right) \\ \displaystyle\int e^{2x}\sin(x) \, dx = -e^{2x}\cos(x) + 2 \left(e^{2x}\sin(x) - \displaystyle\int \sin(x)2e^{2x} \, dx \right) \\ \displaystyle\int e^{2x}\sin(x) \, dx = -e^{2x}\cos(x) + 2e^{2x}\sin(x) - 4\displaystyle\int \sin(x)e^{2x} \, dx \\ 5\displaystyle\int e^{2x}\sin(x) \, dx = -e^{2x}\cos(x) + 2e^{2x}\sin(x) \\ \displaystyle\int e^{2x}\sin(x) \, dx = -\dfrac{1}{5}e^{2x}\cos(x) + \dfrac{2}{5}e^{2x}\sin(x) + c \\ \displaystyle\int e^{2x}\sin(x) \, dx = -\dfrac{1}{5}e^{2x}\left(\cos(x) - 2\sin(x)\right) + c \\$

9. Evaluate: $\displaystyle\int ae^x \sin(bx) \, dx$

$\displaystyle\int ae^x \sin(bx) \, dx \\$

Let $u = e^x$ such that $du = e^x \, dx$, and let $dv = a\sin(bx) \, dx$ such that $v = \dfrac{-a}{b}\cos(bx)$.

$\displaystyle\int ae^x \sin(bx) \, dx = \displaystyle\int u \, dv \\ \displaystyle\int ae^x \sin(bx) \, dx = uv - \displaystyle\int v \, du \\ \displaystyle\int ae^x \sin(bx) \, dx = e^x\left(\dfrac{-a}{b}\cos(bx)\right) - \displaystyle\int \dfrac{-a}{b}\cos(bx) e^x \, dx \\ \displaystyle\int ae^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b}\displaystyle\int e^x\cos(bx) e^x \, dx \\$

Use integration by parts again. Let $u = e^x$ such that $du = e^x dx$, and let $dv = \cos(bx) \, dx$ such that $v = \dfrac{1}{b}\sin(bx)$.

$\displaystyle\int ae^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b}\displaystyle\int u \, dv\\ \displaystyle\int ae^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b} \left( uv - \displaystyle\int v \, du \right) \\ \displaystyle\int ae^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b} \left( \dfrac{1}{b}e^x\sin(bx) - \displaystyle\int \dfrac{1}{b}\sin(bx) e^x dx \right) \\ \displaystyle\int ae^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b^2}e^x\sin(bx) - \dfrac{1}{b^2}\displaystyle\int a\sin(bx) e^x dx \\ \left(1+\dfrac{1}{b^2}\right)\displaystyle\int e^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b^2}e^x\sin(bx) \\ \left(\dfrac{b^2}{b^2}+\dfrac{1}{b^2}\right)\displaystyle\int e^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b^2}e^x\sin(bx) \\ \left(\dfrac{1+b^2}{b^2}\right)\displaystyle\int e^x \sin(bx) \, dx = \dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b^2}e^x\sin(bx) \\ \displaystyle\int e^x \sin(bx) \, dx = \dfrac{b^2}{1+b^2} \left(\dfrac{-a}{b}e^x\cos(bx) + \dfrac{a}{b^2}e^x\sin(bx) \right) \\ \displaystyle\int e^x \sin(bx) \, dx = \dfrac{-ab}{1+b^2}e^x\cos(bx) + \dfrac{a}{1+b^2}e^x\sin(bx) \\ \displaystyle\int e^x \sin(bx) \, dx = \dfrac{ae^x\sin(bx) - abe^x\cos(bx)}{1+b^2} \\$

10. Integrate with respect to $x$ using tabular integration by parts: $\displaystyle\int x^4\sin(x) \, dx$

$\displaystyle \int x^{4}\sin(x) \, dx \\$

Tabulate:

$\begin{array}{lll} \text{sign} & f' & F \\ - & \quad & \sin(x) \\ + & x^4 & -\cos(x) \\ - & 4x^3 & -\sin(x) \\ + & 12x^2 & \cos(x) \\ - & 24x & \sin(x) \\ + & 24 & -\cos(x) \\ + & 0 & \sin(x) \\ \end{array}$

Sum:

$\displaystyle \int x^{4}\sin(x) \, dx = -x^4\cos(x) + 4x^3\sin(x) + 12x^2\cos(x) -24x\sin(x) - 24\cos(x) + c$

11. Integrate with respect to $x$ using tabular integration by parts: $\displaystyle\int x^{3}e^{x} \, dx$

$\displaystyle\int x^{3}e^{x} \, dx$

Tabulate:

$\begin{array}{lll} \text{sign} & f' & F \\ - & \quad & e^x \\ + & x^3 & e^x \\ - & 3x^2 & e^x \\ + & 6x & e^x \\ - & 6 & e^x \\ + & 0 & e^x \\ \end{array}$

Sum:

$\displaystyle\int x^{3}e^{x} \, dx = x^3e^x - 3x^2e^x + 6xe^x - 6e^x + c$

12. Integrate with respect to x using tabular integration by parts: $\displaystyle\int 3x^2e^{(1/2)x} \, dx$

Tabulate:

$\begin{array}{lll} \text{sign} & f' & F \\ - & \quad & e^{(1/2)x} \\ + & 3x^2 & 2e^{(1/2)x} \\ - & 6x & 4e^{(1/2)x} \\ + & 6 & 8e^{(1/2)x} \\ - & 0 & 16e^{(1/2)x} \\ \end{array}$

Sum:

$\displaystyle\int 3x^2e^{(1/2)x} \, dx = 3x^2\left(2e^{(1/2)x}\right) - 6x\left(4e^{(1/2)x}\right) + 6\left(8e^{(1/2)x}\right) + c \\ \displaystyle\int 3x^2e^{(1/2)x} \, dx = 6x^2e^{(1/2)x} - 24xe^{(1/2)x} + 48e^{(1/2)x} + c \\$