edubun
English

Riemann sums and the midpoint rule

With just four rectangles, the midpoint sum for x² on [0, 2] is 2.625, already within 0.042 of the exact 8/3.

Any point in each piece

Left and right ends are two choices among many. In general, pick any point xi* in the i-th piece and use f(xi*) as the height. The total Σi=1n f(xi*)Δx is called a Riemann sum, named, as OpenStax notes, after the 19th-century mathematician Bernhard Riemann, who developed the idea. Left and right sums are Riemann sums; so is the midpoint sum Mn, which takes each height at the middle of its piece.

The midpoint sum is usually much better than either endpoint sum. For x² on [0, 2] with n = 4, the midpoints are 0.25, 0.75, 1.25 and 1.75. Their squares are 0.0625, 0.5625, 1.5625 and 3.0625, which add to 5.25; times Δx = 0.5 gives M4 = 2.625. Compare: L4 = 1.75 and R4 = 3.75 were off by about 0.92 and 1.08. The reason is visible on a graph. In each piece, the rectangle cuts off a small sliver of the curve on one side and adds a similar sliver on the other, and the two nearly cancel.

M4 for y = x² on [0, 2]. Each rectangle takes its height at the dot in the middle of its piece; the corners above and below the curve almost balance.
nLnRnMn
41.753.752.625
82.18753.18752.6563
162.42192.92192.6641
322.54302.79302.6660

The table above, rounded to four decimal places, shows the pattern for x² on [0, 2]. Each time n doubles, the endpoint errors roughly halve, while the midpoint error drops to about a quarter: 0.042, 0.010, 0.0026, 0.00065. All three columns head for the same number, 2.6666…, and the definite integral in the next unit is defined as exactly that common limit.

There is a quick link between the three sums. The average of the left and right sums, (Ln + Rn)/2, is the trapezoid rule, which replaces each rectangle with a trapezoid joining the two ends of the curve. For x² on [0, 2] with n = 4 it gives (1.75 + 3.75)/2 = 2.75, too high by about 0.083, roughly twice the midpoint error and on the other side. That pattern, trapezoids overshooting a curve that bends upward while midpoint rectangles undershoot it by about half as much, holds for many smooth curves and is the starting point for Simpson's rule in later courses.

Computers rely on exactly these sums. When a function has no convenient antiderivative, or when it is known only from measured data, a program adds thousands of midpoint or trapezoid pieces. The lab below caps n at 64 so you can still see the rectangles, but the pattern in the table continues: each doubling makes the midpoint error about four times smaller.

Upper and lower sums

If you want a guaranteed overestimate, choose xi* where f is largest on each piece; the result is an upper sum. Choosing where f is smallest gives a lower sum, a guaranteed underestimate. The true area is always between them. For a function that only increases or only decreases on the interval, the largest and smallest values sit at the endpoints, so the upper and lower sums are just the right and left sums in some order. OpenStax's curve (x − 1)³ + 4 on [0, 2] is increasing, with L4 = 7.5 and R4 = 8.5, and both approach 8 as n grows.

Loading

Drag to turn. Scroll or pinch to zoom.

OpenStax's (x − 1)³ + 4 on [0, 2]. The panel lists Ln, Rn and Mn together with the exact area 8; here the midpoint sum hits 8 exactly because the curve is symmetric about (1, 4).
  1. M4 for x² on [0, 2]?
  2. M2 for x² on [0, 2]?
  3. L4 for (x − 1)³ + 4 on [0, 2]?
  4. R4 for the same function?
  5. L2 for f(x) = 4 − x² on [0, 2]?
  6. For 4 − x² on [0, 2] (decreasing), the left sum is:
    • an overestimate (an upper sum)
    • an underestimate
    • exact
    • zero
  7. Doubling n cuts the midpoint error for x² by about:
    • a factor of 4
    • a factor of 2
    • nothing
    • a factor of 10
  8. Who is the Riemann sum named after?
    • Bernhard Riemann, 19th century
    • Archimedes
    • Isaac Newton
    • René Descartes
  9. The exact area under x² on [0, 2] is 8/3. Give it to 3 decimals.
  10. A Riemann sum Σ f(xi*)Δx needs:
    • one sample point in each piece
    • the exact area first
    • f to be increasing
    • n to be even
Key points
  • Riemann sum: Σ f(xi*)Δx with any sample point in each piece.
  • Midpoint sum Mn is usually far more accurate than Ln or Rn.
  • Upper and lower sums bracket the area.
  • All Riemann sums of a continuous f approach the same number as n grows.
Sources for this course (6)
  • OpenStax, Calculus Volume 1 , chapter 5 Integration: 5.1 Approximating Areas (Archimedes and the method of exhaustion; sigma notation with Σ 3^i for i = 1 to 5 = 363; left and right endpoint approximations L4 = 1.75 and R4 = 3.75 for x² on [0, 2], L6 = 3.4375 and R6 = 5.6875 for x²/2 on [0, 3]; (x − 1)³ + 4 on [0, 2] approaching 8; Riemann sums named for the 19th-century mathematician Bernhard Riemann; upper and lower sums: openstax.org/books/calculus-volume-1/pages/5-1-approximating-areas)
  • 5.2 The Definite Integral (limit of Riemann sums, integrability of continuous functions, net signed area, properties: .../pages/5-2-the-definite-integral)
  • 5.3 The Fundamental Theorem of Calculus (Newton and Leibniz, among others, late 1600s and early 1700s; mean value theorem for integrals; parts 1 and 2: .../pages/5-3-the-fundamental-theorem-of-calculus)
  • 5.4 Integration Formulas and the Net Change Theorem (.../pages/5-4-integration-formulas-and-the-net-change-theorem)
  • 4.10 Antiderivatives (.../pages/4-10-antiderivatives)
  • MacTutor, University of St Andrews: Archimedes (287 BC to 212 BC; area of a parabolic segment; π bounded with 96-sided inscribed and circumscribed polygons: mathshistory.st-andrews.ac.uk/Biographies/Archimedes) and Leibniz (first used the ∫ f(x) dx notation in a manuscript of 21 November 1675: mathshistory.st-andrews.ac.uk/Biographies/Leibniz).

Checked: 2026-10-17