TITLE: Compact metric connected space
QUESTION [7 upvotes]: If I have a compact metric space $X$ such that for all $a,b \in X$, there are points $a:=x_1,...x_n=:b$ such that $d(x_i,x_{i+1})< \varepsilon$, then this space is connected. Somehow, I don't see how to do this. Does anybody have an idea?

REPLY [11 votes]: We may show any function $f:X\to \{0,1\}$ that is continuous must be constant, where $\{0,1\}$ is endowed with the discrete topology, let $\rho$ be the discrete metric.
Pick $x\in X$, and keep it fixed. Now pick any other $y\in X$. Since $f$ is continuous and $X$ is compact, $f$ is uniformly continuous by Heine-Cantor. Thus given $\eta >0$, there exists $\varepsilon >0$ such that $d(z',z)<\varepsilon\implies \rho(f(z'),f(z))<\eta$. Let's pick $0<\eta<1$, so that $d(z',z)<\varepsilon\implies f(z')=f(z)$.
Now, given this $\varepsilon$; chain up $x$ to $y$ by $x=x_0,x_1,\ldots,x_n=y$ and $d(x_i,x_{i+1})<\varepsilon$. Then $f(x)=f(x_0)=f(x_1)=\cdots=f(x_n)=f(y)$. Since $y$ was arbitrary, $f(y)=f(x)$ for any $y\in X$, so $f$ is constant, and $X$ is connected.