AP Calculus AB and BC

Riemann Sum Slider: Drag n, Watch the Error Vanish

A Riemann sum estimates area under a curve by slicing the interval into n rectangles and summing their areas; the definite integral is the value that sum approaches as n grows. Drag n from 1 to 200 and the rectangle tops collapse onto the curve as the error falls toward zero. Midpoint and trapezoid converge fastest.

\int_{0}^{2} x^2\,dx = 2.6667
left sum 2.1875, exact integral 2.6667, error 0.4792. The left sum is an underestimate here.
left sum, n = 8
2.1875
exact integral
2.6667
error
0.4792
Error (log scale)The left sum is an underestimate here

Full bar is the worst single-rectangle error for this function; empty means the sum is within 0.0001 of the exact integral.

This slider turns the definition of the definite integral into something you can watch happen. Cut the interval [a,b][a,b] into nn equal strips, cap each strip with a rectangle, and add their areas: that total is a Riemann sum, an estimate of the area under the curve (Topics 6.2 and 6.3). When ff is a rate of change, that area is the change it accumulates (CHA-4.A.1). Drag nn upward and every strip narrows, its top has less room to miss the curve, and the running total creeps toward one fixed number.

abf(x)dx=limni=1nf(xi)Δx,Δx=ban\int_a^b f(x)\,dx = \lim_{n \to \infty} \sum_{i=1}^{n} f(x_i^{*})\,\Delta x, \qquad \Delta x = \frac{b-a}{n}

That fixed number is the definite integral. As the strip widths shrink toward 00, the Riemann sums approach abf(x)dx\int_a^b f(x)\,dx exactly, and this limit is the definition of the integral (LIM-5.C.1). The error readout is the distance between your current sum and that exact value, so dragging nn from 11 toward 200200 is a hands-on version of taking the limit.

The left, right, and midpoint buttons change one thing only: the sample point xix_i^{*}, meaning where each strip reads its single height (the left edge, the right edge, or the center). The trapezoidal button instead reads both edges of each strip and slants the top between them, which is the same as averaging the left and right sums. Keep nn fixed and click through all four to see which tops overshoot the curve and which fall short.

Predict which side you land on before you compute

You can name which side of the true value an estimate falls on with no arithmetic, and this recognition is worth quick points on multiple choice (Topic 6.2, LIM-5.A.4). Monotonicity settles the one-sided sums: for an increasing ff the left sum sits under the curve and the right sum sits above, and a decreasing ff flips both. Concavity settles the other two: on a concave-up graph the midpoint sum reads low and the trapezoidal sum reads high, trapping the exact integral between them, and concave down flips both.

How to read it

The panel shows the graph of ff on [a,b][a,b] with the current strips shaded under it, the value of the Riemann sum, the exact integral, and the error between them. The slider along the bottom sets nn, the number of subintervals, from 11 up to 200200. The four buttons pick left, right, midpoint, or trapezoidal, and the strips redraw the instant you change either control.

  • Drag nn from 11 to 200200 on any method and watch the error fall toward 00 while the strips fuse into the shaded region under the curve.
  • Pick an increasing stretch and compare left versus right at the same nn: the left tops tuck under the curve, the right tops poke above, and the true value sits bracketed between the two sums.
  • Put midpoint and trapezoidal head to head against left and right at the same nn: the centered and slanted tops post a smaller error right away.
  • Push nn to 200200 and note how many decimal places of the sum now match the exact value.

Freeze the slider at n=4n = 4 with f(x)=x2f(x) = x^2 on [0,2][0, 2] and check the left rule by hand. Here Δx=24=0.5\Delta x = \frac{2}{4} = 0.5, the left endpoints are 0,0.5,1,1.50, 0.5, 1, 1.5, and their heights are 0,0.25,1,2.250, 0.25, 1, 2.25. The heights sum to 3.53.5, and multiplying by Δx=0.5\Delta x = 0.5 gives 1.751.75. The exact area is the definite integral:

02x2dx=832.667\int_0^2 x^2\,dx = \frac{8}{3} \approx 2.667

The left estimate of 1.751.75 undershoots that true value by about 0.90.9. Switch methods at the same nn and each one reads the height differently, so each lands somewhere else:

RuleReads height atEstimate at n=4n = 4Side of 832.667\frac{8}{3} \approx 2.667
Leftleft endpoints1.751.75under
Rightright endpoints3.753.75over
Midpointmidpoints2.6252.625under (close)
Trapezoidaledge average2.752.75over (close)

The other three rules keep the same Δx=0.5\Delta x = 0.5 but read the strip heights elsewhere. Right: the right endpoints 0.5,1,1.5,20.5, 1, 1.5, 2 have heights 0.25,1,2.25,40.25, 1, 2.25, 4, which sum to 7.57.5, and 7.50.5=3.757.5 \cdot 0.5 = 3.75. Midpoint: the midpoints 0.25,0.75,1.25,1.750.25, 0.75, 1.25, 1.75 have heights 0.0625,0.5625,1.5625,3.06250.0625, 0.5625, 1.5625, 3.0625, which sum to 5.255.25, and 5.250.5=2.6255.25 \cdot 0.5 = 2.625. Trapezoidal: average the left and right totals, (1.75+3.75)/2=2.75(1.75 + 3.75)/2 = 2.75.

Watch how fast the error falls, not just that it falls

Double nn on a left or right sum and the error roughly halves; double it on a midpoint or trapezoidal sum and the error drops to roughly a quarter. That gap is the whole reason free-response questions that hand you a table of values ask for a trapezoidal estimate: with only a few data points, a slanted top wrings far more accuracy out of the same strips. The exam never asks you to compute a Riemann sum error bound, but the slider makes the pattern impossible to miss.

Frequently asked questions

Does the left or right Riemann sum overestimate?

It depends on whether the function is increasing or decreasing, not on the words left or right. On an increasing interval the right sum overestimates and the left sum underestimates; on a decreasing interval it is reversed. The slider makes it obvious: pick an increasing stretch and every right rectangle pokes above the curve while every left rectangle tucks below it.

Which Riemann sum is the most accurate?

For the same nn the midpoint and trapezoidal sums are almost always closer than the left or right sums, because a centered or slanted top follows a sloping curve better than a top pinned to one edge. Drag nn up with each method selected and the error readout confirms it: left and right trail behind while midpoint and trapezoidal race to the exact value. One exception is a straight-line ff, where the midpoint and trapezoidal sums are exact at every nn.

What happens to a Riemann sum as n approaches infinity?

As nn \to \infty the subinterval widths shrink to zero and the Riemann sum approaches one number, the definite integral abf(x)dx\int_a^b f(x)\,dx. That limit is the formal definition of the definite integral (Topic 6.3, LIM-5.C.1). On the slider you see it as the error collapsing toward zero as you drag nn toward 200200, though for a curved graph no finite nn ever drives the error to exactly zero.