Approximate definite integrals using left, right, midpoint, and trapezoidal rules. Visualize rectangles and see exact integral with error analysis.
Riemann sums are a family of methods to approximate the definite integral ∫ab f(x) dx. The interval [a, b] is divided into n subintervals of equal width Δx = (b−a)/n. On each subinterval [xk−1, xk], we choose a sample point xk* and form a rectangle (or trapezoid) with height f(xk*). The sum of the areas approximates the integral.
General formula:
∫ab f(x) dx ≈ Δx · [f(x1*) + f(x2*) + … + f(xn*)]
where xk* lies in the k‑th subinterval.
| Method | Sample point xk* | Formula (Δx = (b−a)/n) | Geometric interpretation |
|---|---|---|---|
| Left Riemann sum | Left endpoint: a + (k−1)Δx | Δx·[f(a) + f(a+Δx) + … + f(b−Δx)] | Height of each rectangle is the left‑side value; underestimates increasing functions, overestimates decreasing functions. |
| Right Riemann sum | Right endpoint: a + kΔx | Δx·[f(a+Δx) + f(a+2Δx) + … + f(b)] | Height is right‑side value; overestimates increasing functions, underestimates decreasing functions. |
| Midpoint rule | Midpoint: a + (k−½)Δx | Δx·[f(a+½Δx) + f(a+1½Δx) + … + f(b−½Δx)] | Height at subinterval midpoints; often more accurate (error O(Δx²)). |
| Trapezoidal rule | — | (Δx/2)·[f(a) + 2f(a+Δx) + 2f(a+2Δx) + … + f(b)] | Uses trapezoids instead of rectangles; averages left and right sums, also O(Δx²) error. |
For a continuous function, as n → ∞ (Δx → 0), all Riemann sums converge to the true integral. The speed of convergence depends on the method:
More precisely, if f is twice continuously differentiable, the midpoint rule error is about −(b−a)Δx² f''(ξ)/24, and trapezoidal error is about −(b−a)Δx² f''(ξ)/12 for some ξ in (a,b). Hence midpoint is often slightly better.
Calculator features: