# A subspace of $\mathbb{R}$ is zero-dimensional iff it is totally disconnected

A topological space (X, T) is zero-dimensional iff it has a basis consisting of clopen sets.

A topological space (X, T) is totally disconnected iff every non-empty connected subspace is a singleton.

I am wondering how we can show the right to left direction of following:

A subspace of $$\mathbb{R}$$ is zero-dimensional if and only if it is totally disconnected.

I already know how to show the left to right direction, using the fact that zero-dimensional Hausdorff spaces are always totally disconnected. But I cannot find a way to prove the other direction.

Thanks!

• Yes, this equivalence holds in all ordered spaces. In general metric spaces these notions can differ a lot, though. There are even infinite-dimensional totally disconnected complete separable metric spaces. – Henno Brandsma Sep 13 '20 at 6:14

HINT: Let $$X\subseteq\Bbb R$$ be totally disconnected. Show that $$\Bbb R\setminus X$$ is dense in $$\Bbb R$$, and use points of $$\Bbb R\setminus X$$ to define clopen sets in $$X$$.
Suppose that $$X \subseteq \Bbb R$$ is totally disconnected, i.e. has no non-singleton connected non-empty subsets.
Let $$O$$ be open in $$X$$, so $$O = U \cap X$$ with $$U$$ open in $$\Bbb R$$, and $$x \in O$$ aritrary.
Let $$(a,b)$$ be an open interval containing $$x$$ and such that $$(a,b) \subseteq U$$. Then there are points in $$(a,x)$$ that are not in $$X$$ (otherwise $$(a,x)$$ would be a non-trivial connected subset of $$X$$ which cannot be), so pick $$p \in (a,x)\setminus X$$. Likewise pick $$q \in (x,b)\setminus X$$. Then $$(p,q) \cap X = [p,q] \cap X$$ and this implies that $$(p,q) \cap X$$ is a clopen (in $$X$$) subset of $$O$$ that contains $$x$$, showing that the clopen subsets of $$X$$ form a base, i.e. $$X$$ is zero-dimensional.