# Compact Metric Spaces and Separability of $C(X,\mathbb{R})$ [duplicate]

Let $(X,d)$ be a compact metric space. Show that $C(X,\mathbb{R})$ is a separable metric space (space of continuous functions from $X$ to $\mathbb{R}$).

I first showed that if $(X,d)$ is compact, then it must be separable, so we have a dense subset $\{x_{1},x_{2},...\}$ which is countable of $X$. Then, I'm not so sure on how to move forward. I was thinking of using the Stone Weierstrass Theorem for the set of functions:

$F=\{1,f_{1},f_{2},...\}$

Where $f_{n}(x)=d(x,x_{n})$ for $x \in X$. Then, this implies that the above set is dense in $C(X,\mathbb{R})$ and countable, so $C(X,\mathbb{R})$ is separable if $F$ is a unital separating subalgebra.

Clearly $F$ is unital, but I'm not sure on how to show it is separating and a subalgebra of $C(X,\mathbb{R})$ (it is a subset of the former set since the distance function is continuous). How would one proceed with this step?

## marked as duplicate by Alex M., YuiTo Cheng, cmk, José Carlos Santos, воительJun 18 at 21:56

Let $F$ as you said. Let $\mathbb R[F]$ the $\mathbb R$-subalgebra generated by $F$.

We want to use Stone-Weierstrass theorem on the latter (rather than $F$) and show that it is dense. This will suffice for a proof that $C(X,\mathbb R)$ is separable, since $\mathbb Q[F]$ is countable and dense in $\mathbb R[F]$.

$\mathbb R[F]$ contains $1$ and it is obviously an algebra. Let's show that it separates points.

Let $x\ne y\in X$. Since $\{x_n\}_{n\in\mathbb N}$ is dense, there must exist $x_m$ such that $d(x,x_m)\le \frac13 d(x,y)$. Forcibly, it cannot hold $d(y,x_m)=d(x,x_m)$. If it held, then $$d(x,y)\le d(x,x_m)+d(y,x_m)\le \frac23 d(x,y)$$ absurd. So the function $f_m$ separates $x$ and $y$.

Stone-Weierstrass can therefore be used on $\mathbb R[F]$, completing the proof.

Precisations:

1. How is $\mathbb R[F]$ defined? Either the intersection of all the $\mathbb R$-subalgebras of $C(X,\mathbb R)$ which contain $F$ or, equivalently, as the $\mathbb R$-vector subspace of $C(X,\mathbb R)$ generated by the products of finitley many elements of $F$.

2. How is $\mathbb Q[F]$ defined? Either the intersection of all the $\mathbb Q$-subalgebras of $C(X,\mathbb R)$ that contain $F$ or, as above, the $\mathbb Q$-vector subspace of $C(X,\mathbb R)$ generated by the products of finitely many elements of $F$.

3. Why is $\mathbb Q[F]$ dense in $\mathbb R[F]$? It is rather easy, actually, but the notation is a bit tedious.

If $g\in\mathbb R[F]$, then there exist $k\in\mathbb N,\ g_1, \cdots, g_k\in F$ and a finite set $S\subseteq \mathbb N^k$ such that $$g=\sum_{(n_1,\cdots,n_k)\in S} \lambda_{n_1,\cdots,n_k}g_1^{n_1}\cdots g_k^{n_k}$$ for some $\lambda_{n_1,\cdots,n_k}\in\mathbb R$.

Now, if you approximate each $\lambda_{n_1,\cdots,n_k}$ with rationals $$\alpha_{n_1,\cdots,n_k}^{(t)}\stackrel{t\to\infty}{\longrightarrow}\lambda_{n_1,\cdots,n_k}$$ and call $$g^{(t)}=\sum_{(n_1,\cdots,n_k)\in S} \alpha^{(t)}_{n_1,\cdots,n_k}g_1^{n_1}\cdots g_k^{n_k}\in\mathbb Q[F]$$ you get $$\Vert g-g^{(t)}\Vert_\infty=\left\Vert \sum_{(n_1,\cdots,n_k)\in S} (\lambda_{n_1,\cdots,n_k}-\alpha_{n_1,\cdots,n_k}^{(t)})g_1^{n_1}\cdots g_k^{n_k}\right\Vert_\infty\le\\\le \left(\sum_{(n_1,\cdots,n_k)\in S}\Vert g_1^{n_1}\cdots g_k^{n_k}\Vert_\infty\right)\cdot\max_{(n_1,\cdots,n_k)\in S}\left\vert\lambda_{n_1,\cdots,n_k}-\alpha^{(t)}_{n_1,\cdots,n_k}\right\vert\stackrel{t\to\infty}{\longrightarrow}0$$

• Perfect. How do we define the $\mathbb{R}$-subalgebra generated by $F$? The intersection of all subalgebras that contain $F$? As well, how do we know that the $\mathbb{Q}$-subalgebra is dense in the $\mathbb{R}$-subalgebra? Intuitively I think it would be because of $\mathbb{Q}$ is dense in $\mathbb{R}$, but how would the argument be made rigorous? Thanks! – arcbloom Dec 15 '15 at 5:00
• @fogvajarash, I added something. If you have further perplexities, don't hesitate to ask! – user228113 Dec 15 '15 at 5:40