Showing a function is Riemann Integrable using lower integral and upper integral Let $f:[0,1]\rightarrow \mathbb R$ be defined by $f(x)=1$ if $x\in\{\ a_1,a_2,...,a_n\}$ and $f(x)=0$ otherwise, where $a_1,a_2,...,a_n$ are some fixed points in $[0,1]$
Is the above function Riemann integrable?
Now since $f$ has finite number of discontinuity it is Riemann integrable but I wanted to show this by finding lower integral and upper integral. Any help ?
 A: First assuming that $0 < a_1 < a_2 < \ldots a_n < 1$, there exists $\delta' > 0$ such that
$$0 < a_1-\delta'< a_1+ \delta' < a_2- \delta' < a_2+\delta' < \ldots < a_n - \delta' < a_n + \delta' <1$$
Given $\epsilon >0$, let $\delta = \min\left(\delta', \frac{\epsilon}{4n}\right)$ and let $P$ be the partition with points
$$0, a_1-\delta, a_1+ \delta, a_2 - \delta, a_2 + \delta, \ldots ,a_n- \delta , a_n+\delta, 1$$
We have $\underset{x \in[a_j-\delta, a_j+\delta]}\sup f(x) =1$ for $j=1,\ldots,n$ and the supremum of $f$ is $0$ on all other subintervals of $P$.
Thus,
$$U(P,f) = \sum_{j=1}^n 1 \cdot 2\delta = 2n\delta \leqslant \frac{\epsilon}{2} < \epsilon $$
Since $L(P,f) = 0$ it follows that $U(P,f) - L(P,f) < \epsilon$ and $f$ is Riemann integrable by the Riemann criterion.
The proof is easily modified to account for $a_1 = 0$ and/or $a_n = 1$.
$$$$
A: Firstly let me note, that for integrability we need, that $N=\{ a_1,a_2,...,a_n\}$ should have null Lebesgue measure, so given any positive number $\varepsilon$, there is a sequence $\{I_n\}$ of intervals in $\mathbb{R}$  such that $N$ is contained in the union of the $\{I_n\}$ and the total length of the union is less than $\varepsilon$.
Let's consider any partition of $[0,1]$ and corresponding upper Riemann sum. If $a_i$ for some $i$ belongs to subinterval, then in sum will be length of this subinterval end here is place to use above property. Other summands are $0$. So, infimum of such sums will be $0$. Same for lower one.
