# Computing the integral of the following piece wise function

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 ?

• yes, it is correct Sep 14, 2019 at 1:15
• Thank you for the reply! Sep 14, 2019 at 1:18

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$$.