Define
$f(x) = \left\{ \begin{array}{ll} 1 & \mbox{if } x \in \mathbb{Q} \\ 0 & \mbox{if } \notin \mathbb{Q} \end{array} \right.$
How to evaluate $\int_0^1 f(x)\,dx$ ?
I have no idea how to solve it, but all I think is that: since between any two rational numbers there exist an irrational number and vice versa, so the number of rational and irrational numbers are same in the interval of $[0,1]$ (or $[0,1)$ to be precise), and since the integral is equivalent to area under the function, so $\int_0^1 f(x)\,dx$ must be equal to $\frac{1}{2}$. Is that correct?
Thank you.