Tutorials › Real Analysis › Riemann Sums

Riemann Integration · Tutorial 486 of 1000

Riemann Sums

Learn how Riemann sums are formed, how their values depend on sample points, and why sufficiently fine sums approximate the Riemann integral.

Advanced 10 min read

What You'll Learn

  • Define a Riemann sum for a partition and a choice of sample points
  • Distinguish Riemann sums from Darboux upper and lower sums
  • Calculate left-endpoint, right-endpoint, and midpoint sums
  • Compare finite Riemann sums with the integral
  • Prove that arbitrary sample-point sums converge as the mesh tends to zero
  • Recognize why discontinuities do not by themselves prevent convergence

From Partition Sums to Riemann Sums

Upper and lower sums use the largest and smallest values of a function on each subinterval. A Riemann sum makes a different choice: on every subinterval, it samples the function at one point and multiplies that value by the subinterval’s length. The resulting finite sum is a numerical approximation to the integral.

The integral is not defined by selecting one special set of sample points. Rather, for an integrable function, all choices of sample points give sums close to the integral once the partition is sufficiently fine. We will make this precise and prove it using the Darboux Criterion and the earlier result that the integral lies between the partition sums.

Let \(P=\{x_0,x_1,\ldots,x_n\}\) be a partition of \([a,b]\), so \(a=x_0<x_1<\cdots<x_n=b\). Write \(\Delta x_i=x_i-x_{i-1}\) for the length of the \(i\)th subinterval. Choose a point \(\xi_i\in[x_{i-1},x_i]\) for each \(i\).

Definition: The Riemann sum of \(f\) for the partition \(P\) and sample points \(\xi_1,\ldots,\xi_n\) is $$ S(f;P,\xi)=\sum_{i=1}^{n}f(\xi_i)\Delta x_i. $$ The mesh of \(P\), denoted by \(\|P\|\), is the length of its largest subinterval: $$ \|P\|=\max_{1\leq i\leq n}\Delta x_i. $$

The sample point may be an endpoint or an interior point. Common choices include the left endpoint, right endpoint, and midpoint of each subinterval. These choices can produce different finite sums, even for the same partition. The mesh records the largest subinterval length, not the number of sample points or the position of any particular sample point.

How Riemann Sums Relate to Darboux Sums

Suppose \(f\) is bounded on \([a,b]\). On each subinterval, let \(m_i\) be the infimum and \(M_i\) the supremum of \(f\). Since every sample value lies between these bounds, multiplying by the positive length \(\Delta x_i\) and adding gives a direct comparison.

Proposition (Riemann Sum Between Darboux Sums): If \(f:[a,b]\to\mathbb{R}\) is bounded and \(P\) is a partition, then every Riemann sum for \(f\) on \(P\) satisfies $$ L(f,P)\leq S(f;P,\xi)\leq U(f,P). $$ If \(f\) is Riemann integrable with integral \(I\), then $$ L(f,P)\leq S(f;P,\xi)\leq U(f,P) \quad\text{and}\quad L(f,P)\leq I\leq U(f,P). $$

Proof. For each \(i\), the definition of infimum and supremum gives \(m_i\leq f(\xi_i)\leq M_i\). Because \(\Delta x_i>0\),

$$ m_i\Delta x_i\leq f(\xi_i)\Delta x_i\leq M_i\Delta x_i. $$

Summing these inequalities over \(i=1,\ldots,n\) gives the first assertion, since \(L(f,P)=\sum_{i=1}^{n}m_i\Delta x_i\) and \(U(f,P)=\sum_{i=1}^{n}M_i\Delta x_i\). If \(f\) is integrable, the earlier Proposition (Integral Lies Between the Partition Sums) supplies \(L(f,P)\leq I\leq U(f,P)\). This proves the second assertion as well. \(\square\)

In particular, both a Riemann sum and the integral lie in the same interval from \(L(f,P)\) to \(U(f,P)\). Their distance is therefore no greater than the Darboux gap:

$$ \bigl|S(f;P,\xi)-I\bigr|\leq U(f,P)-L(f,P). $$

This estimate explains why a partition with a small Darboux gap controls every choice of sample points for that partition. To prove convergence as the mesh tends to zero, however, we must control sums for all sufficiently fine partitions, not just for one specially chosen partition.

Worked Riemann Sums

Worked Example: Left, Right, and Midpoint Sums for a Linear Function

Let \(f(x)=x\) on \([0,1]\), and use the uniform partition \(x_i=i/n\), \(i=0,\ldots,n\). Every subinterval has length \(1/n\). Using right endpoints gives

$$ \begin{aligned} S_{\mathrm{right}} &=\sum_{i=1}^{n}\frac{i}{n}\cdot\frac{1}{n}\\ &=\frac{1}{n^2}\sum_{i=1}^{n}i\\ &=\frac{n(n+1)}{2n^2} =\frac{n+1}{2n}. \end{aligned} $$

For left endpoints, the sample points are \((i-1)/n\), so

$$ \begin{aligned} S_{\mathrm{left}} &=\sum_{i=1}^{n}\frac{i-1}{n}\cdot\frac{1}{n}\\ &=\frac{1}{n^2}\sum_{j=0}^{n-1}j =\frac{n(n-1)}{2n^2} =\frac{n-1}{2n}. \end{aligned} $$

The midpoint of the \(i\)th subinterval is \((i-\tfrac12)/n\). Thus the midpoint sum is

$$ \begin{aligned} S_{\mathrm{mid}} &=\frac{1}{n^2}\sum_{i=1}^{n}\left(i-\frac12\right)\\ &=\frac{1}{n^2}\left(\frac{n(n+1)}{2}-\frac{n}{2}\right) =\frac12. \end{aligned} $$

The integral is \(\int_0^1x\,dx=1/2\). The midpoint sum equals it for every \(n\), while the left and right sums approach it from below and above: \((n-1)/(2n)=1/2-1/(2n)\) and \((n+1)/(2n)=1/2+1/(2n)\). For \(n=2\), the three sums are \(1/4\), \(1/2\), and \(3/4\), respectively. They differ at finite mesh, even though their limiting behavior agrees.

Worked Example: Right-Endpoint Sums for a Quadratic Function

Let \(f(x)=x^2\) on \([0,1]\), again with \(x_i=i/n\). The right-endpoint sum is

$$ \begin{aligned} S_{\mathrm{right}} &=\sum_{i=1}^{n}\left(\frac{i}{n}\right)^2\frac{1}{n}\\ &=\frac{1}{n^3}\sum_{i=1}^{n}i^2\\ &=\frac{n(n+1)(2n+1)}{6n^3} =\frac{(n+1)(2n+1)}{6n^2}. \end{aligned} $$

Since \(\int_0^1x^2\,dx=1/3\), the difference between the sum and the integral is

$$ S_{\mathrm{right}}-\frac13 =\frac{2n^2+3n+1-2n^2}{6n^2} =\frac{3n+1}{6n^2} =\frac{1}{2n}+\frac{1}{6n^2}. $$

This difference is positive and tends to zero, so the sums approach the integral from above. For \(n=2\), the sum is \((1/2)^2(1/2)+1^2(1/2)=1/8+1/2=5/8\). The formula for the difference gives \(1/4+1/24=7/24\), and direct subtraction confirms \(5/8-1/3=15/24-8/24=7/24\).

Worked Example: Sample-Point Choices for a Step Function

Define \(g:[0,1]\to\mathbb{R}\) by \(g(x)=0\) for \(0\leq x<1/2\) and \(g(x)=1\) for \(1/2\leq x\leq1\). This step function is Riemann integrable, and its integral is \(1/2\). Use the uniform partition with even \(n\). For the left-endpoint sum, the sample points are \((i-1)/n\), and \(g\) equals \(1\) at exactly \(n/2\) of them. Therefore

$$ S_{\mathrm{left}}=\frac{n/2}{n}=\frac12. $$

For the right-endpoint sum, the sample points are \(i/n\). The value is \(1\) for \(i=n/2,n/2+1,\ldots,n\), which gives \(n/2+1\) terms equal to \(1/n\). Hence

$$ S_{\mathrm{right}}=\frac{n/2+1}{n}=\frac12+\frac1n. $$

The right sum counts the sample point \(1/2\), where \(g(1/2)=1\), while the left sum does not. Their difference is \(1/n\), which tends to zero as the mesh \(1/n\) tends to zero. This example shows that discontinuity can affect individual sums without preventing their convergence.

Convergence for Arbitrary Sample Points

The next result is the central guarantee behind using Riemann sums to approximate an integral. A partition with a small Darboux gap exists by the Darboux Criterion. A sufficiently fine partition that does not contain all the points of that good partition can be joined to it; only a small amount of interval length is affected by the extra cuts.

Theorem (Convergence of Riemann Sums): Suppose \(f:[a,b]\to\mathbb{R}\) is Riemann integrable, with integral \(I\). For every \(\varepsilon>0\), there exists \(\delta>0\) such that, whenever \(P\) is a partition of \([a,b]\) with \(\|P\|<\delta\), every choice of sample points satisfies $$ \bigl|S(f;P,\xi)-I\bigr|<\varepsilon. $$

Proof. Since \(f\) is bounded, choose \(M\geq0\) such that \(|f(x)|\leq M\) for every \(x\in[a,b]\). By the Darboux Criterion, there is a partition \(P_0\) such that

$$ U(f,P_0)-L(f,P_0)<\frac{\varepsilon}{2}. $$

Let \(k\) be the number of interior points of \(P_0\). First suppose \(k=0\). Then \(P_0=\{a,b\}\), and every partition \(P\) refines \(P_0\). The sum and the integral both lie between \(L(f,P)\) and \(U(f,P)\), and refinement gives \(U(f,P)-L(f,P)\leq U(f,P_0)-L(f,P_0)<\varepsilon/2\). Thus the desired conclusion holds for every \(P\), with no mesh restriction.

Now suppose \(k>0\). If \(M=0\), then \(f\) is identically zero, so every sum and its integral are zero. We may therefore assume \(M>0\), and set \(\delta=\varepsilon/(4Mk)\). Take any partition \(Q\) with \(\|Q\|<\delta\), together with any choice of sample points for its Riemann sum \(S(f;Q,\xi)\). Form \(R\) by adjoining to \(Q\) all the interior points of \(P_0\). This is a common refinement of \(Q\) and \(P_0\).

Construct a Riemann sum \(T\) on \(R\) as follows. On each subinterval of \(Q\) that is not cut by a point of \(P_0\), use its original sample point. On each subinterval that is cut, choose any sample point in each of the resulting smaller subintervals. The contributions to the two sums agree on every uncut subinterval. On a cut subinterval \(J\) of \(Q\), the original contribution has absolute value at most \(M|J|\), and the total of the new contributions has absolute value at most \(M|J|\). Consequently, the absolute difference contributed by \(J\) is at most \(2M|J|\).

At most \(k\) subintervals of \(Q\) are cut: each contains at least one interior point of \(P_0\), and distinct subintervals contain distinct such points. Each has length less than \(\delta\). The triangle inequality therefore gives

$$ \bigl|S(f;Q,\xi)-T\bigr| \leq 2Mk\|Q\| <2Mk\delta =\frac{\varepsilon}{2}. $$

Both \(T\) and \(I\) lie between \(L(f,R)\) and \(U(f,R)\). Since \(R\) refines \(P_0\), the refinement inequalities for Darboux sums imply

$$ \bigl|T-I\bigr| \leq U(f,R)-L(f,R) \leq U(f,P_0)-L(f,P_0) <\frac{\varepsilon}{2}. $$

Combining the two estimates yields \(\bigl|S(f;Q,\xi)-I\bigr|\leq |S(f;Q,\xi)-T|+|T-I|<\varepsilon\). The choice of \(Q\) and its sample points was arbitrary, so the conclusion holds for every partition of mesh less than \(\delta\) and every choice of sample points. \(\square\)

Why the Mesh and the Quantifiers Matter

The theorem does not say that every Riemann sum equals the integral, or that a particular finite sum is always a good approximation. Its statement is uniform over the sample-point choices: once the mesh is sufficiently small, every possible selection of points gives a sum close to \(I\). The proof uses boundedness to control the error where a fine partition is cut by the fixed partition with a small Darboux gap.

A common mistake is to consider only one sequence of convenient sample points, such as right endpoints, and conclude that all Riemann sums converge. The theorem is stronger: it covers arbitrary partitions of sufficiently small mesh and arbitrary sample points in their subintervals. The converse question—what convergence of all such sums implies about a bounded function—is a useful characterization of integrability, but it is distinct from the result proved here.

The sample points are allowed to be endpoints, which matters for functions that jump. In the step-function example, choosing the value at the jump changes a finite sum, but only by a quantity that vanishes with the mesh. In the next tutorial, tagged partitions provide a systematic framework for these choices and for studying Riemann sums in greater detail.

Check Your Understanding

Use the definition, examples, and convergence proof to answer the following questions.

  1. Why does every Riemann sum for a fixed partition lie between its lower and upper Darboux sums?
  2. For \(f(x)=x\) on \([0,1]\), which of the left-endpoint, right-endpoint, and midpoint sums equals the integral for every uniform partition size?
  3. For the right-endpoint sum of \(x^2\) on \([0,1]\), what is the exact error for general \(n\), and what is it when \(n=2\)?
  4. In the convergence proof, why can at most \(k\) subintervals of the fine partition be cut by the interior points of \(P_0\)?
  5. What role does the bound \(|f(x)|\leq M\) play when comparing the sum on the fine partition with a sum on its common refinement?