# Prove that every compact metric space is separable

I'm in high school and self-studying analysis. I completed this proof for a problem in Rudin, but wanted some verification. Does this look correct?

Proof that every compact metric space $K$ has a countable base and is therefore separable:

Consider $p \in K$ with an arbitrary $\epsilon > 0.$ By the Archemedian Principle, there exists a natural number $n$ such that $\frac{1}{n} < \epsilon.$

Consider the open cover $$K \subset \bigcup_{i \in K} N_{\frac{1}{n}}(i).$$ Since $K$ is compact, there exists a finite subcover $$K \subset \bigcup_{i \in X_n} N_{\frac{1}{n}}(i),$$ where $X_n = \{x_{1_n}, x_{2_n}, x_{3_n}, ... x_{j_n}\} \subset K$ for some $j_n \in \mathbf{N}.$

Since $p \in K$, $p \in N_{\frac{1}{n}}(x_{i_n})$ for some $x_{i_n} \in X_n$.

This means that $d(p, x_{i_n}) \leq \frac{1}{n}$, which also implies that $x_{i_n} \in N_\frac{1}{n}(p) \subset N_{\epsilon}(p),$ so $x_{i_n} \in N_{\epsilon}(p).$

Since $x_{i_n}$ is a member of $X_n$, $N_{\epsilon}(p)$ thus intersects the finite subset $X_n$.

As the choices for $p \in K$ and $\epsilon$ were arbitrary, any neighborhood around every point in $K$ must intersect a countable subset $X$.

By definition of closure of a set, $K \subset$ cl$(X)$. This means that $X$ is dense in $K$ and thus forms a countable base.

Therefore $K$ is separable.

The idea is correct, but not well argumented, I think. It's mostly a problem of notation, however, plus a weakness I'll underline later on.

I'd follow the hint, that is, proving first the space has a countable basis.

For all integers $n>0$, the open cover $\{N_{1/n}(p):p\in K\}$ has a finite subcover; let $X_n=\{x_{n,1}, x_{n,2}, \dots, x_{n,m(n)}\}$ be such that $$K=\bigcup_{i=1}^{m(n)}N_{1/n}(x_{n,i})$$ I claim that the set $$\mathcal{B}=\bigcup_{n>0}\bigl\{N_{1/n}(x_{n,i}):1\le i\le m(n)\bigr\}$$ is a countable basis for $K$. Countability is obvious. Let $p\in K$ and $\varepsilon>0$; we want to prove that there exist $n>0$ and $i$ with $1\le i\le m(n)$ such that $N_{1/n}(x_{n,i})\subseteq N_\varepsilon(p)$.

Take $n$ such that $1/n<\varepsilon/2$. Then $p\in N_{1/n}(x_{n,i})$, for some $1\le i\le m(n)$. If $q\in N_{1/n}(x_{n,i})$, then $$d(p,q)\le d(p,x_{n,i})+d(x_{n,i},q)<\frac{1}{n}+\frac{1}{n}<\varepsilon$$ so $N_{1/n}(x_{n,i})\subseteq N_\varepsilon(p)$ (this is a point where your proof is weak).

Now every metric space having a countable basis is separable. It suffices to take a point in each (nonempty) member of the basis and this is a dense subset, because each open set is the union of members of the basis, so it intersects this countable subset.

• Thanks a lot. I'm not quite sure why showing that there exists some $N_{1/n}(x_{n,i})$ such that it is a subset of $N_\varepsilon(p)$ shows that $B$ is a base. Does this come from the definition? – lithium123 Oct 14 '17 at 20:36
• @lithium123 Since an open set is the union of spheres, and every sphere $S$ contains an element of $\mathcal{B}$ (in turn containing the center of $S$), then every sphere, and so every open set, is the union of elements of $\mathcal{B}$. – egreg Oct 14 '17 at 20:39

$X_n = \{x_{1_n}, x_{2_n}, x_{3_n}, ... x_{j_n}\} \subset K$

This should say something like $X_n = \{x_{1,n},\dots,x_{j_n,n}\}$. Writing $1_n$ and $2_n$ and so on doesn't make sense. We put subscripts on variables, not numbers.

This bit doesn't make sense:

As the choices for $p \in K$ and $\varepsilon$ were arbitrary, any neighborhood around every point in $K$ must intersect a countable subset $X$.

What is $X$? Does it depend on $p$? on $\varepsilon$? Maybe you mean to say that $X = \bigcup_{n \ge 1} X_n$ but then you've defined $n$ based on $\varepsilon$ when you shouldn't have.

You also seem to be confusing "countable base" for "countable dense set" when these are different things. A countable base is a countable collection $B$ of open sets such that every open set can be written as a union of sets in $B$. For instance $B = \{(a, b) : a < b \text{ and } a, b \in \mathbf{Q} \}$ is a countable base for the topology of $\mathbf{R}$.

What you will have are sets $X_n = \{x_{1,n},\dots,x_{j_n,n}\}$ such that $$K = \bigcup_{i = 1}^{j_n} N_{1/n}(x_{i,n}).$$ Then $$B = \{ N_{1/n}(x_{i,n}) : n \in \mathbf{N}, 1 \le i \le j_n \}$$ is a countable base and $$X = \{ x_{i,n} : n \in \mathbf{N}, 1 \le i \le j_n \}$$ is a countable dense set.