# If $f: M \to \mathbb{R}$ is a continuous function such that all values are irrationals, then $f$ is constant whenever $M$ is connected?

(a) Prove if $$f: M \to \mathbb{R}$$ is a continuous function such that all values are integers, then $$f$$ is constant whenever $$M$$ is connected

(b) What if all values are irrationals?

My attempt.

For (a), since $$f$$ is continuous, $$f(M) \subset \mathbb{Z}$$ is connected. But every metric space countable is disconnected and so, $$f(M)$$ is disconnected or constant. Also, $$f(M)$$ is connected because $$f$$ is continuous, then $$f$$ is constant.

Is correct?

For (b), I dont know. Equivalently to item (a), every connected metric space with at least $$2$$ points is uncountable, so I think maybe $$f$$ not need to be constant. I appreciate any help!

• Irrationals, as subspace of the real line, are totally disconnected. If $f$ si continuous and $M$ connected, $f(M)$ is also connected. Hence $f$ must be constant. – Dog_69 Dec 22 '18 at 19:09
• I got it! Thank you! – Corrêa Dec 22 '18 at 19:38
• you can also think of it like that. if $f$ takes at least two different values $i_1$ and $i_2$ irrationals, then since there exists a rational $q$ in $]i_1,i_2[$ and $f$ continuous then $q$ should be reached by $f$ which is a contradiction. – zwim Dec 22 '18 at 20:35
• @Dog_69 Why not an official answer? – Paul Frost Dec 22 '18 at 22:50
The irrationals, with the subspace topology inherited from the real line, are totally disconnected. To see that, let me denote $$I=\mathbb R\setminus \mathbb Q$$ and let $$A\subseteq I$$ be a subset with at least two different points; given $$A,b\in A$$, $$a\neq b$$, there exists $$q\in\mathbb Q$$ such that $$a and thus the sets $$(-\infty,q)\cap A$$ and $$(q,+\infty)\cap A$$ are disjoint non-empty open sets different from $$A$$.
Now, since $$M$$ is connected and $$f$$ is continuous, $$f(M)\subseteq I$$ must be connected. On the other hand, if $$f(M)$$ contained at least two different points, then $$f(M)$$ would be disconnected, as we have seen. Hence $$f$$ is constant.