Learn
Lesson · Accumulation and the Integral · Adding up a rate

The Trapezoid and Midpoint Rules

The trapezoid rule averages the left and right sums; the midpoint rule reads the rate at the middle of each piece. On a quadratic rate both errors are exact multiples of the square of the width, so doubling the pieces divides each by exactly four, and the midpoint error is half the trapezoid error with the opposite sign. Neither rule is exact for every polynomial.

Tₙ = (Lₙ + Rₙ)/2, Mₙ from midpoint rates t² on [0, 1]: T₄ = 11/32, M₄ = 21/64 errors: T₄ is 1/96 high, M₄ is 1/192 low doubling n: the error divides by 4 exact for straight lines only
Two better rules and what they cost

Core ideas

What this lesson establishes

Three ideas: two ways to use the same pieces better, the error they leave on a quadratic, and the limit of what either rule can do.

1

The trapezoid rule averages the two ends

Replace the flat top of each piece by the straight line between the rate at the left end and the rate at the right end. The area of that trapezoid is the average of the two end rates times the width, and the sum of the pieces is Tₙ = (Lₙ + Rₙ)/2.

2

The midpoint rule reads the rate in the middle

Freeze each piece at the rate in the middle of the piece instead of at an end. The overshoot on one half of the piece largely cancels the undershoot on the other. The sum is Mₙ.

3

Both rules err by the square of the width, on a quadratic

For t² the trapezoid error is exactly h²/6 on the interval from 0 to 1, and the midpoint error is exactly −h²/12. Halving h divides each by 4. Neither is zero: the rules are exact for straight lines, and on a curve only by accident.

The material

Two rules, one exact ratio, and a limit

The definitions, the arithmetic on a quadratic, the proof that the ratio is four there, and the rate for which it is only close to four.

Definition · The trapezoid and midpoint sums

With the pieces of the earlier lessons and width h, the trapezoid sum is Tₙ = (Lₙ + Rₙ)/2, equivalently the sum over pieces of h·(f(left) + f(right))/2.

The midpoint sum is Mₙ = h·(f(m₁) + … + f(mₙ)), where mₖ is the middle of the kth piece.

On the square t² over the interval from 0 to 1 with four pieces, the earlier lessons found L₄ = 7/32 and R₄ = 15/32. The average is T₄ = (7/32 + 15/32)/2 = 11/32. The lab's total is 1/3, and 11/32 − 1/3 = 1/96: the trapezoid sum is high, because the rate curves upward and the chord lies above the curve.

The midpoints of the four pieces are 1/8, 3/8, 5/8, 7/8, and the squares of those are 1, 9, 25, 49 over 64. So M₄ = (1/4)·(1 + 9 + 25 + 49)/64 = 84/256 = 21/64. Switch the rule control to midpoints and the lab prints 21/64 with error −1/192. The midpoint sum is low, by half as much as the trapezoid sum is high.

t² on [0, 1] sum error (sum − 1/3) T₄ 11/32 1/96 T₈ 43/128 1/384 M₄ 21/64 −1/192 M₈ 85/256 −1/768 T error ratio: (1/96)/(1/384) = 4
Theorem · Both errors are fixed multiples of the square of the width

For t² on the interval from 0 to 1, Tₙ − 1/3 = h²/6 and Mₙ − 1/3 = −h²/12, where h = 1/n.

Take one piece from x to x + h. The total over it is ((x + h)³ − x³)/3 = h·(x² + xh + h²/3), which is the claim the lab confirms on the whole interval at 1/3; the next lesson, “The Antiderivative and the Fundamental Theorem”, shows where it comes from. The trapezoid contributes h·(x² + (x + h)²)/2 = h·(x² + xh + h²/2), which exceeds it by h·h²/6 = h³/6. The midpoint contributes h·(x + h/2)² = h·(x² + xh + h²/4), which falls short by h³/12.

Neither excess depends on x, so over n pieces they add to n·h³/6 and −n·h³/12; with n·h = 1 that is h²/6 and −h²/12. Halving h divides both by exactly 4.

□

That is the exact ratio of 4 the lab prints: T₄ and T₈ have errors 1/96 and 1/384. The proof is for the square; the lab does not extend it to other rates, and the ratio for a cubic is a separate computation.

Exact for straight lines, and not for what bends

The trapezoid rule uses both ends, which makes it tempting to think it is exact whenever it has enough information. It is exact for every straight-line rate; on a curve it is exact only by accident, and on t² it is high by h²/6 at every n. The quartic preset, t⁴ on the interval from 0 to 1, makes the same point and adds a refinement. Its trapezoid errors are 53/2560 at n = 4 and 213/40960 at n = 8, and their ratio is 848/213, about 3.98122. It approaches 4 and is not 4.

A cubic is kinder: on t³ over the interval from 0 to 1 the trapezoid errors are exactly 1/64, 1/256, 1/1024 for n = 4, 8, 16, and the ratio is exactly 4. Type the cubic into the rate box and read it. On every quadratic and cubic rate the trapezoid error is a fixed multiple of h², so whenever that error is not already zero its ratio is exactly 4; t⁴ is the first power whose error is not such a multiple.

Interactive

Sums of a rate

Left, right, trapezoid and midpoint sums as fractions

Adding up a raten pieces of width h = (b − a)/n, each rate times width
the rate fthe pieces

Method

Choosing and checking a rule

Compute with whichever rule you like, then check it against the exact errors the square gives you.

1

Compute the left and right sums, or the midpoint rates

For the trapezoid rule you can reuse the two sums you already have. For the midpoint rule list the middle of each piece: left end plus h/2.

2

Form the sum

Tₙ = (Lₙ + Rₙ)/2, or Mₙ = h times the midpoint rates added. Keep the fraction exact.

3

Compare with the exact total and note the sign

On a rising, upward-bending rate the trapezoid sum is above the total and the midpoint sum below. The signs, not just the sizes, say how the rules relate.

4

Double the pieces and take the ratio

For a quadratic or a cubic, expect exactly 4. For a higher power, expect a ratio near 4; a figure far from 4 means the rate is not smooth enough for the pieces you chose.

5

Say which rule is exact for what

Straight lines only. A rule that is exact for lines and off by h²/6 on a parabola is a good rule and not an exact one.

Trapezoids and midpoints

Score 0 / 0

The trapezoid and midpoint sums of t², exactly

Compute T₄, T₈ and M₄ for t² on the interval from 0 to 1, their errors against the total 1/3, and the trapezoid error ratio.

T₄ = (7/32 + 15/32)/2 = 11/32; 11/32 − 1/3 = 1/96 T₈ = 43/128; 43/128 − 1/3 = 1/384 ratio (1/96)/(1/384) = 4 exactly midpoints of 4 pieces: 1/8 3/8 5/8 7/8 squares over 64: 1 9 25 49 M₄ = (1/4)·(1 + 9 + 25 + 49)/64 = 84/256 = 21/64 M₄ − 1/3 = −1/192: half of 1/96, opposite sign

At four pieces the trapezoid sum is high by 1/96, about a hundredth, and the midpoint sum is low by half that, with the opposite sign. That opposition is why a weighted combination of the two can do better than either, which is a numerical-analysis topic left alone here.

For a rehearsal, switch the lab's rule to midpoints and set the pieces to 8. The supplied first move is that the midpoints are 1/16, 3/16, …, 15/16. You should find 85/256 and an error of −1/768, a ratio of 4 again.

Common mistakes

1
Believing the trapezoid rule is exact for every polynomial because it uses both endsUsing both ends gives a straight-line approximation in each piece, and a straight line is exact only for a straight line. On t² the trapezoid sum is 11/32, the total is 1/3, and the error is 1/96 at four pieces, 1/384 at eight: smaller each time and never zero.
2
Expecting the same sign of error from both rulesOn t² the trapezoid sum is high and the midpoint sum is low, by half as much. Calling both errors “the error” and averaging their sizes loses the fact that they have opposite signs.
3
Taking a ratio of 4 as a law for all smooth ratesThe ratio is exactly 4 for t² and for t³, and 848/213 for t⁴. Near 4 for a smooth rate is a reasonable expectation; exactly 4 is a property of particular rates, and the lab tells you which.

Check your understanding

✓
Finish when you can compute trapezoid and midpoint sums exactly and predict how their errors fall.

You should be able to form Tₙ from Lₙ and Rₙ, list the midpoints and form Mₙ, find both errors against the exact total with their signs, show that on a quadratic the trapezoid error divides by exactly 4 when the pieces double, and say why neither rule is exact beyond straight lines.

Note: All four rules are now sums of rate times width that approach a number the lab prints as an exact total. “The Antiderivative and the Fundamental Theorem” shows where that number comes from without any sum.

Kept in this browser only, for you. Nothing is sent anywhere and nothing checks it. Carry it to another device.

Feedback and recommendations

Something to change about this lesson? Write it down, tick it off when it is handled, and export the list when you want to act on it. Kept in this browser only: nothing is sent anywhere, and nobody is notified.

No recommendations yet for this lesson.