# How do you show the Riemann function is Riemann integrable?

Consider the so-called Riemann function $f:[0,1]\to\mathbb R$, defined by $$f(x)= \begin{cases}0 & \text{if } x \text{ is irrational or }x=0,\\ \frac1n & \text{if }x=\frac{m}n \text{ where the fraction }\frac{m}n\text{ is irreducible and } n \geq1.\end{cases}$$ Show that the function $f$ is Riemann integrable on $[0,1]$. Show that for given $\epsilon>0$ there exists only finitely many $x\in(0,1]$ such that $x=\frac{m}n$ and $\frac1n\geq\frac{\epsilon}{2(b-a)}$. Use this fact to find $\delta > 0$ such that for every partition P satisfying $\|P\|<\delta$ we have $S(f,P)-s(f,P)<\epsilon$.

Particularly, I wonder how you show there are only finitely many $x$ and how that relates to the condition $\|P\|<\delta$.

Naturally, there are only finitely many $n$ such that $\frac{1}{n} \geq \frac{\epsilon}{2(b-a)}$, because $\frac{1}{n}$ is a function that decreases with $n$. Now, since our domain is $(0,1]$, we must have $m \leq n$, which means only finitely many m exist, so only finitely many $x=\frac{m}{n}$ exist. Let the number of such $x$ be $N$. Take any partition $P$ of $[0,1]$, $P = x_0 < x_1 < ... < x_k=1$. Note that: $$S(f,P) = \sum (x_{i+1} -x_i) M_i, M_i=\displaystyle\sup_{[x_{i+1},x_i]} f(x)$$ $$s(f,P) = \sum (x_{i+1} -x_i) m_i, m_i=\displaystyle\inf_{[x_{i+1},x_i]} f(x)$$ But then $m_i=0$ for all $i$, since in every interval there is some irrational number. So $s(f,P)=0$. Now note that $f(x) \leq 1/2$ except at $x=1$. In order to take care of that, we will consider a partition of [0,1] where $\delta > 2N$. Let it have say T partition points.Now, we have that:
$$S(f,P) = \sum_{i=0}^{T-1} (x_{i+1} -x_i) M_i, M_i=\displaystyle\sup_{[x_{i+1},x_i]} f(x) \leq \sum_{i=0}^{T-2} (x_{i+1} -x_i) * 1/2 + (1-x_{T-1})$$