Proving a continuous function is constant, given some conditions? So here is my question: I need to prove that a continuous function $f: M \mapsto \mathbb{Z}$, is constant provided that M is connected. 
I am having trouble understanding this statement; if I set M = $\mathbb{R}$, how is $f$ constant?
Am I misinterpreting the question?
Thanks.
 A: Hint: A singleton in $\mathbb{Z}$ is both open and closed. If you take a pre-image of a singleton in the range of $f$, what do you conclude?
A: The image of a connected set under a continuous function is connected. What are the connected subsets of the integers?
A: Claim: 

a continuous function $f:\mathbb{R} \to \mathbb{Z}$ must be constant function.

If not, let ${\rm Image}(f)= \{r_{1},\ldots,r_{n},\ldots\}$ . Then $\exists $ disjoint open set $V_{1},\ldots,V_{n},\ldots$ s.t. $r_{1} \in V_{1},\ldots,r_{n}\in V_{n},$ and so on. Now $f^{-1}({V_{1}}),\ldots ,f^{-1}({V_{n}})$ all are disjoint open sets in $\mathbb{R}$. And their union is $\mathbb{R}$; which is a contradiction: as $\mathbb{R}$ is connected set. Hence ${\rm Image}(f)$ must be a singleton set.
A: If f : M → R is continuous and M is connected, then f(M) is connected. Hence, assuming M is nonempty, f(M) must be a singleton or an interval.
Since neither the integers nor the irrationals contain an interval, if f(M) is a subset of either of them, f(M) must be a singleton, hence f must be constant.
