Riemann sum in 3D

Four amber bars under a parabola with taller red bars above it, bracketing the exact area between them.Drag to turn

A Riemann sum approximates the area under a curve by adding the areas of thin rectangles, called bars, built on a partition of an interval. Its limit as the bars become infinitely narrow defines the definite integral.

Bars built under a curve

A Riemann sum splits an interval [a, b] into n subintervals and builds one rectangle on each. The height of a rectangle is the function value at a chosen sample point in that subinterval. The total of the rectangle areas estimates the area between the curve and the x-axis.

A histogram works the same way. Each bar has a width and a height, and its area is width times height. A Riemann sum is a histogram whose heights come from a function.

The formula and the choice of sample point

With equal widths, each bar has width Δx = (b − a)/n. The sum is f(x1)Δx + f(x2)Δx + ... + f(xn)Δx, where xi is the sample point in the ith subinterval. Common choices are the left endpoint, the right endpoint and the midpoint.

For an increasing function, the left sum underestimates and the right sum overestimates. For a decreasing function, the roles swap. Parts of the curve below the x-axis contribute negative area.

Worked example: x² with four bars

Here Δx = (2 − 0)/4 = 0.5. Left endpoints 0, 0.5, 1, 1.5 give heights 0, 0.25, 1, 2.25. Their sum is 3.5, and 3.5 × 0.5 = 1.75.

Right endpoints 0.5, 1, 1.5, 2 give heights 0.25, 1, 2.25, 4. Their sum is 7.5, and 7.5 × 0.5 = 3.75. Midpoints 0.25, 0.75, 1.25, 1.75 give heights 0.0625, 0.5625, 1.5625, 3.0625, which sum to 5.25, and 5.25 × 0.5 = 2.625.

The exact area is 8/3, about 2.667. It lies between the left and right sums, and the midpoint sum is closest.

From sums to the definite integral

As n increases, Δx shrinks and the bars fit the curve more closely. For a continuous function on [a, b], the left, right and midpoint sums approach the same number. That limit is the definite integral of f from a to b.

The general definition allows unequal widths, provided the widest bar shrinks toward zero.

Common misconceptions and where sums appear

A Riemann sum with finite n is usually not exact. Exceptions include a constant function, and a midpoint sum for a linear function. A left sum does not always underestimate, because that depends on whether the function rises or falls.

Riemann sums appear in numerical integration, in estimating distance from measured velocities, and in building histograms of probability density.

Key terms

Partition
A division of the interval [a, b] into subintervals.
Sample point
The point in each subinterval where the function is evaluated to set the bar height.
Δx
The width of a subinterval, equal to (b − a)/n when the widths are equal.
Left, right and midpoint sums
Riemann sums that use the left endpoint, right endpoint or midpoint of each subinterval as the sample point.
Definite integral
The limit of Riemann sums as the widest bar shrinks to zero.

Common questions

Does a left Riemann sum always underestimate the area?

No. It underestimates for an increasing function and overestimates for a decreasing one. For a function that rises and falls, the errors on different pieces partly offset.

How many bars are needed for a good estimate?

No fixed number works for every function. The error usually shrinks as n grows, and smooth functions need fewer bars than sharply varying ones.

Why is the midpoint sum often more accurate?

Within each bar, the overshoot on one side of the midpoint tends to cancel the undershoot on the other. For a linear function the cancellation is exact.

Learn this with a tutor

Sidechair's AI tutor will teach this topic in 3D. Join the waitlist for early access.

We'll only email you about Sidechair. Read our privacy policy.