# One-to-one function from the interval $[0,1]$ to $\mathbb{R}\setminus\mathbb{Q}$?

This question might turn out to be really trivial.

$f$ is a one-to-one function from the interval $[0,1]$ to $\mathbb{R}$. Is it necessary that $\exists q \in \mathbb{Q}$ such that $f(x) = q$ for some $x \in [0,1]$ i.e. is it necessary that the image of $f$ contains a rational number?

I came across this question when I was browsing through some website.

I think this is false. But I am unable to come up with a counter example.

-
The cardinality of the rationals is countable. The cardinality of the reals is a continuum. So the irrationals also have the cardinality of the continuum. So compose any 1-1 function $[0,1] \to \mathbb R$ with a bijection $\mathbb R \to \mathbb R \setminus \mathbb Q$ and you have an answer to your question. – Ryan Budney Nov 22 '10 at 5:39
@Ryan: Ok. Thanks – user17762 Nov 22 '10 at 5:44
It would be nice if the title reflected the question a little more closely. Right now, it reads as if the question is about whether there exists a one-to-one function from $[0,1]$ to $\mathbb{R}$. – Rahul Nov 22 '10 at 6:22
@Rahul: I edited the title. @Sivaram: I hope it is OK that I changed your title along the lines of Rahul's suggestion. – Jonas Meyer Nov 22 '10 at 6:31
@Rahul, Jonas: Yes. The title now makes better sense. Thanks Jonas. – user17762 Nov 22 '10 at 6:39

If you want an explicit counterexample, define $f:[0,1]\to\mathbb{R}$ by $f(x)=x$ if $x$ is irrational, $f(x)=\sqrt2+x$ if $x$ is rational.
It is obviously false since $[0,1]$ and $\mathbb{R}\setminus\mathbb{Q}$ have the same cardinality, so there exists a function $f: [0,1] \to \mathbb{R}\setminus\mathbb{Q}$ that is bijective. Do codomain expansion and you get an injective map from the unit interval to $\mathbb{R}$ that has no rationals in its range.