# Determining whether a given set can be an image of continuous function

The problem asks as, whether there exists a continuous function $f: \Bbb{R} \rightarrow \Bbb{R}$ an image of which is set:

• $[0,1)$
• $(0,1]\cup[2,3]$
• $\Bbb{Q}$

So - for $[0,1)$ you can see that you can create function $f$ for which $\lim_{x\rightarrow +\infty} f(x) = 1$, and from $-\infty$ to some finite number it is constant $f(x)=0$ and than you can make a "smooth", parabolic transition between $0$ and $1$. For the second and third set you kinda see that it's not possible, as there is a gap between every rational number and between $1$ and $2$. But how to prove such things formally?

For the first one, i will give you an example with image $(0,1]$: $x \mapsto \frac{1}{x^2+1}$. I think you are capable of adjusting this to $[0,1).$
$(0,1]\cup[2,3]$ and $\mathbb Q$ are both not connected.