Is the indicator function of the rationals Riemann integrable? $f(x) =
\begin{cases}
1  & x\in\Bbb Q \\[2ex]
0 & x\notin\Bbb Q
\end{cases}$
Is this function Riemann integrable on $[0,1]$?
Since rational and irrational numbers are dense on $[0,1]$, no matter what partition I choose, there will always be rational and irrational numbers in every small interval. So the upper sum and lower of will always differ by $1$.
However, I know rational numbers in $[0,1]$ are countable, so I can index them from 1 to infinity. For each rational number $q$ in $[0,1]$, I can cover it by $[q-\frac\epsilon{2^i},q+\frac\epsilon{2^i}]$. So all rational numbers in $[0,1]$ can be covered by a set of measure $\epsilon$. On this set, the upper sum is $1\times\epsilon=\epsilon$. Out of this set, the upper sum is 0. So the upper sum and lower sum differ by any arbitrary $\epsilon$. Thus, the function is integrable.
One of the above arguments must be wrong. Please let me know which one is wrong and why. Any help is appreciated.

What you showed is that the function is not Riemann integrable, while it is Lebesgue integrable. 
