Chalk−1

Math · Calculus I · Concept

Riemann sums: left, right and midpoint

A Riemann sum approximates a definite integral by adding rectangle areas: split [a,b] into n pieces of width Δ⁢x=(b−a)⁢/⁢n, take a height f⁡(xi∗) in each piece, and add the products f⁡(xi∗)⋅Δ⁢x. Left, right and midpoint sums choose different heights, and as n grows, all of them approach the integral.

A concrete case

Distance from a speed that changes

A runner holds 3 m⁢/⁢s for 10 s, then 4 m⁢/⁢s for 10 s, then 6 m⁢/⁢s and then 5 m⁢/⁢s, each for 10 s. How far did she run? At a constant speed, distance is speed times time. Adding the four pieces gives 30+40+60+50 =180 m.

Draw speed against time, and each piece is a rectangle 10 s wide and as tall as the speed. Its area is the distance for that piece, so the whole distance is the total area under the graph.

A real runner’s speed changes at every instant, not in four jumps. Treat it as constant over short stretches anyway, add the rectangles, and you have an estimate. Shorter stretches give better estimates. That is the whole idea of a Riemann sum.

10⋅3+10⋅4+10⋅6+10⋅5=180
The four stretches of the run
Time (s)Speed (m⁢/⁢s)Distance (m)
0 to 10330
10 to 20440
20 to 30660
30 to 40550

The rule

Height times width

To estimate the area under y=f⁡(x) from x=a to x=b, split [a,b] into n equal pieces. Each piece has width Δ⁢x=(b−a)⁢/⁢n. The endpoints are x0=a, x1=a+Δ⁢x and so on up to xn=b, so in general xi=a+i⁢Δ⁢x.

In each piece choose a sample point xi∗ and build a rectangle of height f⁡(xi∗). The Riemann sum Sn adds the n rectangle areas f⁡(xi∗)⁢Δ⁢x. Where f is negative the height is negative, and that rectangle subtracts.

Sn=∑i=1nf⁡(xi∗)Δ⁢x,Δ⁢x=b−an
Sn=∑i=1nf⁡(xi∗)Δ⁢xΔ⁢x=b−an

Left, right and midpoint sums

The name of a sum says where each rectangle takes its height. The left sum Ln uses the left end of each piece, the right sum Rn the right end, and the midpoint sum Mn the middle. For a function that rises across the interval, the left sum is too small and the right sum too big. For a falling function it is the other way round. The midpoint sum is usually much closer than either.

Where each sum takes its height on [xi−1,xi]
SumHeightIf f is increasing
Left, Lnf⁡(xi−1)Underestimates
Right, Rnf⁡(xi)Overestimates
Midpoint, Mnf at the midpointUsually closest

Sigma notation

Σ means add. The index i runs from 1 to n, and each value of i contributes one term. The left sum uses the points x0 to xn−1 and the right sum x1 to xn, so each uses n heights.

∑i=1nai=a1+a2+⋯+an

From sums to the integral

As n grows, the rectangles get thinner. For a continuous function, every way of choosing the heights approaches the same number. That number is the definite integral of f from a to b, and this limit is its definition.

∫abf⁡(x)d⁢x=limn→∞∑i=1nf⁡(xi∗)Δ⁢x
∫abf⁡(x)d⁢x=limn→∞∑i=1nf⁡(xi∗)Δ⁢x

Why it works

Why the sums close in

Take a function that rises across [a,b]. In each piece the left height is the lowest point of the curve and the right height the highest. The left sum lies below the true area and the right sum above it, and the area is trapped between them.

The gap between the two is easy to find. The right sum uses the heights f⁡(x1) to f⁡(xn), and the left sum f⁡(x0) to f⁡(xn−1). Every height in between appears in both and cancels, leaving Rn−Ln =(f⁡(b)−f⁡(a))⁢Δ⁢x.

As n grows, Δ⁢x shrinks, and so does the gap that traps the area. Both sums are squeezed onto it. For x2 on [0,1] the gap is 1⁢/⁢n, which is 0.5 with 2 rectangles and 0.01 with 100. A function that rises and falls can be split into pieces where it only rises or only falls, and the same squeeze works on each.

Rn−Ln=(f⁡(b)−f⁡(a))Δ⁢x

The method

The method in six steps

The table finds the right sum R4 for f⁡(x)=x2+1 on [0,2]. Every rectangle has the same width, so factor Δ⁢x out before adding.

0.5⁢(1.25+2+3.25+5)=5.75
The right sum R4 for x2+1 on [0,2]
StepWhat to doFor x2+1 on [0,2], n=4
1Find the widthΔ⁢x =(2−0)⁢/4 =0.5
2List the endpoints0, 0.5, 1, 1.5, 2
3Choose the sample pointsthe right ends 0.5, 1, 1.5, 2
4Work out the heights1.25, 2, 3.25, 5
5Add the heights and multiply by the width0.5⁢(1.25+2+3.25+5) =5.75
6Say whether it is too high or too low, and whyx2+1 rises on [0,2], so R4 is too high

Trapezoids average left and right

Joining neighboring heights with straight segments gives trapezoids instead of rectangles. The trapezoidal sum Tn is the average of the left and right sums, and for a smooth curve it is usually far closer than either.

Tn=∑i=1nf⁡(xi−1)+f⁡(xi)2Δ⁢x=Ln+Rn2
Tn=∑i=1nf⁡(xi−1)+f⁡(xi)2Δ⁢x=Ln+Rn2

Where it breaks

Where it breaks

A Riemann sum measures signed area. Rectangles below the axis subtract, so the sums for sinx on [0,2⁢π] approach 0, though the region between the curve and the axis has a total area of 4. For total area, use ∣⁢f∣ instead of f.

The rule that the left sum is too small holds only where f rises. For a curve that rises and then falls, the left sum can be too small on one part and too big on another, and nothing general says which wins.

The midpoint sum follows the bend of the graph instead. Where the graph is concave up the midpoint sum is too small, and where it is concave down it is too big.

A few agreeing sums are evidence, not proof. A narrow spike between the sample points can be missed by every sum you try. For a function that is unbounded on the interval, such as 1⁢/x2 on [−1,1], the sums grow without bound and the definite integral does not exist.

Check your answer

Check your answer

A Riemann sum is an estimate, so check that it is the right size and that it settles as n grows.

Bracket the answer. For a function that only rises or only falls, the true value lies between the left and right sums. For x2 on [0,1] with n=2, it lies between 0.125 and 0.625.

Double n. The estimates should settle down. The midpoint sums for x2 on [0,1] are 0.3125, 0.328125 and 0.33203125 for n=2, 4 and 8, closing in on 1⁢/3.

Check the size and the units. The answer lies between the smallest height times (b−a) and the largest height times (b−a). Its units are the height’s units times the width’s, so m⁢/⁢s times s gives m.

To have Chalk check the work, write each sum as arithmetic in a Math box, such as (1⁢/2)⁢(1⁢/16+9⁢/16)=5⁢/16. The Checker marks each row’s arithmetic ✓ or ✗. A row that names the sum, such as M2=(1⁢/2)⁢(1⁢/16+9⁢/16) =5⁢/16, reads “?”, because Chalk checks its arithmetic but not the formula behind M2. Chalk also can’t tell which heights you should have used, so choosing the sample points is yours to check.

Riemann’s definition, and the size of the error

Riemann’s definition is more general than equal widths. The pieces may have different widths, and each sample point may sit anywhere in its piece. A function is integrable when every such sum approaches the same number as the widest piece shrinks to 0. Every continuous function on a closed interval is integrable, and so is a bounded function with finitely many jumps.

The error of a sum can be bounded before you compute it. For the midpoint sum it is at most K⁢(b−a)3/⁢(24n2), where K is the largest value of ∣f′⁢′∣ on the interval. For x2 on [0,1] with n=2, K=2 and the bound is 1⁢/48, exactly the error of M2. Doubling n divides the bound by 4.

Working out the limit of the sums directly is hard. The Fundamental Theorem of Calculus finds it from an antiderivative instead.

|∫abf⁡(x)d⁢x−Mn|≤K⁢(b−a)324n2
|∫abf⁡(x)d⁢x−Mn|≤K⁢(b−a)324n2

Common mistakes

  • Using n+1 heights. n rectangles need n heights. With n=4 on [0,2], the left sum uses x=0, 0.5, 1 and 1.5, and the right sum uses 0.5, 1, 1.5 and 2. Using all five points counts one rectangle too many.
  • Using the wrong width. Each rectangle is Δ⁢x=(b−a)⁢/⁢n wide, not b−a. For n=2 on [0,1] the width is 1⁢/2, and multiplying by 1 instead doubles the sum.
  • Treating a Riemann sum as total area. Rectangles below the axis count as negative. Over [0,2⁢π] the sums for sinx approach 0, while the area between the curve and the axis is 4.
  • Assuming the left sum is always too small. That holds only where f rises. For the falling function 4−x2 on [0,2], the left sum is too big and the right sum too small.
  • Expecting every larger n to give a better estimate. For a smooth function the error shrinks overall, but a coarse grid can land on or miss a narrow feature by chance. Compare several values of n rather than trusting one.

Key terms

Riemann sum
An approximation of the area under a curve: add up rectangles, each with a width Δ⁢x and a height from the function. Taking heights at left ends, right ends or midpoints gives different sums.
Sigma notation
A compact way to write a sum: Σ from i=1 to n of ai means a1+a2+⋯+an. The index i takes each integer value from the lower limit to the upper limit, and each value contributes one term.
Interval partition
Splitting an interval into smaller pieces side by side. The pieces don’t have to be equal, but equal widths make Riemann sums easier.
Midpoint rule
Approximating an integral with rectangles whose heights are the function’s values at the midpoints of the subintervals. It is often more accurate than using left or right endpoints.
Definite integral
∫ab f⁡(x) d⁢x: the signed area between the graph of f and the x-axis from a to b, defined as the limit of Riemann sums. Area below the axis counts as negative.
Signed area
Area counted with a sign: regions above the x-axis count as positive and regions below as negative, so they can cancel. Total area counts every region as positive.

Work through an example

Estimate ∫01 x2 d⁢x with n=2 rectangles, using left, right and midpoint heights. Compare each estimate with the exact value 1⁢/3.

Left, right and midpoint sums for x2 →

Estimate distance from a table of speeds →

Sources and scope

Authored study material. Tool results depend on the stated inputs and model assumptions.

After reading

Study it, then try it

Practice the key terms as flashcards, then open the example in its tool, change a value and keep a useful result on your board.

Study the 6 key terms Open Riemann Sums Check the sums in Math Open worked example on a board Riemann sum in Math Reference

Your existing work stays on this device. Examples open as editable copies.