Riemann Sum Explorer

See how rectangles approximate the area under a curve. Increase the count and watch it converge to the exact integral.

Controls

10

Results

n10
Approx-
Exact-
Error-

The Math Behind It

Riemann Sum Formula

  • Left sum: S = Σ f(xᵢ) Δx where xᵢ = a + i·Δx
  • Right sum: xᵢ = a + (i+1)·Δx
  • Midpoint: xᵢ = a + (i+½)·Δx
  • Δx = (b - a) / n

Convergence

  • As n → ∞, all three methods converge to the definite integral
  • Midpoint typically converges fastest (error ~ 1/n²)
  • Left/Right have error ~ 1/n for monotonic functions

Try This

  • Set n=1 and compare Left vs Right for sin(x) — which overestimates?
  • Increase n to 50 and see the error drop below 0.1%
  • Try x² with midpoint at n=4 — surprisingly accurate!
  • Watch the animation to see convergence in real-time

Key Insight

The definite integral ∫f(x)dx is defined as the limit of Riemann sums as the partition gets infinitely fine.