# a compact set $X$ has a countable set $S$ such that $\overline{S} = X$

Suppose $X \subseteq \mathbb{R}^d$. Suppose $X$ is compact. Then there exists a countable subset of $X$, $S \subseteq X$ such that $\overline{S} = X$. How can I show this? I have no idea how to construct such a set $S$. MY idea is to use the fact that $X$ is compact, and somehow cover it with open sets: $B(x, \frac{1}{n} )$. But I am having hard time trying to write it. any help would be greatly appreaciated. thanks

• Every subset of $\Bbb R^d$ is second-countable, that means it has a countable base. Simply intersect all the sets in the countable base of $\Bbb R^d$ with $X$ to get a base for $X$. Now a second-countable space is always separable, meaning that it has a countable dense subset. We obtain such a set by choosing a point from each of the countably many basis sets. – Stefan Hamcke Feb 9 '14 at 22:48
• possible duplicate of Prove: Every compact metric space is separable – Asaf Karagila Feb 9 '14 at 22:52
• The compactness is only of use if we generalize to countably compact subsets of metric spaces. Any countably compact metric space is separable. – Stefan Hamcke Feb 9 '14 at 22:54
• @AsafKaragila Ah yes, I'm being incompetent. – 6005 Feb 9 '14 at 22:55

Every second-countable space is separable. We obtain a countable dense subset by choosing one point from each basis set in the countable base. As $X$ is a subset of a second-countable space, it is itself second-countable, since a base is formed by the intersections of the sets in the base of $\Bbb R^d$. Compactness is not needed for this.
On the other hand, if you want to use the compactness of $X$, then you can omit the fact that $\Bbb R^d$ is second-countable, since every compact metric space is separable. The proof goes as follows:
Start with an $n\in\Bbb N$ and a point $x_1\in X$. If $B_{1/n}(x_1)$ does not cover $X$, then we can choose an $x_2\in X\setminus B_{1/n}(x_1)$. After that we can choose $x_3\in X\setminus(B_{1/n}(x_1)\cup B_{1/n}(x_2))$. This process either stops after finitely many steps. If it doesn't, we would have an infinite sequence $x_1,x_2,..$ which by compactness had a cluster point $x$. The ball $B_{1/2n}(x)$ would contain infinitely many $x_k$ contradicting $d(x_k,x_l)\ge1/n$. We conclude that for every $n\in\Bbb N$, there are $x^n_1,x^n_2,...,x^n_k$ such that the $B_{1/n}(x^n_1),...,B_{1/n}(x^n_k)$ cover $X$. It is easy to show that $x^n_i$ form a countable dense subset.
• Can you show that $\{x^n_i\}$ form indeed a countable dense subset ? – ILoveMath Feb 13 '14 at 22:58
• Sure. If $B_{1/n}(x)$ is some open ball in $X$, then there is an $x^n_k$ such that $B_{1/n}(x^n_k)$ contains $x$, and then clearly $x^n_k\in B_{1/n}(x)$ – Stefan Hamcke Feb 13 '14 at 23:06