[Math] Is a continuous map from a connected set to the natural numbers constant

general-topologyreal-analysis

I am given that $(X,d)$ is a metric space and $f: X \rightarrow \mathbb{N}$ is a continuous function. I want to show that if $X$ is connected, then $f$ is constant.

My proof goes as follows:

Suppose, as a contradiction, that $f(X)$ is not constant, then it is an interval $(a,b)$ containing only natural numbers. Take any two natural numbers $f(x_1), f(x_2) \in (a,b)$ and such that $f(x_1) \neq f(x_2)$. Then, since $f$ is continuous, that implies that for any $\epsilon >0$, there exists a $\delta$ such that $d_x(x_1,x_2)<\delta$ implies $d_{\mathbb{N}}(f(x_1),f_(x_2))< \epsilon$. But, if we let $\epsilon = \frac{1}{2}$, the only way that $d_{\mathbb{N}}(f(x_1),f_(x_2))< \epsilon$ is to find a $\delta$ such that we have $d_{\mathbb{N}}(f(x_1),f_(x_2))=0$ but for such $\delta$ this would imply that $f(x_1)=f(x_2)$ which is contradiction, since we assumed $f(x_1) \neq f(x_2)$. Thus is must be that $f(X)$ is a constant.

Is this prove right? I am trying to exploit the fact that $f$ is continuous and if $f(X)$ is not constant then it would be an interval that is not continuous, since no interval in $\mathbb{N}$ is continuous.

Best Answer

The answer is yes.

Since $f$ is continuous and $X$ is connected, then the image of $f$ must be connected, but the only connected sets in a discrete space are singletons. Hence the image of $f$ must be mapped to a single element.