# Continuous function from connected metric space to disrcete metric space

In the following (Terence 2006, p.38) I have to prove as exercice:

Let $f : X \to Y$ be a function from a connected metric space $(X, d)$ to a metric space $(Y, d_{disc} )$ with the discrete metric. Show that $f$ is continuous if and only if it is constant

I have proven this proposition without using the fact that $X$ is connected, so obviously I did something wrong. I would be very gratefull if you could point out my mistake.

Proof: $\impliedby$ Suppose $f$ is constant, i.e., $$\forall x,x'\in X: f(x) = f(x')$$ Choose an arbitrary $\varepsilon>0$. Then, no matter what our choice of $\delta_{\varepsilon}$ is, due to the definition of the discrete metric we always have $$d(x,x_0)<\delta_{\varepsilon} \implies d_{disc}(f(x),f(x_0))=0<\varepsilon$$

$\implies$ Now suppose that $f$ is continuous. Then, for any $x_0 \in x$ we have $$\forall \varepsilon>0 \quad \exists \delta_{\varepsilon}>0 \quad \forall x \in X: \quad d(x,x_0)<\delta_{\varepsilon} \implies d_{disc}(f(x),f(x_0))<\varepsilon$$ Now suppose, for the sake of contradiction, that $f$ is not constant, i.e., $$\exists x_0 \in X \quad \forall x \in X/\{x_0\}: f(x) \neq f(x_0)$$ But then, for such $x_0$ we cannot find a $\delta_{0.5}$ so that $d(x,x_0)<\delta_{\varepsilon} \implies d_{disc}(f(x),f(x_0))<0.5$ - a contradiction.

• Your direction is reversed. In your attempt, $\impliedby$ first, $\implies$ second. – xbh Sep 5 '18 at 8:01
• Corrected it, thanks for pointing out. – Cebiş Mellim Sep 5 '18 at 8:03
• "$f$ is not constant" does not mean that $f(x) \neq f(x_0)$ for all $x\neq x_0$. – xbh Sep 5 '18 at 8:03
• Also your proof did not use the assumption that $X$ is connected. – xbh Sep 5 '18 at 8:04
• Yes, if you have learned it. – xbh Sep 5 '18 at 8:20

Let $y_1,y_2 \in f(X)$. Write $Y=Y_1 \cup Y_2$ where $Y_1 \cap Y_2 = \emptyset$ and $y_1 \in Y_1,y_2 \in Y_2$. Since $Y_1$ and $Y_2$ are open sets as its a discrete metric space, $f^{-1}(Y_i)$ must be open and $X=f^{-1}(Y_1) \cup f^{-1}(Y_2)$ contradicting the connectedness of the metric space $X$.