Riemann Sum Calculator
A Riemann sum approximates the area under a curve by adding up the areas of thin rectangles. Left, right and midpoint sums use different heights for each rectangle, and the trapezoidal rule uses trapezoids instead. This calculator computes the sum, compares it with the exact integral, and draws every strip.
How to use the riemann sum calculator
- Type the function and the interval.
- Choose the number of strips n and the method.
- Press Calculate to see the sum, the error and the rectangles.
Formula
Worked example: x² on [0, 2], 8 midpoints
- f(x) =: x^2
- From x =: 0
- To x =: 2
- Number of rectangles n: 8
- Method: Midpoints
✓ Answer checked
- Exact integral
- Error
- Width Δx
Step-by-step working (4 steps)
Width of each strip
Split [0, 2] into 8 equal strips.
Rectangle heights Midpoint sum
Each rectangle's height is f at the middle of its strip.
Add them up
Sum the areas of all the strips.
Compare with the exact integral
More strips give a smaller error.
Formulas used
How this was checked
- ✓ Adding the strips in reverse order gives the same total.
Frequently asked questions
Which Riemann sum is most accurate?
For smooth functions, the midpoint and trapezoidal rules are usually much more accurate than left or right sums with the same n.
What happens as n gets bigger?
The strips get thinner and the sum gets closer to the exact integral. In the limit, it equals the integral.
When is a left sum an overestimate?
When the function is decreasing, because each rectangle uses the higher left-hand value.
