Riemann Sum Calculator
Approximate a definite integral using left, right, midpoint, and trapezoidal Riemann sums for f(x) = ax² + bx + c over [a, b] with n subdivisions.
Compares to exact value.
A Riemann sum approximates a definite integral by dividing the area under a curve into rectangles (or trapezoids) and summing their areas. The more subdivisions n you use, the closer the approximation gets to the true integral.
For a function f on the interval [a, b] divided into n equal subintervals of width dx = (b-a)/n:
Left sum: sum of f(x_i) * dx, where x_i is the left edge of each rectangle. Right sum: sum of f(x_{i+1}) * dx, where x_i is the right edge. Midpoint sum: sum of f((x_i + x_{i+1})/2) * dx – generally the most accurate of the three. Trapezoidal rule: sum of (f(x_i) + f(x_{i+1}))/2 * dx – uses trapezoids instead of rectangles, exact for linear functions.
For a quadratic f(x) = ax^2 + bx + c, the exact integral over [a, b] is: [ax^3/3 + bx^2/2 + c*x] from lower to upper limit.
The error in the left and right sums is proportional to 1/n. The midpoint and trapezoidal rules have errors proportional to 1/n^2 – halving the step size reduces error four-fold. For the parabola case, Simpson’s rule (which combines midpoint and trapezoidal) is exact.
The chart shows the function curve over the interval with the left-sum rectangles overlaid, giving a visual sense of the approximation error.