# Riemann integral of Thomae's Function - an slightly alternate approach

I have seen a few solutions to this problem, but they all mention "countable number of discontinuities" or something to that effect. I'm not familiar with such a concept, so I'm trying to prove it in a different manner.

I am looking for pointers on how to proceed with this proof in this fashion, and where I went wrong.

## Definition of Riemann Integrable

Let $$f:[a,b]\to \mathbb{R}$$ be a bounded function. Then $$f$$ is integrable if and only if there is a sequence of partitions $${P_n}$$ of the interval $$[a,b]$$ such that $$\lim\limits_{n\to \infty} [U(f,P_n) - L(f,P_n)] = 0$$ Moreover, for any such sequence of partitions, $$\lim\limits_{n\to \infty} L(f,P_n) = \lim\limits_{n\to \infty} U(f,P_n) = \int_a^b f.$$

## Proof

Let $$f:[0,1]\to \mathbb{R}$$ be defined by

$$f(x) = \begin{cases} \frac{1}{q} & x = \frac{p}{q}, \text{ p and q coprime}\\ 0 & \text{otherwise} \end{cases}$$ Let $$P_n$$ be the regular partition of $$\left[ 0, \frac{1}{2} \right]$$ with $$n$$ partition points.

Then the partition point $$x_i \in P_n$$ is given by $$x_i = \frac{i}{2n}$$

On an arbitrary partition interval $$I = [x_{i-1}, x_i]$$ of $$\left[ 0, \frac{1}{2} \right]$$, the maximum $$M_i$$ of $$f(x)$$ is $$x_i$$.

I suspect the statement about the maximum of the interval to be true, but I do not know how to prove it.

The minimum $$m_i$$ of $$f(x)$$ is $$0$$ because the irrationals are dense in $$\mathbb{R}$$, so there is always an irrational in the interval, and all values of $$f(x)$$ are nonnegative.

Then the Lower Darboux Sum is $$0$$ for every partition interval, and the Upper Darboux Sum is given by $$U(f,P_n) = \sum_{i=1}^n M_i (x_i - x_{i-1}) = \sum_{i=1}^n \frac{i}{2n}\left( \frac{i}{2n} - \frac{i-1}{2n} \right) = \frac{1}{4n^2}\sum_{i=1}^n i$$ $$U(f,P_n) = \frac{1}{4n^2} \frac{n(n+1)}{2} = \frac{1}{8} + \frac{1}{8n}$$

Here lies my problem - this sum would ideally go to $$0$$ as $$n\to \infty$$, but it does not. Perhaps my choice for the maximum was poor.

The rest of the proof would be, if the above limit worked out properly, that I would use another partition for $$\left[ \frac{1}{2}, 1 \right]$$, and then by linearity say that the Upper Darboux Sum is the sum of the two, and I would get $$0$$, which is the Lower Darboux Sum, and all would be well.

The statement about the maximum is false. As a result you are mistakenly computing an upper sum for $$f(x) = x$$ where, of course, the integral over $$[0,1/2]$$ is $$1/8$$.
For a counterexample to your statement, take $$n = 4$$ and $$[x_{i-1},x_i] = \left[\frac{2}{8}, \frac{3}{8}\right]$$.
Note that $$f(x_{i-1}) = \frac{1}{4}$$, since $$\frac{2}{8} = \frac{1}{4}$$ in lowest terms, and $$f(x_i) = \frac{1}{8}$$, since $$\frac{3}{8}$$ is already in lowest terms. Here we have $$f(x_{i-1}) > f(x_i)$$.