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?
This answer might miss the real goal, but is inspired by the tag "probability".
In your question it is not explicitly mentioned how probability $P$ is defined.
So actually the question: "what is the probability that $x$ is rational?" makes no sense in this context.
Your try indicates that you are thinking of uniform distribution on interval $[0,1]$ where: $$P(B):=\lambda(B\cap[0,1])$$ for every Borel set and $\lambda$ denotes the Lebesgue measure on the $\sigma$-algebra of Borel sets $B\subseteq\mathbb R$.
It is well known that $\lambda(\{x\})=0$ for any $x\in\mathbb R$ and consequently we have $\lambda(S)=\sum_{x\in S}\lambda(\{x\})=0$ for every countable set, and of course $\mathbb Q$ is countable.
So under uniform distribution on $[0,1]$ we have $P(\mathbb Q)=0$.
In probability theory Riemann-integrability is (as far as I know) not practicized.
Notation $P(x\in \mathbb Q)$ only makes sense if $x$ denotes a random variable here.
So your problem setting: "if $x\in[0,1]$ then what is $P(x\in\mathbb Q)$?" is not okay.