The Trapezoidal Rule
Textbook Reference
| Primary source | OpenStax Calculus Volume 2, Section 1.5: “Numerical Integration” |
| Direct link | https://openstax.org/books/calculus-volume-2/pages/1-5-numerical-integration |
| Textbook used in class | Stewart, Calculus, Section 7.7: “Approximate Integration” |
Opening Scenario
Left and right endpoint Riemann sums approximate the integral by a step-function. The Trapezoidal Rule is a natural improvement: instead of horizontal-top rectangles, use trapezoids whose slanted tops connect the function values at both endpoints of each subinterval. For a function that is close to linear on each subinterval, the trapezoid fits much better than either rectangle.
Quick Reference
Trapezoidal Rule: $$T_n = \frac{\Delta x}{2}\left[f(x_0) + 2f(x_1) + 2f(x_2) + \cdots + 2f(x_{n-1}) + f(x_n)\right]$$
where $\Delta x = \dfrac{b-a}{n}$ and $x_i = a + i\,\Delta x$.
Compact form: $T_n = \dfrac{L_n + R_n}{2}$ (the average of the left and right endpoint sums).
Error bound: If $|f''(x)| \leq K$ on $[a,b]$, then $$|E_T| \leq \frac{K(b-a)^3}{12n^2}.$$
Key Concepts
1. Where the Formula Comes From
The area of a trapezoid with parallel sides of height $f(x_{i-1})$ and $f(x_i)$ and width $\Delta x$ is: $$\frac{\Delta x}{2}[f(x_{i-1}) + f(x_i)].$$
Summing over all $n$ subintervals: $$T_n = \sum_{i=1}^{n}\frac{\Delta x}{2}[f(x_{i-1})+f(x_i)].$$
Interior points $x_1, \ldots, x_{n-1}$ each appear twice (once as the right endpoint of one trapezoid and once as the left endpoint of the next), while $x_0 = a$ and $x_n = b$ each appear once. This gives the formula $T_n = \frac{\Delta x}{2}[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)]$.
2. The Error Bound
The error $|E_T| = \left|\int_a^b f\,dx - T_n\right|$ is bounded by $\dfrac{K(b-a)^3}{12n^2}$ where $K = \max_{a \leq x \leq b}|f''(x)|$. This says:
- The error decreases as $O(1/n^2)$: doubling the number of subintervals quarters the error.
- The error depends on the second derivative: large concavity means more curvature and larger error.
3. Over/Underestimate from Concavity
- If $f$ is concave up ($f'' > 0$): the chord (top of trapezoid) lies above the curve, so $T_n$ overestimates.
- If $f$ is concave down ($f'' < 0$): the chord lies below the curve, so $T_n$ underestimates.
This contrasts with the Midpoint Rule, which has the opposite concavity relationship.
“The Trapezoidal Rule is always more accurate than the left or right endpoint rules.” The Trapezoidal Rule has $O(1/n^2)$ error, the same as the Midpoint Rule, but both are better than the $O(1/n)$ error of the endpoint rules. However, for the same $n$, the Midpoint Rule is typically twice as accurate as the Trapezoidal Rule (they bracket the true value symmetrically for concave or convex functions).
Worked Example
Approximate $\displaystyle\int_1^3 \frac{1}{x}\,dx$ using $T_4$ and estimate the error.
$\Delta x = \frac{2}{4} = \frac{1}{2}$. Partition: $x_0=1$, $x_1=1.5$, $x_2=2$, $x_3=2.5$, $x_4=3$.
$$T_4 = \frac{1/2}{2}\left[\frac{1}{1} + 2\cdot\frac{1}{1.5} + 2\cdot\frac{1}{2} + 2\cdot\frac{1}{2.5} + \frac{1}{3}\right]$$ $$= \frac{1}{4}\left[1 + \frac{4}{3} + 1 + \frac{4}{5} + \frac{1}{3}\right] = \frac{1}{4}\left[\frac{15+20+15+12+5}{15}\right] = \frac{1}{4}\cdot\frac{67}{15} = \frac{67}{60} \approx 1.1167.$$
Error bound. $f(x) = 1/x$, $f''(x) = 2/x^3$. On $[1, 3]$, $|f''(x)| \leq 2/1 = 2$. So $K = 2$.
$|E_T| \leq \dfrac{2\cdot(2)^3}{12\cdot 16} = \dfrac{16}{192} = \dfrac{1}{12} \approx 0.083$.
Exact: $\ln 3 \approx 1.0986$. Actual error: $|1.1167 - 1.0986| \approx 0.018$, well within the bound.
Common Errors Summary
| Error | Example | Correction |
|---|---|---|
| Giving the interior points the wrong weight | Using coefficient 1 for interior points | Interior points $x_1, \ldots, x_{n-1}$ have coefficient 2; only the endpoints $x_0$ and $x_n$ have coefficient 1 |
| Using $\Delta x$ instead of $\frac{\Delta x}{2}$ in the formula | Writing $T_n = \Delta x[f(x_0) + 2f(x_1) + \cdots + f(x_n)]$ | The trapezoidal area formula has a factor of $\frac{1}{2}$; the overall factor is $\frac{\Delta x}{2}$ |
| Confusing the concavity relationship with the midpoint rule | Saying both $T_n$ and $M_n$ overestimate for concave-up functions | $T_n$ overestimates for concave-up; $M_n$ underestimates for concave-up |
Leveled Practice
Level 1 -- Direct Application
Problem 1. Approximate $\displaystyle\int_0^1 e^x\,dx$ using $T_4$.
Show answer
$\Delta x = \frac{1}{4}$. Partition points: $0, 0.25, 0.5, 0.75, 1$.
$T_4 = \frac{1/4}{2}[e^0 + 2e^{0.25} + 2e^{0.5} + 2e^{0.75} + e^1]$ $= \frac{1}{8}[1 + 2(1.2840) + 2(1.6487) + 2(2.1170) + 2.7183]$ $= \frac{1}{8}[1 + 2.5680 + 3.2974 + 4.2340 + 2.7183]$ $= \frac{1}{8}(13.8177) \approx 1.727$.
Exact: $e - 1 \approx 1.7183$.
Mastery Checklist
Mental Model
The Trapezoidal Rule replaces each horizontal-top rectangle with a slanted-top trapezoid. For a monotone function, rectangles err on one side; trapezoids straddle the curve and are more accurate. For a convex (concave-up) function, the trapezoidal chord lies above the curve the way a straight bridge arches above the terrain below it, so the trapezoid slightly overestimates the area.
Connections
Looking back
- Midpoint Rule (Section 4.2): Same $O(1/n^2)$ error; opposite concavity relationship; combining them yields Simpson’s Rule.
- Left/right endpoint sums (Section 4.1): $T_n = (L_n + R_n)/2$; the Trapezoidal Rule is simply their average.
Looking ahead
- Simpson’s Rule (Section 7.7): A weighted combination of $T_n$ and $M_n$ that achieves $O(1/n^4)$ accuracy.