# My friends saying me this argument is true,but i am not able to visualise this.

Let X=[0,1) U (1,2),is subset of R,equip with usual topology,then their exist a non constant continuous function from X to Q??is it really true??

My argument is,every function from R to Q ,which is cont. Is constant,so how there possible a non constant continuous function from a disconnected space to Q,which is totally disconnected

• Give it different values on the two parts. – Randall Nov 9 '17 at 18:59

Take $f(x) = 0$ for $x \in [0,1)$ and $f(x)=1$ for $x \in (1,2)$. This is a non-constant continuous function from $X$ to $\mathbb{Q}$.
• @SurajThapa, the preimage of $0$ is $[0,1)$, which is closed in $X$, and the preimage of $1$ is $(1,2)$, which is also closed in $X$. Therefore the preimage of every closed set is closed, so $f$ is continuous. – nullUser Nov 9 '17 at 22:54
• Your intuition that this function is not continuous probably stems from the fact that you are looking at sequences approaching $1$ from the left vs. right, but there is no $1$ in $X$ to approach. – nullUser Nov 9 '17 at 22:57
Because $X$ can be written as a union of disjoint open sets ($X$ is disconnected), a continuous function from $X$ to a totally disconnected space may take different values on each component of $X$. Check that $f: X \rightarrow \mathbb{Q}$ given by $$f(x) = \begin{cases} 0, \ x \in [0,1)\\ 1,\ x \in (1,2) \end{cases}$$ is continuous.