# Using the definition of Riemann integrability, prove that $f$is Riemann integrable on $[0,1]$

The following problem came up on a test, and I didn't get it correctly. Please help me understand the problem.

Problem: Define $f:[0,1] \to \mathbb{R}$ by $$f(x)= \begin{cases} 1,& \text{if } x=\frac{1}{n}\\ 0 & \text{otherwise} \end{cases}$$ for some integer n.

Using the definition of Riemann integrability, prove that f is Riemann integrable on $[0,1]$ and evaluate the Riemann integral $\int_{0}^{1} f(x)dx$.

My Solution:

Let $\epsilon>0$ and $P$ be the partition of $[0,1]$ such that $P=\{0,\frac{1}{n}- \frac{\epsilon}{3},\frac{1}{n}+ \frac{\epsilon}{3},1\}$.Then note that

$U(f,P)=M_0\Delta x_0 +M_1\Delta x_1+M_2\Delta x_2=0+(\frac{1}{n}+ \frac{\epsilon}{3})-(\frac{1}{n}+ \frac{\epsilon}{3})+0=\frac{2\epsilon}{3}$ and

$L(f,P)=0$.

Thus, for every $\epsilon>0$ $$U(f,P)-L(f,P)=\frac{2\epsilon}{3}<\epsilon$$.

This is the prove that I gave and the mistake that I made was that I fixed n. Some important things that I noticed about this problem were that if you graph the function $f(x)$ most of the points fall to the left or close to zero and a fewer fall to the right. Hence, this makes me believe that I need a partition such that I capture most of the points near zero so that I am only left with a finite number of points close to 1. However, I can't seem to find this partition.Any help would be appreciated. In particular, I would like to know how you come up with the partition since I always struggle to come up with one. Thank you!

Pick $\epsilon > 0$. Let $a_1 < a_2 < \cdots <a_{m-1}$ be the numbers of the form $1/n$ in the interval $(\epsilon/2,1)$. Produce a partition $\mathcal{P}$ of $[0,1]$ by putting a dividing point at $\tfrac{\epsilon}{2}$ and $1 - \tfrac{\epsilon}{2m}$ and all of the $a_i - \tfrac{\epsilon}{4m}$ and $a_i + \tfrac{\epsilon}{4m}$.
The only subintervals containing a point of the form $1/n$ are $[0,\tfrac{\epsilon}{2}]$, the subintervals $[a_i - \tfrac{\epsilon}{4m}, a_i + \tfrac{\epsilon}{4m}]$ and $[1 - \tfrac{\epsilon}{2m},1]$, which have corresponding lengths $\tfrac{\epsilon}{2}, \tfrac{\epsilon}{2m}$. Hence
$$U(f,P) - L(f,P) = U(f,P) = \frac{\epsilon}{2} + \frac{\epsilon}{2m} < \epsilon.$$
What makes this problem slightly tricky is that since there are points of the form $1/n$ arbitrarily close to $0$, you have to choose the first division point of your partition close to $0$. But the closer you put that point to $0$, the more points of the form $1/n$ will lie in your other subintervals. So the size of your other subintervals containing points of the form $1/n$ must depend on the number of such points lying outside the first subinterval, hence the choice of the subintervals $[a_i - \tfrac{\epsilon}{4m}, a_i + \tfrac{\epsilon}{4m}]$.