Riemann Sum — Midpoint Approximation

April 12, 2026

Problem

Approximate ∫₀⁴ x² dx using 8 midpoint rectangles.

Explanation

The midpoint Riemann sum uses the function value at the center of each subinterval. For most functions this is dramatically more accurate than left or right sums — the over-and-under errors of the rectangle's two halves tend to cancel.

The Setup

The midpoint of the ii-th subinterval is:

xi=a+(i+12)Δxx_i^{*} = a + \left(i + \tfrac{1}{2}\right)\Delta x

The midpoint Riemann sum is:

Mn=i=0n1f(xi)ΔxM_n = \sum_{i=0}^{n-1} f(x_i^{*})\,\Delta x

Step-by-Step Solution

Given: f(x)=x2f(x) = x^{2}, a=0a = 0, b=4b = 4, n=8n = 8.

Find: The midpoint Riemann sum M8M_8.


Step 1 — Compute Δx\Delta x.

Δx=408=0.5\Delta x = \dfrac{4 - 0}{8} = 0.5

Step 2 — List the midpoints.

The first midpoint is at 0+(0+0.5)0.5=0.250 + (0 + 0.5)\cdot 0.5 = 0.25, then they spread out by Δx=0.5\Delta x = 0.5:

xi=0.25,  0.75,  1.25,  1.75,  2.25,  2.75,  3.25,  3.75x_i^{*} = 0.25,\; 0.75,\; 1.25,\; 1.75,\; 2.25,\; 2.75,\; 3.25,\; 3.75

Step 3 — Evaluate f(xi)=(xi)2f(x_i^{*}) = (x_i^{*})^{2}.

(0.25)2=0.0625,      (0.75)2=0.5625,      (1.25)2=1.5625,      (1.75)2=3.0625,(0.25)^{2} = 0.0625, \;\;\; (0.75)^{2} = 0.5625, \;\;\; (1.25)^{2} = 1.5625, \;\;\; (1.75)^{2} = 3.0625,

(2.25)2=5.0625,      (2.75)2=7.5625,      (3.25)2=10.5625,      (3.75)2=14.0625(2.25)^{2} = 5.0625, \;\;\; (2.75)^{2} = 7.5625, \;\;\; (3.25)^{2} = 10.5625, \;\;\; (3.75)^{2} = 14.0625

Step 4 — Sum the function values.

i=07f(xi)=0.0625+0.5625+1.5625+3.0625+5.0625+7.5625+10.5625+14.0625=42.5\sum_{i=0}^{7} f(x_i^{*}) = 0.0625 + 0.5625 + 1.5625 + 3.0625 + 5.0625 + 7.5625 + 10.5625 + 14.0625 = 42.5

Step 5 — Multiply by Δx\Delta x.

M8=0.5×42.5=21.25M_8 = 0.5 \times 42.5 = 21.25

Step 6 — Compare to the exact value.

04x2dx=64321.333\int_{0}^{4} x^{2}\,dx = \dfrac{64}{3} \approx 21.333

The error is only 21.33321.25=0.08321.333 - 21.25 = 0.083 — about 0.4%! Compare this to the left sum's 18% error and the right sum's 20% error with the exact same number of subdivisions. The midpoint rule is dramatically better.

Why? Inside each subinterval, the curve is approximately linear. The midpoint rectangle's height matches the line's average value over the interval — so it counts the high half of the interval and the low half exactly equally. The error is proportional to ff'' (concavity) rather than ff' (slope), which makes it converge much faster as nn \to \infty.


Answer: The midpoint Riemann sum with n=8n = 8 rectangles is

  M8=21.25  \boxed{\;M_8 = 21.25\;}

This is within 0.4% of the exact value 64321.333\dfrac{64}{3} \approx 21.333. With the same number of rectangles, midpoint dominates left and right sums. Even better is Simpson's rule, which combines midpoint and trapezoidal sums to get error proportional to f(4)f^{(4)}.

Try It

  • Adjust n — see how quickly the midpoint error vanishes (it shrinks like 1/n21/n^{2}, twice as fast as left/right).
  • Toggle show exact area to compare against the true region.
  • Notice how each rectangle's top spans both above and below the curve — the over-counting on one side cancels the under-counting on the other.

Interactive Visualization

Parameters

8.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Riemann Sum — Midpoint Approximation | MathSpin