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

connectednesscontinuitymetric-spaces

(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!

Best Answer

Following the helpful comment of @PaulFrost I have decided to post my comment as an answer.

So, the argument runs as follows:

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<q<b$ 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.

Related Question