Calculus · Interactive calculator

Riemann Sum Calculator & Interactive Graph

Approximate the signed area under a curve with left, midpoint or right rectangles. Increase n and watch the rectangles refine while the numerical error updates.

What is a Riemann sum?

Replace a curved region with rectangles you can add.

A Riemann sum approximates a definite integral by adding rectangle-like contributions. The general form is Σ f(xᵢ*)Δx, where each subinterval has width Δx=(b−a)/n and xᵢ* is the sample point used to choose that rectangle’s height.

Width

Δx = (b−a)/n

Split the interval [a,b] into n equal subintervals. Increasing n makes each rectangle narrower.

Height

f(xᵢ*)

The sample point xᵢ* can be the left endpoint, midpoint, right endpoint, or another point inside the subinterval.

Contribution

f(xᵢ*)Δx

Each term is signed height times width. Adding the terms gives the Riemann-sum approximation.

Diagram labeling delta x, the sample point x i star, rectangle height f of x i star, and the Riemann sum formula
One rectangle contributes f(xᵢ*)Δx. The interactive calculator above lets you change n and the sample-point rule to see the full sum respond.
Choose the sample point

Left, midpoint and right sums use the same formula differently.

For an increasing positive function, left sums often sit below the true area and right sums often sit above it. Midpoint sampling frequently reduces the error, but the direction of the error depends on the function’s shape.

Left sum

Use the left endpoint of each subinterval. For f(x)=x² on [0,2], n=4 gives 0.5(0²+0.5²+1²+1.5²)=1.75.

Midpoint sum

Use each subinterval midpoint. For the same example, n=4 gives 0.5(0.25²+0.75²+1.25²+1.75²)=2.625.

Right sum

Use the right endpoint. For the same example, n=4 gives 0.5(0.5²+1²+1.5²+2²)=3.75.

Reference value

∫₀² x² dx = 8/3 ≈ 2.6667

With only four rectangles, the midpoint estimate 2.625 is already close. Raise n in the calculator and watch all three methods converge toward the definite integral.

From approximation to integral

Why more rectangles work.

As n increases, Δx shrinks. When f is integrable, the Riemann sums approach one limiting value: the definite integral. The rectangles are a finite approximation; the integral is the limiting accumulated quantity.

Signed area matters

Rectangles above the x-axis contribute positively and rectangles below it contribute negatively. A definite integral is net signed accumulation, not always geometric area.

The sample rule matters less in the limit

For a well-behaved integrable function, left, midpoint and right sums can start at different values but converge to the same definite integral as the partition gets finer.

FTC makes the exact value practical

Riemann sums define the integral through accumulation. The Fundamental Theorem then connects that integral to antiderivatives, giving an exact evaluation method when an antiderivative is available.

Common questions

Riemann sum FAQ

What does xᵢ* mean in a Riemann sum?

It is the sample point chosen inside the i-th subinterval. Its function value f(xᵢ*) sets the rectangle height.

Does a Riemann sum always equal the exact integral?

No. A finite Riemann sum is generally an approximation. Under the usual integrability conditions, the sums approach the definite integral as the partition becomes arbitrarily fine.

Why can a Riemann sum be negative?

The sum uses signed function values. Contributions below the x-axis are negative, so the result represents net signed accumulation unless you explicitly integrate absolute value for total geometric area.