Chapter 4 · Antiderivatives and Integration

4.4 Integration by Parts

The product rule run backwards — trade a hard integral for an easier one, choosing $u$ with LIATE.

By now we can evaluate many basic integrals. Yet although $\displaystyle\int x\sin\left(x^2\right)dx$ yields to the substitution $u=x^2$, something as simple-looking as $\displaystyle\int x\sin x\,dx$ defies us. There is no product rule for integration — but there is a technique based on the product rule for differentiation that lets us exchange one integral for another. We call it integration by parts.

The Integration-by-Parts Formula

If $h(x)=f(x)g(x)$, the product rule gives $h^\prime(x)=f^\prime(x)g(x)+f(x)g^\prime(x)$. Integrating both sides, $$\int h^\prime(x)\,dx=\int\left(f^\prime(x)g(x)+f(x)g^\prime(x)\right)dx,$$ so $$h(x)=f(x)g(x)=\int g(x)f^\prime(x)\,dx+\int f(x)g^\prime(x)\,dx.$$ Solving for $\displaystyle\int f(x)g^\prime(x)\,dx$: $$\int f(x)g^\prime(x)\,dx=f(x)g(x)-\int g(x)f^\prime(x)\,dx.$$ With $u=f(x)$ and $v=g(x)$, so that $du=f^\prime(x)\,dx$ and $dv=g^\prime(x)\,dx$, we get the compact form below.

📐 Theorem 4.7 — Integration by parts
Let $u=f(x)$ and $v=g(x)$ be functions with continuous derivatives. Then $$\int u\,dv=uv-\int v\,du.$$ The formula trades the integral $\int u\,dv$ for $\int v\,du$ — the goal is to choose $u$ and $dv$ so that the new integral is easier.
✏️ Example 1 — Using integration by parts
Use integration by parts with $u=x$ and $dv=\sin x\,dx$ to evaluate $\displaystyle\int x\sin x\,dx$.
Set up $$\begin{array}{ll}u=x & dv=\sin x\,dx\\ du=1\,dx & v=\displaystyle\int\sin x\,dx=-\cos x\end{array}$$
Apply $$\begin{aligned}\int x\sin x\,dx&=(x)(-\cos x)-\int(-\cos x)(1\,dx)\\&=-x\cos x+\int\cos x\,dx\\&=-x\cos x+\sin x+C.\end{aligned}$$
Check $\dfrac{d}{dx}\left(-x\cos x+\sin x+C\right)=(-1)\cos x+(-x)(-\sin x)+\cos x=x\sin x$. ✓
⚠️ Analysis — three things worth noticing

1. A poor choice. Had we chosen $u=\sin x$ and $dv=x\,dx$, then $du=\cos x\,dx$ and $v=\tfrac12x^2$, giving $$\int x\sin x\,dx=\frac12x^2\sin x-\int\frac12x^2\cos x\,dx.$$ The new integral is worse than the original (the power of $x$ went up). We may need to try several choices before finding one that works.

2. No constant in $v$. Using $v=-\cos x+K$ instead: $$\begin{aligned}\int x\sin x\,dx&=(x)(-\cos x+K)-\int(-\cos x+K)(1\,dx)\\&=-x\cos x+Kx+\sin x-Kx+C=-x\cos x+\sin x+C.\end{aligned}$$ The $K$ cancels, so we may always take the simplest $v$. (Interactive 1 uses $v=1-\cos x$, i.e. $K=1$, and gets the same answer.)

3. Always check by differentiating the result.

🧭 Choosing $u$ — the LIATE rule

Choose $u$ to be the function type that appears first in this list; $dv$ is everything else, together with $dx$.

L
Logarithmic
$\ln x$
I
Inverse trig
$\tan^{-1}x$
A
Algebraic
$x^2,\ \sqrt x$
T
Trigonometric
$\sin x$
E
Exponential
$e^{3x}$

Why it works. Whatever we pick as $dv$ must be something we can integrate. We have no simple formulas to integrate $\ln x$ or $\tan^{-1}x$ on their own, so they belong at the head of the list as choices for $u$ (LI — or IL; they rarely appear together). Exponential and trigonometric functions are easy to integrate and make good $dv$'s, so they sit at the end (TE — or ET; when both appear it usually doesn't matter which is $u$). Algebraic functions are easy both to differentiate and integrate, so they sit in the middle.

In Example 1 the integrand has an algebraic factor $x$ and a trigonometric factor $\sin x$; A comes before T, so $u=x$.

Interactive 1 — Parts Is an Area Swap

Plot the pair $(v,u)$ as $x$ runs from $a$ to $b$. The blue region (strips down to the $v$-axis) has area $\int u\,dv$; the green region (strips across to the $u$-axis) has area $\int v\,du$. Together they fill the big rectangle minus the small one: $\int u\,dv+\int v\,du=uv\big|_a^b$ — which is exactly the parts formula.

$x$—
$\int u\,dv$ (blue)—
$\int v\,du$ (green)—
sum—
$uv$ from $a$ to $x$—
✏️ Example 2 — Using integration by parts
Evaluate $\displaystyle\int\frac{\ln x}{x^3}\,dx$.
Rewrite $\displaystyle\int\frac{\ln x}{x^3}\,dx=\int x^{-3}\ln x\,dx$. The integrand has an algebraic factor $x^{-3}$ and a logarithmic factor $\ln x$; L comes before A, so $u=\ln x$ and $dv=x^{-3}dx$.
Set up $$\begin{array}{ll}u=\ln x & dv=x^{-3}dx\\ du=\dfrac1x\,dx & v=\displaystyle\int x^{-3}dx=-\frac12x^{-2}\end{array}$$
Apply $$\begin{aligned}\int x^{-3}\ln x\,dx&=(\ln x)\left(-\frac12x^{-2}\right)-\int\left(-\frac12x^{-2}\right)\left(\frac1x\,dx\right)\\&=-\frac12x^{-2}\ln x+\int\frac12x^{-3}\,dx\\&=-\frac12x^{-2}\ln x-\frac14x^{-2}+C\\&=-\frac{\ln x}{2x^2}-\frac{1}{4x^2}+C.\end{aligned}$$
✏️ Example 3 — Applying integration by parts more than once
Evaluate $\displaystyle\int x^2e^{3x}\,dx$.
First pass By LIATE, $u=x^2$, $dv=e^{3x}dx$: $$\begin{array}{ll}u=x^2 & dv=e^{3x}dx\\ du=2x\,dx & v=\displaystyle\int e^{3x}dx=\frac13e^{3x}\end{array}$$ $$\int x^2e^{3x}dx=\frac13x^2e^{3x}-\int\frac23xe^{3x}dx.$$
Second pass We still cannot integrate $\displaystyle\int\frac23xe^{3x}dx$ directly, but the power of $x$ has dropped. Use parts again with $u=x$, $dv=\tfrac23e^{3x}dx$: $$\begin{array}{ll}u=x & dv=\frac23e^{3x}dx\\ du=dx & v=\displaystyle\int\frac23e^{3x}dx=\frac29e^{3x}\end{array}$$ $$\int x^2e^{3x}dx=\frac13x^2e^{3x}-\left(\frac29xe^{3x}-\int\frac29e^{3x}dx\right).$$
Finish $$\int x^2e^{3x}dx=\frac13x^2e^{3x}-\frac29xe^{3x}+\frac{2}{27}e^{3x}+C.$$
Interactive 2 — The Tabular (D / I) Shortcut for Repeated Parts

When $u$ is a polynomial, repeated parts can be organised in a table: differentiate $u$ down the D column until it reaches $0$, integrate $dv$ down the I column, then multiply along the diagonals with alternating signs $+,-,+,\dots$ Press Next row to build the table one pass at a time.

Exercises

I
Evaluate the integrals by using integration by parts.
  • 1 $\displaystyle\int x\cos x\,dx$
  • 2 $\displaystyle\int xe^{4x}dx$
  • 3 $\displaystyle\int x^2e^x\,dx$
  • 4 $\displaystyle\int xe^{-x}dx$
  • 5 $\displaystyle\int x\sin2x\,dx$
  • 6 $\displaystyle\int x\cos3x\,dx$
  • 7 $\displaystyle\int x\sec^2x\,dx$
  • 8 $\displaystyle\int x^2\cos x\,dx$
  • 9 $\displaystyle\int x^2\ln x\,dx$
  • 10 $\displaystyle\int\ln x\,dx$
  • 11 $\displaystyle\int e^x\sin x\,dx$
  • 12 $\displaystyle\int e^x\cos x\,dx$
  • 13 $\displaystyle\int\tan^{-1}x\,dx$
  • 14 $\displaystyle\int\sin^{-1}x\,dx$
Check: the derivative of the answer (right panel) must retrace the integrand
$f$ with its tangent
$f'$ being traced
$x$—
$f(x)$—
$f'(x)$—
$f$ is…—
1 $u=x$, $dv=\cos x\,dx$; $du=dx$, $v=\sin x$: $$\int x\cos x\,dx=x\sin x-\int\sin x\,dx=x\sin x+\cos x+C.$$
2 $u=x$, $dv=e^{4x}dx$; $v=\tfrac14e^{4x}$: $$\int xe^{4x}dx=\frac14xe^{4x}-\frac14\int e^{4x}dx=\frac14xe^{4x}-\frac1{16}e^{4x}+C.$$
3 $u=x^2$, $dv=e^xdx$: $\displaystyle\int x^2e^xdx=x^2e^x-2\int xe^xdx$. Again with $u=x$: $\displaystyle\int xe^xdx=xe^x-e^x$. Hence $$\int x^2e^xdx=x^2e^x-2xe^x+2e^x+C=\left(x^2-2x+2\right)e^x+C.$$
4 $u=x$, $dv=e^{-x}dx$; $v=-e^{-x}$: $$\int xe^{-x}dx=-xe^{-x}+\int e^{-x}dx=-xe^{-x}-e^{-x}+C=-(x+1)e^{-x}+C.$$
5 $u=x$, $dv=\sin2x\,dx$; $v=-\tfrac12\cos2x$: $$\int x\sin2x\,dx=-\frac12x\cos2x+\frac12\int\cos2x\,dx=-\frac12x\cos2x+\frac14\sin2x+C.$$
6 $u=x$, $dv=\cos3x\,dx$; $v=\tfrac13\sin3x$: $$\int x\cos3x\,dx=\frac13x\sin3x-\frac13\int\sin3x\,dx=\frac13x\sin3x+\frac19\cos3x+C.$$
7 $u=x$, $dv=\sec^2x\,dx$; $v=\tan x$: $$\int x\sec^2x\,dx=x\tan x-\int\tan x\,dx=x\tan x+\ln\left|\cos x\right|+C,$$ using $\displaystyle\int\tan x\,dx=\int\frac{\sin x}{\cos x}dx=-\ln|\cos x|$ (substitution $w=\cos x$).
8 $u=x^2$, $dv=\cos x\,dx$: $\displaystyle\int x^2\cos x\,dx=x^2\sin x-2\int x\sin x\,dx$, and by Example 1, $\displaystyle\int x\sin x\,dx=-x\cos x+\sin x$. Hence $$\int x^2\cos x\,dx=x^2\sin x+2x\cos x-2\sin x+C.$$
9 L before A: $u=\ln x$, $dv=x^2dx$; $du=\tfrac1xdx$, $v=\tfrac13x^3$: $$\int x^2\ln x\,dx=\frac13x^3\ln x-\int\frac13x^2dx=\frac13x^3\ln x-\frac19x^3+C.$$
10 Take $u=\ln x$, $dv=dx$; $du=\tfrac1xdx$, $v=x$: $$\int\ln x\,dx=x\ln x-\int x\cdot\frac1x\,dx=x\ln x-x+C.$$
11 The integral comes back. Let $I=\displaystyle\int e^x\sin x\,dx$. With $u=\sin x$, $dv=e^xdx$: $I=e^x\sin x-\displaystyle\int e^x\cos x\,dx$. Parts again with $u=\cos x$, $dv=e^xdx$: $\displaystyle\int e^x\cos x\,dx=e^x\cos x+\int e^x\sin x\,dx=e^x\cos x+I$. So $$I=e^x\sin x-e^x\cos x-I\ \Longrightarrow\ 2I=e^x(\sin x-\cos x)\ \Longrightarrow\ I=\frac12e^x(\sin x-\cos x)+C.$$
12 Let $J=\displaystyle\int e^x\cos x\,dx$. With $u=\cos x$, $dv=e^xdx$: $J=e^x\cos x+\displaystyle\int e^x\sin x\,dx$; then $\displaystyle\int e^x\sin x\,dx=e^x\sin x-J$. So $$J=e^x\cos x+e^x\sin x-J\ \Longrightarrow\ J=\frac12e^x(\sin x+\cos x)+C.$$ (Keep the same type of $u$ — trig — on both passes, or you just undo the first step.)
13 $u=\tan^{-1}x$, $dv=dx$; $du=\dfrac{dx}{1+x^2}$, $v=x$: $$\int\tan^{-1}x\,dx=x\tan^{-1}x-\int\frac{x}{1+x^2}dx=x\tan^{-1}x-\frac12\ln\left(1+x^2\right)+C,$$ using $w=1+x^2$, $dw=2x\,dx$ for the last integral.
14 $u=\sin^{-1}x$, $dv=dx$; $du=\dfrac{dx}{\sqrt{1-x^2}}$, $v=x$: $$\int\sin^{-1}x\,dx=x\sin^{-1}x-\int\frac{x}{\sqrt{1-x^2}}dx=x\sin^{-1}x+\sqrt{1-x^2}+C,$$ using $w=1-x^2$, $dw=-2x\,dx$: $-\displaystyle\int\frac{x\,dx}{\sqrt{1-x^2}}=\frac12\int w^{-1/2}dw=\sqrt{w}$.
II
Evaluate using integration by parts (more than once where needed). State your choice of $u$ and $dv$.
  • 1 $\displaystyle\int xe^x\,dx$
  • 2 $\displaystyle\int x^2e^{-x}\,dx$
  • 3 $\displaystyle\int x\ln x\,dx$
  • 4 $\displaystyle\int\ln(2x)\,dx$
  • 5 $\displaystyle\int\sqrt x\,\ln x\,dx$
  • 6 $\displaystyle\int(\ln x)^2\,dx$
  • 7 $\displaystyle\int x\tan^{-1}x\,dx$
  • 8 $\displaystyle\int e^{2x}\sin x\,dx$
  • 9 $\displaystyle\int e^{-x}\cos x\,dx$
  • 10 $\displaystyle\int x^3e^{x^2}dx$ (hint: substitute $w=x^2$ first)
Check: the derivative of the answer (right panel) must retrace the integrand
$f$ with its tangent
$f'$ being traced
$x$—
$f(x)$—
$f'(x)$—
$f$ is…—
1 A before E: $u=x$, $dv=e^xdx$; $du=dx$, $v=e^x$: $$\int xe^x\,dx=xe^x-\int e^x\,dx=xe^x-e^x+C=(x-1)e^x+C.$$
2 $u=x^2$, $dv=e^{-x}dx$; $v=-e^{-x}$: $\displaystyle\int x^2e^{-x}dx=-x^2e^{-x}+2\int xe^{-x}dx$. By Ex. I.4, $\displaystyle\int xe^{-x}dx=-(x+1)e^{-x}$. Hence $$\int x^2e^{-x}dx=-x^2e^{-x}-2(x+1)e^{-x}+C=-\left(x^2+2x+2\right)e^{-x}+C.$$
3 L before A: $u=\ln x$, $dv=x\,dx$; $du=\tfrac1xdx$, $v=\tfrac12x^2$: $$\int x\ln x\,dx=\frac12x^2\ln x-\int\frac12x\,dx=\frac12x^2\ln x-\frac14x^2+C.$$
4 $u=\ln(2x)$, $dv=dx$; $du=\dfrac{2}{2x}dx=\dfrac1x\,dx$, $v=x$: $$\int\ln(2x)\,dx=x\ln(2x)-\int1\,dx=x\ln(2x)-x+C.$$
5 $u=\ln x$, $dv=x^{1/2}dx$; $du=\tfrac1xdx$, $v=\tfrac23x^{3/2}$: $$\int\sqrt x\ln x\,dx=\frac23x^{3/2}\ln x-\frac23\int x^{1/2}dx=\frac23x^{3/2}\ln x-\frac49x^{3/2}+C.$$
6 $u=(\ln x)^2$, $dv=dx$; $du=\dfrac{2\ln x}{x}dx$, $v=x$: $\displaystyle\int(\ln x)^2dx=x(\ln x)^2-2\int\ln x\,dx$. With Ex. I.10, $$\int(\ln x)^2dx=x(\ln x)^2-2x\ln x+2x+C.$$
7 I before A: $u=\tan^{-1}x$, $dv=x\,dx$; $du=\dfrac{dx}{1+x^2}$, $v=\tfrac12x^2$: $\displaystyle\int x\tan^{-1}x\,dx=\frac12x^2\tan^{-1}x-\frac12\int\frac{x^2}{1+x^2}dx$. Since $\dfrac{x^2}{1+x^2}=1-\dfrac{1}{1+x^2}$, the last integral is $x-\tan^{-1}x$. So $$\int x\tan^{-1}x\,dx=\frac12\left(x^2+1\right)\tan^{-1}x-\frac12x+C.$$
8 Cyclic. Let $I=\displaystyle\int e^{2x}\sin x\,dx$. With $u=\sin x$, $dv=e^{2x}dx$ ($v=\tfrac12e^{2x}$): $I=\tfrac12e^{2x}\sin x-\tfrac12\displaystyle\int e^{2x}\cos x\,dx$. Again with $u=\cos x$: $\displaystyle\int e^{2x}\cos x\,dx=\tfrac12e^{2x}\cos x+\tfrac12I$. So $$I=\tfrac12e^{2x}\sin x-\tfrac14e^{2x}\cos x-\tfrac14I\ \Longrightarrow\ \tfrac54I=\tfrac14e^{2x}(2\sin x-\cos x)\ \Longrightarrow\ I=\frac15e^{2x}(2\sin x-\cos x)+C.$$
9 Let $J=\displaystyle\int e^{-x}\cos x\,dx$. With $u=\cos x$, $dv=e^{-x}dx$ ($v=-e^{-x}$): $J=-e^{-x}\cos x-\displaystyle\int e^{-x}\sin x\,dx$. With $u=\sin x$: $\displaystyle\int e^{-x}\sin x\,dx=-e^{-x}\sin x+J$. So $$J=-e^{-x}\cos x+e^{-x}\sin x-J\ \Longrightarrow\ J=\frac12e^{-x}(\sin x-\cos x)+C.$$
10 $w=x^2$, $dw=2x\,dx$, $x^3dx=\tfrac12w\,dw$: $\displaystyle\int x^3e^{x^2}dx=\frac12\int we^w\,dw$. By part 1, $\displaystyle\int we^wdw=(w-1)e^w$. Hence $$\int x^3e^{x^2}dx=\frac12\left(x^2-1\right)e^{x^2}+C.$$
III
Definite integrals by parts, choosing $u$, and applications. For definite integrals use $\displaystyle\int_a^bu\,dv=uv\Big|_a^b-\int_a^bv\,du$.
  • 1 $\displaystyle\int_0^{\pi}x\sin x\,dx$
  • 2 $\displaystyle\int_0^1xe^{2x}dx$
  • 3 $\displaystyle\int_1^ex\ln x\,dx$
  • 4 $\displaystyle\int_0^1x^2e^x\,dx$
  • 5 $\displaystyle\int_0^{\pi/2}e^x\cos x\,dx$
  • 6 Use LIATE to choose $u$, then evaluate $\displaystyle\int x^3\ln x\,dx$.
  • 7 Use LIATE to choose $u$, then evaluate $\displaystyle\int x\,2^x\,dx$.
  • 8 Conceptual. For $\displaystyle\int xe^x\,dx$ a student chooses $u=e^x$, $dv=x\,dx$. Write the resulting new integral and explain why this choice fails.
  • 9 Applied. A particle moves with velocity $v(t)=te^{-t}$ m/s. Find the distance it travels during $0\le t\le2$.
  • 10 Applied. Find the area of the region bounded by $y=\ln x$, the $x$-axis, and the line $x=e^2$.
1 By Example 1, an antiderivative is $-x\cos x+\sin x$: $\Big[-x\cos x+\sin x\Big]_0^{\pi}=(-\pi\cdot(-1)+0)-(0)=\pi$.
2 $u=x$, $dv=e^{2x}dx$, $v=\tfrac12e^{2x}$: $\tfrac12xe^{2x}\Big|_0^1-\tfrac12\displaystyle\int_0^1e^{2x}dx=\tfrac12e^2-\tfrac14\left(e^2-1\right)=\dfrac{e^2+1}{4}\approx2.097$.
3 With Ex. II.3: $\Big[\tfrac12x^2\ln x-\tfrac14x^2\Big]_1^e=\left(\tfrac12e^2-\tfrac14e^2\right)-\left(0-\tfrac14\right)=\dfrac{e^2+1}{4}\approx2.097$.
4 With Ex. I.3: $\Big[\left(x^2-2x+2\right)e^x\Big]_0^1=e-2\approx0.718$.
5 With Ex. I.12: $\Big[\tfrac12e^x(\sin x+\cos x)\Big]_0^{\pi/2}=\tfrac12e^{\pi/2}(1+0)-\tfrac12(0+1)=\dfrac{e^{\pi/2}-1}{2}\approx1.905$.
6 L before A: $u=\ln x$, $dv=x^3dx$; $du=\tfrac1xdx$, $v=\tfrac14x^4$: $\displaystyle\int x^3\ln x\,dx=\frac14x^4\ln x-\int\frac14x^3dx=\frac14x^4\ln x-\frac1{16}x^4+C$.
7 A before E ($2^x$ is exponential): $u=x$, $dv=2^xdx$, $v=\dfrac{2^x}{\ln2}$: $\displaystyle\int x\,2^xdx=\frac{x\,2^x}{\ln2}-\frac{1}{\ln2}\int2^xdx=\frac{x\,2^x}{\ln2}-\frac{2^x}{(\ln2)^2}+C$.
8 Then $du=e^xdx$, $v=\tfrac12x^2$, and $\displaystyle\int xe^xdx=\tfrac12x^2e^x-\int\tfrac12x^2e^xdx$. The new integral has a higher power of $x$ — it is harder than the original. LIATE puts A before E, so $u=x$ is the right choice (see Ex. II.1).
9 $v(t)\ge0$, so distance $=\displaystyle\int_0^2te^{-t}dt=\Big[-(t+1)e^{-t}\Big]_0^2=-3e^{-2}+1=1-\dfrac{3}{e^2}\approx0.594$ m (antiderivative from Ex. I.4).
10 $\ln x\ge0$ on $[1,e^2]$ and $\ln x=0$ at $x=1$, so the area is $\displaystyle\int_1^{e^2}\ln x\,dx=\Big[x\ln x-x\Big]_1^{e^2}=\left(2e^2-e^2\right)-(0-1)=e^2+1\approx8.389$.
🔬 Research–Teaching NexusResearch-tutored · optional, about 30 minutes

Research question. What is an income stream that grows over time worth today?

Why it matters. Financial analysts and banks use present value integrals to value businesses, loans and investment projects.

What to do.

  1. Sample case: a small shop in Nizwa earns income at rate $1000\,t$ OMR per year ($t$ in years) for 5 years; the discount rate is $r=0.05$.
  2. Using integration by parts, show $\int_0^T t\,e^{-rt}dt=\frac{1-e^{-rT}(1+rT)}{r^2}$.
  3. Compute the present value $PV=1000\int_0^5 t\,e^{-0.05t}dt$.
  4. Check with a spreadsheet: add monthly amounts discounted by $e^{-rt}$. Compare with the total without discount ($12\,500$ OMR).

Tools: Calculator, spreadsheet

Hand in: A half-page note: the exact and spreadsheet values, the effect of discounting, and one limitation.

Going further. Anywhere: change $r$ to your country's typical interest rate and compare.

Instructor note: The present value is about $10\,600$ OMR; students should notice discounting reduces later income most.

🧪 Self-check quiz

0/5 correct

Q1. Integration by parts comes from reversing which rule?

Q2. For $\displaystyle\int x^3\ln x\,dx$, LIATE says $u=$

Q3. For $\displaystyle\int xe^{2x}dx$ with $u=x$, $v=$

Q4. $\displaystyle\int\ln x\,dx=$

Q5. How many applications of parts does $\displaystyle\int x^2e^{3x}dx$ need?