Prove the following function is Riemann Integrable on $[0,1]$. Suppose that $f:[0,1] \to \mathbb{R}$ is defined by $f(x) = 1$ when $x = \frac{1}{n}$ for some positive integer $n$ and $f(x) = 0$ otherwise. How can I prove that $f$ is Riemann integrable on $[0,1]$?
 A: Here's a more elementary argument. We show that for every tagged partition $P$ of $[0,1]$ of norm at most $\varepsilon \gt 0$, the lower and upper Riemann sums $L(f; P)$ and $U(f;P)$ of $f$ satisfy
$$
0 \leqslant L(f, P) \leqslant U(f;P) \leqslant 2\sqrt{\varepsilon} . \tag{1}
$$
The Riemann integrability of $f$ follows as a consequence. The lower bound is obvious; we show only the upper bound of $O(\sqrt{\varepsilon})$ here. 
Fix a parameter $t \in (0,1)$ (to be determined later).  Without loss of generality With a modest loss in generality, assume that $t$ is the endpoints of two intervals in $P$. [I leave it to the OP to remove this assumption.] The strategy is to bound the contributions of the two types of intervals individually:


*

*Those that fall to the left of $t$ (i.e., those that are a subset of $[0, t]$). The contribution from these intervals to the Riemann sum is at most $t$, the total length of the left part (since the function is always bounded above by $1$ in magnitude). 

*Those that fall to the right of $t$ (i.e., those that are a subset of $[t, 1]$). Of all such intervals, at most $1/t$ of them contain a point of the form $1/n$. Therefore, all but $1/t$ of them contribute zero to the Riemann sum. Since each of these intervals is of length at most $\varepsilon$, the total contribution of these to the Riemann sum is at most $\varepsilon \cdot \frac{1}{t} = \frac{\varepsilon}{t}$.
Adding the two contributions above, we get that the total Riemann sum is at most $t + \frac{\varepsilon}{t}$. Picking $t = \sqrt{\varepsilon}$ to optimise this upper bound, we get $(1)$.
A: The discontinuities of the function are in the form $x=\frac{1}{n}$. Using the given hint by Sivaram Ambikasaran in the comments to construct covering intervals, you can show that the set
$$D=\left\{x\in[0,1]:x=\frac{1}{n}\right\}$$
has measure zero which satisfies the Lebesgue criterion for integrability.
