Compact metric connected space

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?

-
I don't see how this can be used to get a path, could you elaborate on this a little bit? – user66906 May 7 '14 at 0:03
I see that you get a number of fixed points such that the distance can become arbitrarily small. I don't see how to "fill in"? – user66906 May 7 '14 at 0:15
@user2357112: Dear user and Lipschitz, One thing to be careful about with this suggested "filling in" argument is to be careful that compactness is used somewhere, since the statement can be false for non-compact $X$. Regards, – Matt E May 7 '14 at 0:38
@user2357112 The set $X=\left\{(x,\sin(1/x))|0<x\leq 1\right\}\cup\left(\left\{0\right\}\times[-1,1]\right)$ is compact (and connected), satisfies the condition in the question, but it is not path-connected. – Luiz Cordeiro May 7 '14 at 0:56
Aw, crap, I misremembered the conditions under which connected and path-connected are equivalent. – user2357112 May 7 '14 at 0:59

Suppose $X$ wasn't connected. Let $A$ be a non-trivial clopen in $X$. Then, $A$ and $X\setminus A$ are closed, hence compact, subsets of $X$, so there exist $a\in A$ and $b\in B$ such that $(0<)d(a,b)=\min\left\{d(x,y):x\in A, y\in B\right\}$. By assumption, there exists a sequence $a=x_1,\ldots,x_n=b$ satisfying $d(x_i,x_{i+1})<d(a,b)$. Let $i_0=\max\left\{i:x_i\in A\right\}$ (notice that $1\leq i_0<n$). Then $x_i\in A$ and $x_{i+1}\in X\setminus A$, and $d(a,b)\leq d(x_i,x_{i+1})<d(a,b)$, a contradiction.

Therefore, $X$ is connected.

-

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.

-
Dear Peter, That's nice! Cheers, – Matt E May 7 '14 at 2:26