Help with partition/width Let $f:[0,2] \to \mathbb{R}$ be defined by
$$f(x)= 
\begin{cases}
    1,& \text{if } x=\frac{2}{n} \text{ for some $n \in \mathbb{N}$};\\ 
    0,              & \text{otherwise}.
\end{cases}$$
We need to prove the function is Riemann integrable on $[0,2].$
I think I can do the epsilon proof on this. I have $M_i$ = $\frac{2}{n-1}$
I am having trouble deciding on the correct $\Delta x_{i}$ because the widths are changing. Aren't they a function of $i$?
 A: I can show that the upper sum minus the lower sum can be made arbitrarily small by choosing the partitions carefully. In this case, yes, the lengths of the subintervals will vary (at least, they vary in my construction).
Fix $\varepsilon > 0$. Without loss of generality assume $\varepsilon < 1$.  For each $n \in \mathbb{N}$ we will select an interval $I_n$ around the point $\frac{2}{n} \in [0,2]$ having length
$$
l(I_n) = \frac{\varepsilon}{2^n}.
$$
Such an interval can be fixed as
$$
I_{n} = \biggl[ \frac{2}{n\vphantom{2^{n+1}}} - \frac{\varepsilon}{2^{n+1}}, \frac{2}{n\vphantom{2^{n+1}}} + \frac{\varepsilon}{2^{n+1}} \biggr] = [a_n,b_n].
$$
Note that $\frac{2}{n} \in I_n$ and if $m \neq n$ then $\frac{2}{n} \not\in I_m$. Let $P_N$ be the partition of $[0,2]$ containing the points $\{ 0,a_N,b_N,a_{N-1},b_{N-1},\dots,a_1,b_1,1 \}$. Then, the lower sum $L(f,P_N)$ will be $0$ because every subinterval will contain points not of the form $\frac{2}{n}$. Let
$$
M_n = \max\{ f(x) : x \in [a_n,b_n] \}, \qquad 1 \leq n \leq N,
$$
and
$$
K_n = \max\{ f(x) : x \in [b_n, a_{n-1}] \}, \qquad 1 < n \leq N.
$$
Clearly, $M_n = 1$ for each $1 \leq n \leq N$ and $K_n = 0$ for each $1 < n \leq N$. Also, define
$$
M_{N+1} = \max\{ f(x) : x \in [0,a_N]\}
$$
and
$$
K_1 = \max\{ f(x) : x \in [b_1,1] \}.
$$
Clearly, $M_{N+1} = 1$ and $K_1 = 0$. So, the upper sum $U(f,P_N)$ can be written as
$$
\begin{align*}
U(f,P) &= \sum_{n=1}^{N} M_{n} \cdot l(I_n) + M_{N+1} \cdot l([0,a_N]) \\
&= \sum_{n=1}^N \frac{\varepsilon}{2^n} + \biggl(\frac{2}{N\vphantom{2^N+1}} - \frac{\varepsilon}{2^{N+1}} \biggr) \\
&= \varepsilon\left( 1 - \frac{1}{2^N} \right) + \biggl(\frac{2}{N\vphantom{2^N+1}} - \frac{\varepsilon}{2^{N+1}} \biggr) \\
&= \varepsilon\left( 1 - \frac{1}{2^{N+1}} \right) + \frac{2}{N} \\
&< \varepsilon + \frac{2}{N}
\end{align*}
$$
since $1 - \frac{1}{2^{N+1}} < 1$. So, by choosing $N$ sufficiently large so that $\frac{2}{N} < \varepsilon$, we get
$$
U(f,P_N) - L(f,P_N) = U(f,P_N) < 2\varepsilon.
$$
Hence, $f$ is Riemann integrable.
A: For each interval in your partition, the infimum is $0$, while the supremum is either $0$ if no $2/n$ is in the interval or $1$ if some $2/n$ is in the interval. Thus the lower sum is $0$ while the upper sum is the sum of the lengths of all intervals which contain some $2/n$. Thus you need to choose partitions such that the total length of those intervals which contain some $2/n$ is arbitrarily small. Hint: you can cram all but finitely many $2/n$'s into one interval.
If you haven't proven the equivalence between Riemann and Darboux integration, the situation is very similar when using the definition of Riemann integration directly, without reference to lower/upper sums.
