TITLE: Probability of a number being rational
QUESTION [6 upvotes]: If $x \in [0, 1]$, what is $\text{P}(x\in \mathbb Q)$? 
  In other words, what is the probability that $x$ is rational?

This is what I tried:
$$\begin{array}{rcl}\text{P}(x \in \mathbb Q) &=& \displaystyle \int^1_0 f(x)\,dx
\end{array}$$
where 
$$f(x) = \begin{cases}1, & x \in \mathbb Q\\0, & x\notin\mathbb Q\end{cases}$$
However, the function is not Riemann-integrable.
I want to try comparing the cardinalities of the rational set and the irrational set by using a one-to-one mapping between the two sets. But I don't have idea how I can do it. Can anyone give a hint?

REPLY [2 votes]: I want to try comparing the cardinalities of the rational set and the irrational set by using a one-to-one mapping between the two sets

You can't. The set of rationals is countable. The set of irrationals is uncountable (see Proof that the irrational numbers are uncountable). Cantor proved by diagonalization that such that mapping cannot exist.