How a Riemann sum works
Split [a,b] into n equal slices of width Δx=nb−a. In each slice, pick a sample point xi∗, build a rectangle of height f(xi∗), and add them up: ∑f(xi∗)Δx. The only difference between the left, right and midpoint rules is which sample point you pick.
Which rule should I use?
- Left / right: simplest; the error shrinks in proportion to 1/n. Increasing functions: left underestimates, right overestimates.
- Midpoint: error shrinks like 1/n2. For a concave-up curve it underestimates.
- Trapezoid: also 1/n2, with the opposite sign of error to midpoint (it overestimates concave-up curves).
- Simpson: 1/n4. Doubling n cuts the error about 16 times. It is exact for polynomials up to degree 3.
The exact value is the definite integral, computed on the integral calculator. For the idea of area accumulating as a function, see what is an integral?
Questions students ask
What is a Riemann sum?
An approximation of the area under a curve made by adding up the areas of n rectangles of width Δx=nb−a. The height of each rectangle is the function’s value at a chosen sample point in its slice.
Left vs right vs midpoint: which is most accurate?
For smooth functions the midpoint rule is usually about twice as accurate as the trapezoid rule, and both beat left and right sums. For an increasing function, the left sum underestimates and the right sum overestimates.
What is the trapezoidal rule?
Instead of flat tops, join the two endpoints of each slice with a straight line: Tn=2Δx[f(x0)+2f(x1)+⋯+2f(xn−1)+f(xn)]. It is the average of the left and right sums.
What is Simpson’s rule?
Simpson’s rule fits a parabola through each pair of slices, with weights 1, 4, 2, 4, …, 4, 1 times 3Δx. It needs an even number of subintervals and is exact for cubics.
How does a Riemann sum become an integral?
As n→∞ the rectangles get thinner and the sum approaches the exact area: ∫abf(x)dx=limn→∞∑i=1nf(xi∗)Δx. Press “Animate n” to watch the error shrink.
How do I do a Riemann sum from a table of values?
Multiply each tabulated height by its width and add. With equal widths, that is Δx times the sum of the heights you use (left endpoints for a left sum, right endpoints for a right sum).