5.4 Riemann Sums

Story (From Archimedes’ Parabolic Quadrature to Riemann’s Discrete Slicing).

Centuries before the systematic formalization of the calculus by Newton and Leibniz, Archimedes of Syracuse (c. 287–212 BCE) achieved the first rigorous integration in history: the quadrature of the parabola. Armed with only Euclidean geometry and the method of exhaustion, Archimedes inscribed infinite sequences of rectilinear geometric triangles inside curved parabolic segments, summing geometric progressions to compute curvilinear areas.

Yet for two millennia, each specific geometric shape required its own bespoke, virtuosic trick. In the mid-nineteenth century, Bernhard Riemann revolutionized this viewpoint with a radical conceptual democratization: rather than inventing tailored geometric shapes to fit the curvature of a boundary, one slices the entire underlying space into uniform vertical strips of arbitrary width Δ⁢xk\Delta x_{k}. In doing so, the intricate geometry of curved space is tamed by the elementary arithmetic of rectangles:

Curved Area≈∑k=1n(Height)×(Width)=∑k=1nf⁢(xk∗)⁢Δ⁢xk.\text{Curved Area}\approx\sum_{k=1}^{n}(\text{Height})\times(\text{Width})=% \sum_{k=1}^{n}f(x_{k}^{*})\,\Delta x_{k}.

The modern definite integral is nothing other than the continuum limit of this discrete book-keeping.

In Section 5.2 we saw that net displacement and total distance both come down to one geometric problem: finding the area between the graph of a function, two vertical lines t=at=a and t=bt=b, and the horizontal axis. We now carry out the plan from Section 5.1. We cut the region into thin vertical strips, replace each strip by a rectangle as in Figure 5.4, and add up the areas of the rectangles using the sigma notation of Section 5.3.

A graph illustrating a Riemann sum with a non-uniform partition. A smooth black curve y = f(x) rises to a peak, falls to a valley, and rises again. The interval from a to b on the horizontal axis is split into eight subintervals of different widths, with partition points labeled x0 = a, x1, x2, dots, x(n-1), xn = b. Over each subinterval stands a red-outlined rectangle. Its height is the value of f at a chosen sample point x i star inside that subinterval, marked by a red dashed vertical line and a red dot where the line meets the curve. The sample points are not always at the midpoints. In the first rectangle, an orange bar along the dashed line marks its height f(x1 star), and a magenta band along the axis marks its width Delta x1 = x1 minus x0, which is also labeled with a double-headed arrow. The total area of the rectangles approximates the area under the curve from a to b.
Figure 5.4: A Riemann sum ∑i=1nf⁢(xi∗)⁢Δ⁢xi\sum_{i=1}^{n}f(x_{i}^{*})\,\Delta x_{i} on a non-uniform partition a=x0<x1<⋯<xn=ba=x_{0}<x_{1}<\cdots<x_{n}=b, with arbitrary sample points xi∗∈[xi−1,xi]x_{i}^{*}\in[x_{i-1},x_{i}].
A graph showing a Riemann sum on a fine, non-uniform partition. It uses the same smooth black curve y = f(x) as the coarse panel: the curve rises to a peak, falls to a valley, and rises again between a and b. The interval from x0 = a to xn = b is divided into twenty-seven narrow subintervals of unequal widths. Over each one stands a thin red-outlined rectangle whose top touches the curve at a small red dot above its sample point. Together, the rectangles almost exactly fill the region under the curve. One rectangle near the peak is shaded orange and labeled: its subinterval runs from x i minus 1 to x i, its sample point x i star is marked by a red dashed vertical line, and its width Delta x i is shown by a double-headed arrow below the axis. A formula above the curve states that the sum of f(x i star) times Delta x i tends to the integral of f from a to b as the largest subinterval width tends to zero.
Figure 5.5: Refining the partition: with a fine non-uniform mesh, the Riemann sum ∑i=1nf⁢(xi∗)⁢Δ⁢xi\sum_{i=1}^{n}f(x_{i}^{*})\,\Delta x_{i} approaches ∫abf⁢(x)⁢dx\int_{a}^{b}f(x)\,\mathrm{d}x as the mesh size maxi⁡Δ⁢xi→0\max_{i}\Delta x_{i}\to 0.
Definition 5.4.1 (Partition).

Let [a,b][a,b] be a closed, bounded interval. A partition 𝒫︀\mathcal{P} of [a,b][a,b] is a finite ordered set of points

a=x0<x1<x2<⋯<xn−1<xn=b.a=x_{0}<x_{1}<x_{2}<\dots<x_{n-1}<x_{n}=b.

The partition divides [a,b][a,b] into nn adjacent subintervals [xk−1,xk][x_{k-1},x_{k}]. The of a subinterval width of the kk-th subinterval is

Δ⁢xk≔xk−xk−1,k=1,…,n.\Delta x_{k}\coloneqq x_{k}-x_{k-1},\qquad k=1,\dots,n.

The of a partition norm of 𝒫︀\mathcal{P} is the length of its longest subinterval:

∥𝒫︀∥≔max1≤k≤n⁡Δ⁢xk.\left\lVert\mathcal{P}\right\rVert\coloneqq\max_{1\leq k\leq n}\Delta x_{k}.
Definition 5.4.2 (Tagged partition).

A tagged partition is a partition 𝒫︀\mathcal{P} together with a choice of sample point (or tag) for each subinterval: an arbitrary point

xk∗∈[xk−1,xk],k=1,…,n.x_{k}^{*}\in[x_{k-1},x_{k}],\qquad k=1,\dots,n.

The norm ∥𝒫︀∥\left\lVert\mathcal{P}\right\rVert measures how coarse the partition is. A small norm means every strip is thin, and that is what makes the rectangles good approximations of the strips.

Caveat (More points does not mean finer).

For a general partition, adding more subintervals does not by itself make the partition finer. Take the partition of [0,1][0,1] given by

0<12<12+12⁢n<12+22⁢n<⋯<1.0<\tfrac{1}{2}<\tfrac{1}{2}+\tfrac{1}{2n}<\tfrac{1}{2}+\tfrac{2}{2n}<\dots<1.

It has n+1n+1 subintervals, but its norm is always 12\tfrac{1}{2}, no matter how large nn is. The subinterval [0,12][0,\tfrac{1}{2}] never shrinks. This is why the norm ∥𝒫︀∥\left\lVert\mathcal{P}\right\rVert, and not the number of points nn, is the right way to measure how fine a partition is.

Definition 5.4.3 (Riemann sum).

Let f:[a,b]→ℝf\colon[a,b]\to\mathbb{R} be a function defined on [a,b][a,b]. Let 𝒫︀={x0,x1,…,xn}\mathcal{P}=\{x_{0},x_{1},\dots,x_{n}\} be a tagged partition of [a,b][a,b] with sample points {xk∗}k=1n\{x_{k}^{*}\}_{k=1}^{n}. The corresponding Riemann sum is

R⁢(f,𝒫︀,{xk∗})≔∑k=1nf⁢(xk∗)⁢Δ⁢xk.R\bigl{(}f,\mathcal{P},\{x_{k}^{*}\}\bigr{)}\coloneqq\sum_{k=1}^{n}f(x_{k}^{*}% )\,\Delta x_{k}.

The following special cases come up often.

  • •
    ​

    If Δ⁢xk=b−an\Delta x_{k}=\dfrac{b-a}{n} for all 1≤k≤n1\leq k\leq n, then 𝒫︀\mathcal{P} is called a partition regular. In this case the partition points are xk=a+k⁢b−anx_{k}=a+k\,\dfrac{b-a}{n}.

  • •
    ​

    If xk∗=xk−1x_{k}^{*}=x_{k-1} for every kk, so that each tag is the left endpoint of its subinterval, then R⁢(f,𝒫︀,{xk−1})R\bigl{(}f,\mathcal{P},\{x_{k-1}\}\bigr{)} is called the left Riemann sum.

  • •
    ​

    If xk∗=xkx_{k}^{*}=x_{k} for every kk, so that each tag is the right endpoint of its subinterval, then R⁢(f,𝒫︀,{xk})R\bigl{(}f,\mathcal{P},\{x_{k}\}\bigr{)} is called the right Riemann sum.

  • •
    ​

    If xk∗=12⁢(xk−1+xk)x_{k}^{*}=\frac{1}{2}\left(x_{k-1}+x_{k}\right) for every kk, so that each tag is the middle point of its subinterval, then R⁢(f,𝒫︀,{xk})R\bigl{(}f,\mathcal{P},\{x_{k}\}\bigr{)} is called the middle Riemann sum.

Each term f⁢(xk∗)⁢Δ⁢xkf(x_{k}^{*})\,\Delta x_{k} is the area of one rectangle in Figure 5.5: its height is f⁢(xk∗)f(x_{k}^{*}) and its width is Δ⁢xk\Delta x_{k}. The Riemann sum adds up all nn of these areas.

Intuition (Riemann sums are piecewise-constant physics).

Go back to the trip from Section 5.2, with f=vf=v the velocity. Over a short time interval [tk−1,tk][t_{k-1},t_{k}] the velocity hardly changes. So we can pretend it is constant and equal to its value v⁢(tk∗)v(t_{k}^{*}) at a single sample time. At constant velocity, displacement is just velocity times time, so the displacement over that interval is approximately v⁢(tk∗)⁢Δ⁢tkv(t_{k}^{*})\,\Delta t_{k}. Adding these pieces gives

s⁢(tn)−s⁢(t0)≈∑k=1nv⁢(tk∗)⁢Δ⁢tk.s(t_{n})-s(t_{0})\approx\sum_{k=1}^{n}v(t_{k}^{*})\,\Delta t_{k}.

A Riemann sum is what you get when you replace a smoothly varying quantity by a step function and use the rule “rate ×\times time”. Which sample time you pick in each interval should matter less and less as the intervals get shorter.

Caveat (Signed rectangles).

Nothing in Definition 5.4.3 says ff must be positive. If f⁢(xk∗)<0f(x_{k}^{*})<0, then the term f⁢(xk∗)⁢Δ⁢xkf(x_{k}^{*})\,\Delta x_{k} is negative, and that rectangle counts as negative area. So a Riemann sum approximates the signed area: area above the axis minus area below it. This is exactly the net-change bookkeeping from Section 5.2.

Story (Cauchy, Riemann, and the freedom to choose).

In 1823 Augustin-Louis Cauchy defined the integral of a continuous function as the limit of sums in which the sample point is always the left endpoint of each subinterval. Bernhard Riemann went further in his 1854 Habilitationsschrift on trigonometric series, which was published only after his death, in 1868. He allowed the sample point xk∗x_{k}^{*} to be any point of [xk−1,xk][x_{k-1},x_{k}]. He then asked exactly which functions give sums that settle down to a single number as ∥𝒫︀∥→0\left\lVert\mathcal{P}\right\rVert\to 0, no matter how the tags are chosen. Giving that freedom of choice is what made the theory work for functions far more general than continuous ones.

Example 5.4.4 (Left and right sums for x2x^{2}).

Let f⁢(x)=x2f(x)=x^{2} on [0,3][0,3]. Take the regular partition 𝒫︀\mathcal{P} with n=3n=3:

x0\displaystyle x_{0}
=0,\displaystyle{}=0,
x1\displaystyle x_{1}
=1,\displaystyle{}=1,\qquad
Δ⁢x1\displaystyle\Delta x_{1}
=x1−x0=1,\displaystyle{}=x_{1}-x_{0}=1,
x2\displaystyle x_{2}
=2,\displaystyle{}=2,\qquad
Δ⁢x2\displaystyle\Delta x_{2}
=x2−x1=1,\displaystyle{}=x_{2}-x_{1}=1,
x3\displaystyle x_{3}
=3,\displaystyle{}=3,\qquad
Δ⁢x3\displaystyle\Delta x_{3}
=x3−x2=1,\displaystyle{}=x_{3}-x_{2}=1,

so that

∥𝒫︀∥=max1≤i≤3⁡Δ⁢xi=1.\left\lVert\mathcal{P}\right\rVert=\max_{1\leq i\leq 3}\Delta x_{i}=1.

Left Riemann sum. The tags are the left endpoints, xk∗=xk−1x_{k}^{*}=x_{k-1} for 1≤k≤31\leq k\leq 3, that is,

x1∗=x0=0,x2∗=x1=1,x3∗=x2=2.x_{1}^{*}=x_{0}=0,\qquad x_{2}^{*}=x_{1}=1,\qquad x_{3}^{*}=x_{2}=2.

Hence

R⁢(f,𝒫︀,{xk−1}k=13)=∑k=13f⁢(xk∗)⁢Δ⁢xk=∑k=13f⁢(xk−1)⁢Δ⁢xk=∑k=13xk−12⋅1=x02+x12+x22=02+12+22=5.\begin{split}R\bigl{(}f,\mathcal{P},\{x_{k-1}\}_{k=1}^{3}\bigr{)}&{}=\sum_{k=1% }^{3}f(x_{k}^{*})\,\Delta x_{k}=\sum_{k=1}^{3}f(x_{k-1})\,\Delta x_{k}=\sum_{k% =1}^{3}x_{k-1}^{2}\cdot 1\\ &{}=x_{0}^{2}+x_{1}^{2}+x_{2}^{2}=0^{2}+1^{2}+2^{2}=5.\end{split}

Right Riemann sum. The tags are the right endpoints, xk∗=xkx_{k}^{*}=x_{k} for 1≤k≤31\leq k\leq 3, that is,

x1∗=x1=1,x2∗=x2=2,x3∗=x3=3.x_{1}^{*}=x_{1}=1,\qquad x_{2}^{*}=x_{2}=2,\qquad x_{3}^{*}=x_{3}=3.

Hence, by Theorem 5.3.5 (iii) with n=3n=3,

R⁢(f,𝒫︀,{xk}k=13)=∑k=13xk2⋅1=12+22+32=∑k=13k2=3⁢(3+1)⁢(2⋅3+1)6=2⁢(6+1)=14.\begin{split}R\bigl{(}f,\mathcal{P},\{x_{k}\}_{k=1}^{3}\bigr{)}&{}=\sum_{k=1}^% {3}x_{k}^{2}\cdot 1=1^{2}+2^{2}+3^{2}=\sum_{k=1}^{3}k^{2}\\ &{}=\frac{3\,(3+1)\,(2\cdot 3+1)}{6}=2\,(6+1)=14.\end{split}
A graph comparing the left and right Riemann sums for f(x) = x squared on the interval from 0 to 3, using three subintervals of width 1. The partition points are labeled 0 = x0, 1 = x1, 2 = x2, and 3 = x3 on the horizontal axis. A blue curve y = x squared rises from the origin through the points (1, 1), (2, 4), and (3, 9), each marked with a black dot. Light blue rectangles show the right Riemann sum. Their heights are the function values at the right endpoints, 1, 4, and 9, and their top edges are solid green lines. Orange rectangles drawn on top show the left Riemann sum. Their heights are the function values at the left endpoints, 0, 1, and 4, and their top edges are dashed red lines. The first left rectangle has height zero and appears only as a dashed segment on the axis. Because the function is increasing, each orange rectangle lies inside the blue rectangle over the same subinterval, so the visible blue parts show how much the right sum overestimates. A legend states that the right sum is 14, the left sum is 5, and the exact integral is 9.
Figure 5.6: Left and right Riemann sums for f⁢(x)=x2f(x)=x^{2} on [0,3][0,3] with n=3n=3 and Δ⁢x=1\Delta x=1. The left sum L3=5L_{3}=5 (orange) underestimates and the right sum R3=14R_{3}=14 (whole columns, blue and orange together) overestimates the exact value ∫03x2⁢dx=9\int_{0}^{3}x^{2}\,\mathrm{d}x=9, because ff is increasing.
Remark 5.4.5 (Trapping the area).

The function f⁢(x)=x2f(x)=x^{2} is increasing on [0,3][0,3]. So on each subinterval its smallest value is at the left endpoint and its largest value is at the right endpoint. The left rectangles therefore lie under the graph and the right rectangles lie over it (see Figure 5.6). The true area AA is caught between the two sums:

5≤A≤14.5\leq A\leq 14.

This is a very wide window. To narrow it, we refine the partition.

Remark 5.4.6 (Letting n→∞n\to\infty).

Repeat Example 5.4.4 with a regular partition into nn subintervals. Then Δ⁢xk=3n\Delta x_{k}=\frac{3}{n} and xk=3⁢knx_{k}=\frac{3k}{n}. By Proposition 5.3.4 and Theorem 5.3.5 (iii),

R⁢(f,𝒫︀n,{xk})=∑k=1n(3⁢kn)2⁢3n=27n3⁢∑k=1nk2=27n3⋅n⁢(n+1)⁢(2⁢n+1)6=9⁢(n+1)⁢(2⁢n+1)2⁢n2,R⁢(f,𝒫︀n,{xk−1})=∑k=1n(3⁢(k−1)n)2⁢3n=27n3⁢∑j=1n−1j2=9⁢(n−1)⁢(2⁢n−1)2⁢n2.\begin{split}R\bigl{(}f,\mathcal{P}_{n},\{x_{k}\}\bigr{)}&{}=\sum_{k=1}^{n}% \Bigl{(}\frac{3k}{n}\Bigr{)}^{2}\frac{3}{n}=\frac{27}{n^{3}}\sum_{k=1}^{n}k^{2% }=\frac{27}{n^{3}}\cdot\frac{n(n+1)(2n+1)}{6}=\frac{9\,(n+1)(2n+1)}{2n^{2}},\\ R\bigl{(}f,\mathcal{P}_{n},\{x_{k-1}\}\bigr{)}&{}=\sum_{k=1}^{n}\Bigl{(}\frac{% 3(k-1)}{n}\Bigr{)}^{2}\frac{3}{n}=\frac{27}{n^{3}}\sum_{j=1}^{n-1}j^{2}=\frac{% 9\,(n-1)(2n-1)}{2n^{2}}.\end{split}

For n=3n=3 these formulas give 1414 and 55, which matches Example 5.4.4. As n→∞n\to\infty, both sums tend to 9⋅22=9\frac{9\cdot 2}{2}=9. The window closes, and the area under y=x2y=x^{2} over [0,3][0,3] is 99. Turning this squeeze into a definition is the subject of the next section: the definite integral.

Moral (The mechanics of a Riemann integral).

A Riemann sum turns an area problem into an addition problem. The power sum formulas of Theorem 5.3.5 turn that addition problem into a closed-form expression in nn. Taking the limit ∥𝒫︀∥→0\left\lVert\mathcal{P}\right\rVert\to 0 turns the approximation into an exact answer.