Riemann Sums

Most of life is
constantly changing.

Speed. Temperature. Growth. Nothing stays perfectly constant — yet we need ways to measure what accumulates over time. How do we do that?

scroll to explore

A runner at constant speed

Say a runner holds exactly 10 km/h for one hour. Total distance = 10 km. Simple — it's just the area of that rectangle.

distance = speed × time = 10 × 1 = 10 km

Now the runner changes speed

What if their speed varies continuously throughout the run? The total distance is the area under this curve — but there's no simple formula for that.

Take a moment. If you can't get the exact area… what would you do?

// The puzzle

What if we broke time
into smaller pieces?

Over a tiny slice of time… is the speed almost constant (ie graph is not curved)?
What if we pretended it was, just for that tiny moment?
Press the button and see what happens.

1 rectangle
error

// You just discovered integration

The Riemann Sum

Each rectangle had a width — a tiny slice of time, Δx — and a height equal to the speed at that moment, f(x). Its area was f(x) · Δx.

Adding all those slices together gave an approximation of the total distance. The more slices, the better the approximation.

Now imagine taking that idea to its logical extreme — what if the slices were infinitely thin? The sum converges to an exact value. That limit has a name:

The Riemann Sum

A  ≈  Σ f(xi) · Δx

n rectangles, each of width Δx = (b−a)/n

As n → ∞ : The Definite Integral

ab f(x) dx  =  limn→∞ Σ f(xi) Δx

The approximation you built in the puzzle is integration. You were doing it before you knew the name.

// Free play

Explore it yourself

rectangles (n)
4
sample point
estimate:
error:
true area: