Trapezoidal Rule

The trapezoidal rule estimates the area under a curve with trapezoids instead of rectangles. With n equal pieces of width Δx, the estimate is T_n = \frac{\Delta x}{2}\left[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)\right]. It equals the average of the left and right Riemann sums and is usually more accurate than either.

Before this lesson: Riemann Sums, Area of Trapezoids and Concavity and Inflection Points

Why trapezoids work better

A rectangle has a flat top, so it misses the slope of the curve over each piece. A trapezoid joins the two endpoint heights with a slanted line, which follows the curve much more closely. Its area is the width times the average of the two heights: \frac{\Delta x}{2}\left[f(x_{i-1}) + f(x_i)\right].

Graph of y = x² on [0, 2] with four trapezoids of width 0.5. Their slanted tops connect the points (0, 0), (0.5, 0.25), (1, 1), (1.5, 2.25) and (2, 4) on the curve. The tops sit slightly above the curve, so the total area, 2.75, is a little more than the true area 8/3 ≈ 2.667.
The trapezoid tops are chords of the curve. On a concave up curve they lie above it, so T₄ = 2.75 overestimates.

The trapezoidal rule formula

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], \quad \Delta x = \frac{b - a}{n}

Every inside point is shared by two trapezoids, so it is counted twice; the two endpoints are counted once. You can also compute T_n = \frac{L_n + R_n}{2}.

Over or under? If f is concave up, the trapezoid tops lie above the curve, so Tₙ is an overestimate. If f is concave down, Tₙ is an underestimate.

Trapezoidal rule examples

Example 1: A parabola

Use the trapezoidal rule with n = 4 to estimate the area under f(x) = x^2 on [0, 2].

\Delta x = 0.5, \; \frac{\Delta x}{2} = 0.25

Width of each piece, and half of it.

f(0) = 0, \; f(0.5) = 0.25, \; f(1) = 1, \; f(1.5) = 2.25, \; f(2) = 4

Heights at x₀ through x₄.

0 + 2(0.25 + 1 + 2.25) + 4 = 0 + 7 + 4 = 11

Double the inside heights and add.

T_4 = 0.25(11) = 2.75

Multiply by Δx/2.

Answer: T₄ = 2.75. Check: (L₄ + R₄)/2 = (1.75 + 3.75)/2 = 2.75. The true area is 8/3 ≈ 2.667, and x² is concave up, so T₄ is a little high.

Example 2: A curve with no easy formula yet

Estimate the area under f(x) = \frac{1}{x} on [1, 3] with n = 4.

\Delta x = 0.5, \; \frac{\Delta x}{2} = 0.25

Width and half-width.

f(1) = 1, \; f(1.5) \approx 0.6667, \; f(2) = 0.5, \; f(2.5) = 0.4, \; f(3) \approx 0.3333

Heights.

1 + 2(0.6667 + 0.5 + 0.4) + 0.3333 \approx 4.4667

Double the inside heights and add.

T_4 = 0.25(4.4667) \approx 1.1167

Multiply by Δx/2.

Answer: about 1.1167. The true value is ln 3 ≈ 1.0986, so the error is only about 0.018.

Example 3: A table with equal spacing

A car’s speed is recorded every 10 seconds. Use the trapezoidal rule to estimate the distance it travels in 40 seconds.

t (s)010203040
v(t) (m/s)012202528
\frac{\Delta t}{2} = \frac{10}{2} = 5

Half the spacing.

0 + 2(12 + 20 + 25) + 28 = 0 + 114 + 28 = 142

Double the inside speeds and add.

T_4 = 5(142) = 710

Multiply.

Answer: about 710 m. This is exactly halfway between the left and right sums, 570 m and 850 m, from Riemann sums.

Example 4: A table with unequal spacing

Water flows into a tank at the rates below (gallons per minute). Estimate the total water added from t = 0 to t = 9.

t (min)0259
r(t) (gal/min)4697
\frac{4 + 6}{2}(2) = 10

First trapezoid: width 2 − 0 = 2.

\frac{6 + 9}{2}(3) = 22.5

Second trapezoid: width 5 − 2 = 3.

\frac{9 + 7}{2}(4) = 32

Third trapezoid: width 9 − 5 = 4.

10 + 22.5 + 32 = 64.5

Add the three areas.

Answer: about 64.5 gallons. With unequal widths, find each trapezoid separately; the shortcut formula needs equal widths.

Example 5: Word problem with a pond

A pond is 20 m long. Its width is measured every 4 m along its length: 0, 6, 8, 7, 5 and 0 m. Estimate the pond’s surface area.

\frac{\Delta x}{2} = \frac{4}{2} = 2

Five pieces of width 4.

0 + 2(6 + 8 + 7 + 5) + 0 = 52

Double the inside widths and add.

T_5 = 2(52) = 104

Multiply.

Answer: about 104 m². Surveyors use this method to estimate areas of land and water from a few measurements.

Common mistakes

MistakeExample of the errorFix
Doubling the endpoints0.25[2(0) + 2(0.25) + \cdots + 2(4)]Only the inside values are doubled.
Using Δx instead of Δx/20.5(11) = 5.5 in Example 1The formula starts with Δx/2 = 0.25.
Using the shortcut with unequal widthsApplying one Δt to Example 4Find each trapezoid with its own width.
Mixing up over and underCalling T₄ for x² an underestimateConcave up means the tops lie above the curve: an overestimate.
Counting n wrongUsing n = 5 for five data pointsFive points make four trapezoids: n = 4.

Related methods

Comparing methods

For a smooth function, the midpoint and trapezoidal rules are both much better than left or right sums. Their errors usually have opposite signs, which is the idea behind Simpson’s rule, a Calculus 2 method that combines them for even better accuracy.

Toward the exact area

As n grows, Tₙ approaches the exact area under the curve, the definite integral. The next lesson defines it as the limit of these sums.

Practice problems

  1. Use T₄ to estimate the area under f(x) = x on [0, 4]. Compare with the exact area.
  2. Use T₂ for f(x) = x^3 on [0, 2].
  3. Use T₄ for f(x) = \sqrt{x} on [0, 4]. Is it an over- or underestimate?
  4. Use T₂ for f(x) = e^x on [0, 1].
  5. Use T₂ for f(x) = sin x on [0, π].
  6. A left sum is 10 and the right sum is 14 for the same n. What is the trapezoidal estimate?
  7. Use the trapezoidal rule with the table: x = 0, 1, 2, 3 and f(x) = 2, 5, 6, 4.
  8. A runner’s speed (m/s) is 10 at t = 0, 14 at t = 1, 20 at t = 3 and 18 at t = 4. Estimate the distance run in 4 s.
  9. Is the trapezoidal estimate for \int_0^2 x^2\,dx too high or too low? Why?
  10. A river is 20 ft wide. Its depth every 5 ft across is 0, 4, 7, 6 and 0 ft. Estimate the area of the cross-section.
Show answers

1.

0.5\left[0 + 2(1 + 2 + 3) + 4\right] = 0.5(16)

Δx = 1, so Δx/2 = 0.5.

T_4 = 8

Multiply.

Answer: 8, which is exact, because the graph is a straight line

2.

0.5\left[0 + 2(1) + 8\right] = 0.5(10)

Δx = 1; f(0) = 0, f(1) = 1, f(2) = 8.

T_2 = 5

Multiply.

Answer: 5 (the true area is 4)

3.

0.5\left[0 + 2(1 + 1.4142 + 1.7321) + 2\right] \approx 0.5(10.2926)

Δx = 1; square roots of 0 to 4.

T_4 \approx 5.146

Multiply.

Answer: about 5.146, an underestimate, because √x is concave down (the true area is 16/3 ≈ 5.333)

4.

0.25\left[1 + 2(1.6487) + 2.7183\right] \approx 0.25(7.0157)

Δx = 0.5; e⁰, e^0.5 and e¹.

T_2 \approx 1.754

Multiply.

Answer: about 1.754 (the true area is e − 1 ≈ 1.718)

5.

\frac{\pi}{4}\left[0 + 2(1) + 0\right] = \frac{\pi}{2}

Δx = π/2; sin 0 = 0, sin(π/2) = 1, sin π = 0.

Answer: π/2 ≈ 1.571 (the true area is 2)

6.

T = \frac{10 + 14}{2} = 12

Tₙ is the average of Lₙ and Rₙ.

Answer: 12

7.

0.5\left[2 + 2(5 + 6) + 4\right] = 0.5(28) = 14

Δx = 1.

Answer: 14

8.

\frac{10 + 14}{2}(1) + \frac{14 + 20}{2}(2) + \frac{20 + 18}{2}(1)

Unequal widths 1, 2 and 1.

12 + 34 + 19 = 65

Add the three areas.

Answer: about 65 m

9.

f''(x) = 2 \gt 0

x² is concave up.

Answer: too high. The trapezoid tops are chords that lie above a concave up curve.

10.

2.5\left[0 + 2(4 + 7 + 6) + 0\right] = 2.5(34)

Δx = 5, so Δx/2 = 2.5.

T_4 = 85

Multiply.

Answer: about 85 ft²

Trapezoidal rule FAQ

What is the trapezoidal rule formula?

T_n = \frac{\Delta x}{2}[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)], with \Delta x = \frac{b - a}{n}.

Is the trapezoidal rule the average of the left and right sums?

Yes. Averaging Lₙ and Rₙ counts each inside point twice and each endpoint once, which is exactly the trapezoidal rule.

When does the trapezoidal rule overestimate?

When the function is concave up on the interval. When it is concave down, the rule underestimates.

Is the trapezoidal rule more accurate than a Riemann sum?

Usually it is far better than a left or right sum with the same n. It is about as accurate as the midpoint sum, with an error of the opposite sign.

Summary

  • T_n = \frac{\Delta x}{2}[f(x_0) + 2f(x_1) + \cdots + 2f(x_{n-1}) + f(x_n)].
  • Inside values count twice; endpoints count once.
  • Tₙ = (Lₙ + Rₙ)/2.
  • Concave up: overestimate. Concave down: underestimate.
  • With unequal widths, add the trapezoids one at a time.

Previous lesson: Riemann Sums

Next lesson: Definite Integrals

Back to the Calculus 1 Index