Back

Riemann Sums and the Integral

The definite integral is defined as a limit of sums: slice the interval $[a,b]$ into $n$ pieces of width $h = (b-a)/n$, build a rectangle on each piece whose height is the function at some sample point, and add their areas, $S_n = \sum_i f(x_i^*)\,h$; as $n\to\infty$ the staircase of rectangles squeezes onto the curve and $S_n$ converges to $\int_a^b f\,dx$. Which point you sample sets the rule and how fast it converges. The left and right endpoints systematically over- or under-shoot, so their error shrinks only as $1/n$. The midpoint splits the difference and the trapezoid joins consecutive heights with a straight line; both cancel the leading error and converge twice as fast, as $1/n^2$. Slide the number of rectangles up and watch the sum close in on the exact value, then read the convergence rate straight off the log-log error plot: a line of slope minus one for the endpoint rules, minus two for the midpoint and trapezoid.

Figure 1. Riemann sums and the integral. Top: f(x) with n rectangles (left, right, midpoint, or trapezoid, blue) approaching the exact area under the curve (green), with the sum, the exact integral, and the error. Bottom: the error versus n on log-log axes, falling as 1/n for the endpoint rules and 1/n squared for the midpoint and trapezoid, against reference slopes. Method: closed-form functions with exact integrals. Source: Stewart, Calculus, 8th ed., Sec. 5.2 and 7.7.
n8

WHAT TO TRY

  • Slide n up: the rectangles thin out, the staircase hugs the curve, and the sum closes in on the exact integral (the error shrinks in the bottom plot).
  • Cycle the rule: the left and right rectangles lean over or under the curve, while the midpoint and trapezoid hug it far more tightly at the same n.
  • Read the slope in the bottom plot: the left and right errors parallel the 1/n reference line, the midpoint and trapezoid the steeper 1/n squared line.
  • Try the sine on its half period: the endpoint rules become unexpectedly accurate there because the function returns to the same value at both ends.