# Prove if $X$ is a compact metric space, then $X$ is separable.

Let $$X$$ be a metric space. Prove if $$X$$ is compact, then $$X$$ is separable.

1. X separable $$\iff X$$ contains a countable dense subset.
2. $$E \subset X$$ dense in $$X \iff \overline{E} = X$$.
3. $$X$$ compact $$\iff$$ every open cover of $$X$$ admits a finite subcover.

one might also use that $$X$$ compact in a metric space implies closed and bounded.

Proof

We want to show $$\exists E \subset X. X = \overline{E} = E \cup E'$$ where $$E'$$ denotes the set of limit points. If $$X$$ is compact then a subset $$E$$ of $$X$$ would be compact, so that subset is closed and bounded. Since $$E$$ is closed, $$E \supseteq E'$$. Now we need to show that $$E$$ is a countable dense subset... But I don't know where to go from here. I have the following:

Hint: cover $$X$$ with neighborhoods of radius $$\frac{1}{n}$$ - so for every positive integer $$n$$, there are finitely many neighborhoods of radius $$\frac{1}{n}$$ whose union covers $$X$$. So maybe it would be better to work with the open cover definition of compact.

• Is $X$ supposed to be a metric space?! – Matt A Pelto Oct 15 '14 at 0:59
• Yes, $X$ is supposed to be a metric space. – user181728 Oct 15 '14 at 1:01
• The collection of the centers of these balls of radius 1/n, n varying among all positive integers, is a countable and dense set. WARNING: definition 1 is only true in $\mathbb{R}^n$, false in general. Definition 2 is OK. – Pietro Majer Oct 15 '14 at 1:11
• Ooh yes, you're right, thanks. – user181728 Oct 15 '14 at 1:13
• Related: Prove that every compact metric space is separable (Although it seems that in that question the OP asks mainly about verification of their own proof.) – Martin Sleziak Dec 1 '17 at 20:28

One approach is to prove that if $X$ is a compact metric space then $X$ is totally bounded. This means that for every $\varepsilon > 0$ there is a finite number, say $n(\varepsilon)$, of points, call them $x_1,\dots,x_{n(\varepsilon)}$, such that the balls $B_\varepsilon(x_1),\dots,B_\varepsilon(x_{n(\varepsilon)})$ cover $X$. This is actually quite simple to prove, because if $X$ is a compact metric space, then given $\varepsilon > 0$, the cover $\{ B_{\varepsilon}(x) : x \in X \}$ has a finite subcover of the desired form.

From there, cover $X$ with finitely many balls of radius $1$; extract the center of each. Now every point is within $1$ of a point in your (finite) set. Cover $X$ with finitely many balls of radius $1/2$; extract the center from each. Now every point is within $1/2$ of a point in your (still finite) set. Repeat for each $1/m$ for $m \in \mathbb{N}$ and take the countable union. A countable union of finite sets is countable, so you have your countable dense subset.

• There is an incorrect statement in this answer. It is here: "...cover $X$ with balls of radius 1; extract a point from each. Now every point is within 1 of a point in your (finite) set." This gives that every point is within 2 of your finite set. To get it within 1, you must choose the centers of the balls, not any arbitrary point therein. – dbx Dec 1 '17 at 17:00
• @dbx Fair enough, though this constant factor does not really matter for this context (and this question and answer are both over three years old). I've fixed it. – Ian Dec 1 '17 at 20:07
• I actually didn't realize how old it was when i came across it; glad you're still around to fix it! Cheers – dbx Dec 1 '17 at 20:09

Hint: For $\delta$, we see that $\{ B_{\delta}(x) : x \in X \}$ is an open cover of $X$. There is a finite subcover of this cover since $X$ is compact, so there is a finite set $E_\delta$ such that $\{B_\delta(x) : x \in E_\delta\}$ is an open cover of $X$. In particular, this means that for any $y \in X$, there exists a $x \in E_\delta$ such that $d(x,y) < \delta$.

Find a countable union of such $E_\delta$ to construct a dense subset of $X$.

• Okay, I understand that. How do you prove something is dense? By showing that the closure of the countable collection of finite subcovers of $X$ equals $X?$ – user181728 Oct 15 '14 at 1:14
• If $A\subset X$, then $A$ is said to be dense in $X$, if $\overline{A}=X$. – Sujaan Kunalan Oct 15 '14 at 1:16
• The same definition as what Sujaan said but in different words. $A$ is dense in $X$ iff for every open set $O$ in $X$ we have that $A\cap O \not= \emptyset$. – user171177 Oct 15 '14 at 1:17
• Wait, we're dealing with a countable collection of finite subcovers - these subcovers already equal $X$, correct? So the union of all these finite subcover would equal $X$ and so would the closure? – user181728 Oct 15 '14 at 1:18
• No, $E_\delta$ is not the subcover. It is the centers of the balls which compose the subcover. The subcover itself covers $X$, so it's useless as it has uncountably many points. – Bruce Zheng Oct 15 '14 at 1:18

What I think is an easier approach is to prove the stronger property that $X$ has a countable basis (using this hint about the covering $X$ with all open balls with a radius $1/n$ and then the existence of a countably dense subset of $X$ is a consequence of $X$ being second-countable (having a countable basis).

• I haven't learned about countable basis or second-countable, yet. – user181728 Oct 15 '14 at 1:24
• Ok, then never mind. It is just a slightly stronger property that implies being separable (and in this case the proof is much more straightforward like you have already constructed a countable basis for your space so you could be done) – user171177 Oct 15 '14 at 1:27