Riemann Sum Calculator
A Riemann sum is the foundational definition of the definite integral: it slices the area under a curve into equal-width rectangles and adds them up. The rectangle heights come from sampling the function at the left edge, the right edge, or the midpoint of each strip. This calculator computes all three from the values you supply. Provide the n + 1 grid node values for the left and right sums, and the n midpoint values for the midpoint sum. As you increase the number of rectangles each sum converges toward the exact integral.
Riemann sum formulas
h = (b - a) / n
Left sum = h * (f0 + f1 + ... + f(n-1))
Right sum = h * (f1 + f2 + ... + f(n))
Midpoint sum = h * (m1 + m2 + ... + m(n))
mk is f at the center of strip k
Every rectangle has the same width h. The left and right sums differ only in which endpoint supplies the height. The midpoint sum samples the center of each strip and usually gives the closest approximation of the three.
Notes on Riemann sums
- Supply n + 1 node values for the left and right sums, covering every grid point from a to b.
- Supply n midpoint values for the midpoint sum, one per strip.
- The rectangle width h equals the interval length divided by the number of rectangles.
- For a monotonically increasing function the left sum underestimates and the right sum overestimates.
- All three sums converge to the exact integral as n grows large.
Riemann sums: frequently asked questions
What is a Riemann sum?
A Riemann sum approximates the area under a curve by dividing the interval into rectangles of equal width and summing their areas. The height of each rectangle comes from the function value at a chosen sample point: the left edge, the right edge, or the midpoint of each subinterval.
What is the difference between left, right, and midpoint sums?
A left Riemann sum uses the function value at the left edge of each subinterval as the rectangle height. A right sum uses the right edge. A midpoint sum uses the value at the center of each subinterval and is generally the most accurate of the three.
How is each Riemann sum computed?
With width h = (b - a) / n, the left sum is h times the sum of the first n sample values, the right sum is h times the sum of the last n sample values, and the midpoint sum is h times the sum of the n midpoint values.
How many sample values do I supply?
For the left and right sums supply n + 1 node values (the function at every grid point). For the midpoint sum supply the n midpoint values separately, since midpoints fall between grid nodes.
Does a Riemann sum converge to the true integral?
Yes. As the number of rectangles n increases without bound and the width shrinks toward zero, every Riemann sum converges to the exact definite integral for any function that is integrable on the interval.
Official sources
- NIST Digital Library of Mathematical Functions: Calculus of one variable.
- NIST Digital Library of Mathematical Functions: Quadrature.
Reviewed by the CalculatorHub team, edited by James Graham, 16 June 2026. See our methodology.