Does there exist an onto map from $[0,1]$ to $\mathbb Q$? Does there exist an onto map from $[0,1]$ to $\mathbb Q$?
I am unable to come up with a proof or a counter example.
If we take $f$ to be an onto mapping $[0,1]$ to $Q$, then $f([0,1])=\mathbb Q$.
I am unsure if it will give any contradiction. If not then what will be the map?
Can someone please help me out?
If by &quot;map&quot; you mean a &quot;function&quot; then yes. First take any surjection $g:[0,1]\to\mathbb{R}$, e.g. variant of $g(x)=\tan(x)$. Now pick any $x_0\in\mathbb{Q}$ and define
$$f:\mathbb{R}\to\mathbb{Q}$$
$$f(x)=\begin{cases}
x &amp;\text{if }x\in\mathbb{Q} \\
x_0 &amp;\text{otherwise}
\end{cases}$$
It is surjective which I leave as an exercise. You can then compose that $f$ with  $g$ to obtain surjection $[0,1]\to\mathbb{Q}$.
If, on the other hand, by &quot;map&quot; you mean &quot;continuous function&quot; then the answer is &quot;no&quot;: $\mathbb{Q}$ is (totally) disconnected while $[0,1]$ is connected.
Note that to show that the positive rationals are countable, we can use the mapping $$\frac{p}{q} \mapsto 2^p3^q$$ which is onto. It is easy to see then that
$$f(x)=\begin{cases}
\frac{p}{q} &amp;\text{if }x=\frac{1}{2^p3^q}&amp;\text{with }p,q &amp;\text{integers}\gt0\\-
\frac{p}{q} &amp;\text{if }x=\frac{1}{2^p3^q\sqrt{2}}&amp;\text{with }p,q &amp;\text{integers}\gt0\\
0 &amp;\text{otherwise}
\end{cases}$$
is onto from $[0,1]$ to the rationals.