How to calculate left, right, and midpoint Riemann sums

We can estimate the area under a curve by breaking it into narrow rectangles. The width comes from the interval, and the height comes from where we sample the curve. Let’s use the same interval three ways to see what changes.

Choose the widths and the sample points

Divide [a,b] into n equal pieces of width Δx=b-an. Within each piece, use the left endpoint, right endpoint, or midpoint. Add the sampled heights and multiply by the common width.

∑i=1nf(xi*)Δx
Left, midpoint, and right rectangles under a rising curveThree panels show the same parabola. The rectangles use the left edge, the middle, or the right edge to choose the height.LeftMidpointRight
All three estimates use the same widths. The sample points change the heights.

Compare three estimates on the same interval

For f(x)=x2 over [0,3] with n=3, each width is 1. The three sets of sample points give

Three sums for the same parabola
Sample pointsSum
0,1,2 (left)0+1+4=5
0.5,1.5,2.5 (midpoint)0.25+2.25+6.25=8.75
1,2,3 (right)1+4+9=14

The function is increasing, so the left rectangles give a lower estimate and the right rectangles give an upper estimate. The exact integral is 9. For a decreasing function, the left and right roles reverse. For a continuous function, the sums approach the definite integral as the width goes to zero.