# $C(X)$ is separable when $X$ is compact?

$X$ is a compact metric space, $C(X)$ is separable when $X$ is compact where $C(X)$ denotes the space of continuous functions on $X$. How to prove it?

And if $X$ is just a compact Hausdorff space, then $C(X)$ is still separable? Or if $X$ is just a compact (not necessarily Hausdorff) space, then $C(X)$ is still separable?

• this result is not trivial: If X is a compact $T_{2}$ space $X$, then $C(X)$ is separable iff there is a metric $X\times X\rightarrow R$ that induces the topology of $X$. You need to use the Stone-Weierstrass Thm, Urysohn Lemma and the Urysohn Metrization Thm. – Matematleta Jun 19 '15 at 13:21
Theorem. If $$X$$ is compact Hausdorff then $$C(X)$$ is separable iff $$X$$ is metrizable.
There is a natural embedding $$x\in X\to \delta _x\in \mathcal{M}(X)$$ (more precisely in the unit ball of $$\mathcal{M}(X)$$). This is an homeomorphism for the weak*-topology of $$\mathcal{M}(X)$$. If $$C(X)$$ is separable then $$(\mathcal{M}(X), w*)$$ have a compact metrizable unit ball. So $$X$$ is metrizable.
For the converse, assume $$X$$ is a metrizable compact Hausdorff space. Let $$d$$ be a metric inducing the topology and $$(x_n)$$ a dense countable subset of $$X$$. Define $$d_n: x\in X \to d_n(x):=d(x,x_n)$$. It is a continuous function. It is easy to check that the algebra generated by $$1$$ and $$(d_n)_n$$ separate the points in $$X$$ so by Stone Weierstrass theorem this subalgebra is dense in $$C(X)$$. By considering linear combination with rational coefficient of element of this subalgebra it is easy to see that $$C(X)$$ is separable.