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.