Riemann-sums

Visualizing the Riemann sums for single-variable functions

MAT236H5F, University of Toronto, Mississauga. Instructor: Ke Zhang.

Let $f = f(x)$ be a function on $[a, b]$, we set:

  • $\Delta x = (b-a)/n$, $x_0 = a$, $x_1 = x_0 + \Delta x$, ..., $x_n = b$.
  • For $i = 1, \ldots, n$, choose arbitrary "sample points" $x_i^* \in [x_{i-1}, x_i]$.

The Riemann sums (for this partition and choice of inner points $x_i^*$ is: $$ \sum_{i = 1}^n f(x_i^*) \Delta x. $$ Remark: The proper definition of the Riemann sums allows artibrary partiion of $[a, b]$ into $[x_{i-1}, x_i]$. Here we only look at the particular case of equal-size partitions.

The following Theorem is fundamental in the theory of Riemann integral:

Theorem 1 Suppose $f: [a, b] \to \mathbb{R}$ is continuous, then $$ \lim_{n \to \infty} \sum_{i = 1}^n f(x_i^*) \Delta x $$ exists. It is then defined as the definite integral $\int_a^b f(x)dx $.

We visualize it by appoximating the area under a graph using rectangles of width $\Delta x$ and height $f(x_i^*)$.

Two choices of the "sampling points" $x_i^*$ are particularly relavant. We define:

  • $M_i = \max\{ f(x): x \in [x_{i-1}, x_i]\}$. By the extreme value theorem, there always exists some point $x_i^*$ such that $f(x_i^*) = M_i$. The resulting Riemann sum $$ \overline{S}_n(f) = \sum_{i = 1}^n M_i \Delta x $$ is the largest possible Riemann sum for this partition, called the Darboux Upper Sums.
  • $m_i = \max\{ f(x): x \in [x_{i-1}, x_i]\}$. The resulting Riemann sum $$ \underline{S}_n(f) = \sum_{i = 1}^n m_i \Delta x $$ is the smallest possible Riemann sum for this partition. This is called the Darboux Lower Sums.

In the following example $a = 0$, $b = 2\pi$ and $f(x) = \sin(x) + 1$.

The way Theorem 1 is proven is a bit delicate and is usually covered in an analysis course. A key idea behind the proof is that the difference between the Darboux upper sums and the Darboux lower sums converges to $0$ as $n \to \infty$. This shows the limit of the Riemann sums is independent of how the sample points are chosen. The idea of the proof is the following:

  • For every $\epsilon >0$, there is $N \in \mathbb{N}$ such that if $n > N$, $M_i - m_i < \epsilon$ for all $i = 1, \ldots, n$. (This uses continuity, and more precisely uniform continuity)
  • We have $$ \sum_{i = 1}^n M_i \Delta x - \sum_{i = 1}^n m_i \Delta x \le \sum_{i = 1}^n (M_i - m_i) \Delta x < \epsilon \sum_{i = 1}^n \Delta x = \epsilon(b-a). $$ Since $\epsilon$ is arbitrary, we obtain what we need.

Visually, this means the area of the blue bars shown in the picture goes to $0$ as the partition gets finer and finer. If the heights of the rectangles are at most $\epsilon$, then the total area is at most $(b-a)\epsilon$. A great way to visualize it is to slide all the rectangles to the bottom, then the total area is smaller than the area of a rectangle with width $b-a$ and height $\epsilon$.