Upper Riemann Sum of the Thomae function

I'm reading a real analysis text, and the author want to show that the upper Riemann sum of the following function is always $\lt \epsilon $ :

$f:[0,1] \longrightarrow \mathbb{R}$ given by $f(x) = 0$ if $x \notin \mathbb{Q}$ and $f(x)=\frac{1}{q}$ if $x=\frac{p}{q}$

His argues as follows:

"Given $\epsilon \gt 0$, choose $ X=\{x_1,x_2,\ldots,x_n\}$ such that $f(x_i) \geq \frac{\epsilon}{2(b-a)}$ and choose intervals with center in $x_i$ and lenth $\lt \frac{\epsilon}{2n}$ such that these "n" intervals be disjoints.Let P, be the partition of $[a,b]$ whose points are the intervals extremes together with $a,b$ . Then $S(f;P) \lt \epsilon$."

Why choose $x_i$ like that?And why the lenth must be $\lt \frac{\epsilon}{2n}$?


Solution 1:

This seems confused to me.

You don't choose the $x_i$. The $x_i$ are all the rationals $p/q$ in lowest terms such that $1/q$ is greater than or equal to $\epsilon/2$. There only finitely many of these; namely: $$ 1, {1\over2}, {1\over 3}, {2\over 3}, {1\over 4},{3\over 4},\ldots, {1\over N},\ldots,{N-1\over N} $$ where $N$ is such that ${1\over N+1}<{\epsilon\over 2}$.

Two important (and perhaps redundant) observations:

  1. You have finitely many of these $x_i$, say $x_1,\ldots x_n$. Furthermore, these are the only places where $f$ has a "big" value.
  2. You know that $f(x)$ is small, if $x\notin\{x_1,\ldots,x_n\}$. That is, if $x$ is not one of the $x_i$, then $f(x)<{\epsilon\over2}$.


The upper Riemann sum is split into two parts:

The first part takes advantage of 1. above, and represents the sum of the areas of rectangles whose bases have an $x_i$ in the center. You can take the length of the bases small enough to force the contribution to the total sum of this part to be small. In particular take each base to have length $\epsilon\over2 n$ (or perhaps smaller to prevent overlap).

This way, since by 1. there are $n$ rectangles for this part of the Riemann sum, the sum of the areas of the rectangles corresponding to the $x_i$ is at most $$ \underbrace{n\vphantom{\epsilon\over 2n}}_{\text{ number of}\atop\text{rectangles} }\cdot \underbrace{1\vphantom{\epsilon\over 2n}}_{\text{over estimate}\atop\text{for height}} \cdot \underbrace{{\epsilon\over 2n}}_{\text{width}}={\epsilon\over 2} .$$


The second part of the Riemann sum takes advantage of 2. above: the heights of the rectangles in the sum that are not centered at an $x_i$ is at most $ {\epsilon\over2}$; and, the sum of the areas of these rectangles will be less than, approximating crudely, $1\cdot {\epsilon\over 2}$.

This gives an upper Riemann sum that is less than ${\epsilon\over2}+{\epsilon\over2}=\epsilon$.

Solution 2:

$X$ is finite because for given $q$, $p/q$ is smaller than a given number only for a finite number of values $p$, $\lim_{p\to\infty}p/q=\infty$. Now everything outside of $X$ has a value of less than $\epsilon/2$ and there a $n$ points where the value could be at most $1/1=1$. We cover the latter by appropriate blocks. So we have the baseline $\epsilon/2$ plus the $n$ blocks. The height of these blocks is at most $1$, an their width is less than $\epsilon/(2n)$, so each block has area less than $\epsilon/2n$. There are $n$ of them, which jointly have an area less than $\epsilon/2$. Add the baseline area $\epsilon/2$ and you have less than $\epsilon$.