TITLE: Find a continuous function having following properties.
QUESTION [5 upvotes]: Which of the following statements is/are true?

There exists a continuous map $f:ℝ\to ℝ$
  such that $f(ℝ)=\mathbb{Q} $.
There exists a continuous map $f:ℝ\to ℝ$
  such that $f(ℝ)=\mathbb{Z} $.
There exists a continuous map $f:ℝ\to ℝ^2$
  such that $f(ℝ)=\{(x,y)\in\mathbb{R^2: x^2+y^2=1}\}$.
There exists a continuous map $f:[0,1]\cup[2,3]\to \{0,1\}$


So I try to solve and showed that first option is false, by assuming that there exists a continuous map from $f:ℝ\to ℝ$
such that $f(ℝ)=\mathbb{Q} $.  If there were, then we could find
$a,b ∈ R$ with $f(a) = 1$ and $f(b) = 2$. Either $a < b$ or $b < a$. Let’s suppose $a < b$. Since $f(x)$ is continuous on
$R$ it is also continuous on $[a,b]$. By the intermediate value theorem, and the fact that $1 <
\sqrt{2} < 2$, there exists
a $c ∈ (a,b)$ such that $f(c) =
√ 2$. But $\sqrt{ 2} \not \in Q$, hence $f(R)$, which includes $f(c)$, cannot just be $Q$.
Now my concerns are- 
Can I argue similarly for option 2? My intuition says that option 3 and 4 are correct. But I am unable to find explicit functions so far. 
Can anyone help me to clear my doubts? Thanks.

REPLY [8 votes]: If $f$ is a continuous function from $X\rightarrow Y$ then $f(X)$ is connected if $X$ is connected . $R$ is connected but $Q$ and $Z$ are not. So the first two are impossible. For third take the map $R\rightarrow R^2$ where $f(t)=(cos (t), sin (t)) $ And for the last define $f(x)=0 $ if $x\in [0,1]$ and $ 1 $ if $ x\in [2,3]$

REPLY [5 votes]: Hints for 3: Don't try to find a bijective function; it doesn't exist. What is the name of the set where $x^2+y^2=1$? Have you studied that set before?
Hints for 4: Don't try to find a nice formula, like a polynomial. You can define a function in English if you want. What do you need the function to do?