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.


Solution 1:

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.

Solution 2:

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.