TITLE: Computing the integral of the following piece wise function
QUESTION [5 upvotes]: Compute the integral of 
  $$f(t)=\begin{cases}1, \text{ if $t$ is rational}\\0,\text{ otherwise}\end{cases}$$
  on $(0,1)$.

The way I approached this problem was using the upper Darboux integrals, note that $\displaystyle{\sup_{x\in(0,1)}}\{f(t)\}=1$ and $\displaystyle{\inf_{x\in(0,1)}}\{f(t)\}=0$, thus
$$\overline{\int_{0}^1}f(t)\,dt=1\quad\text{and}\quad \underline{\int_{0}^1}f(t)\,dt=0$$
thus the integral does not exist. Is this correct
?

REPLY [3 votes]: Your procedure is correct if Riemann integration is being used, otherwise, if Lebesgue integration is taken into consideration, the integral evaluates to $0$. A more intuitive way you can approach the integral is in the following way: your integral is equivalent to $\mathbb{E}\left[\mathbf{1_Q}(U)\right]$, with $U\sim\mathcal{U}(0,1)$, and thus, it is suffiecient to compute the probability that $U$ is rational, which is evidently $0$.