Riemann Sums Explained: Techniques, Examples, and Common Mistakes
What a Riemann sum is
A Riemann sum approximates the definite integral of a function f(x) over an interval [a, b] by partitioning the interval into n subintervals, picking a sample point in each subinterval, evaluating f at those points, multiplying by subinterval widths, and summing:
Code
Rn = Σ{i=1}^n f(x_i) Δx_i
As the maximum subinterval width → 0 (n → ∞ for equal widths), R_n → ∫_a^b f(x) dx when f is integrable.
Common techniques (methods of choosing sample points)
- Left Riemann sum: use left endpoint of each subinterval (xi= x{i-1}).
- Right Riemann sum: use right endpoint (x_i = x_i).
- Midpoint rule: use midpoint of each subinterval (xi* = (x{i-1}+x_i)/2); often more accurate than left/right for smooth f.
- Upper and lower sums: choose suprema or infima of f on each subinterval to bound the integral; useful for proving integrability.
- Adaptive partitions: make Δx_i smaller where f varies rapidly to improve accuracy.
- Using symmetry or antiderivative knowledge: when possible, compute exact integral rather than approximating.
Worked example (equal-width partition)
Approximate ∫_0^2 (x^2) dx using n = 4, equal widths.
- Δx = (2−0)/4 = 0.5.
- Left sum: x_i* = 0, 0.5, 1.0, 1.5 → R_left = 0^2·0.5 + 0.5^2·0.5 + 1^2·0.5 + 1.5^2·0.5 = (0 + 0.125 + 0.5 + 1.125) = 1.75.
- Right sum: x_i* = 0.5, 1.0, 1.5, 2.0 → R_right = 0.5^2·0.5 + 1^2·0.5 + 1.5^2·0.5 + 2^2·0.5 = (0.125 + 0.5 + 1.125 + 2) = 3.75.
- Midpoint sum: midpoints 0.25, 0.75, 1.25, 1.75 → R_mid = (0.0625+0.5625+1.5625+3.0625)·0.5 = (5.25)·0.5 = 2.625. Exact integral: ∫_0^2 x^2 dx = [x^⁄3]_0^2 = ⁄3 ≈ 2.6667. Midpoint is closest here.
Error behaviour and convergence
- For equal-width partitions, Δx = (b−a)/n. Riemann sums converge to the integral as n → ∞ if f is integrable.
- If f is continuous and has a bounded derivative, the midpoint rule’s error scales like O(1/n^2) while left/right sums scale like O(1/n).
- Discontinuities or unbounded variation can prevent convergence; use upper/lower sums to test integrability.
Common mistakes
- Using too few subintervals for functions with rapid change.
- Confusing left/right sums sign when function is negative (left/right may underestimate/overestimate depending on monotonicity and sign).
- Forgetting nonuniform Δx_i when partitions are unequal.
- Treating Riemann sums as exact integrals without taking the limit.
- Miscomputing midpoints or Δx (off-by-one in indices).
Quick tips
- Use midpoint or Simpson’s rule for better accuracy when numerical value is needed.
- For proofs about integrability, use upper and lower sums and show they can be made arbitrarily close.
- Check monotonicity and sign to predict whether left/right sums over- or under-estimate.