# Compact sets in $\mathbb R$ are closed

What is the best way to prove the statement? I know the version of using nested intervals, but is there another way to approach the problem?

• This is also generally true in any metric (or more generally Hausdorff) space. You prove that for a compact set $C$, $\mathbb{R}\setminus C$ is open. You use the open covering definition of compactness to do so. – Moya Oct 3 '15 at 6:45
• So you have three answers, and you selected as the best answer the only one that doesn't help you, (the other two focus on $\mathbb R$) makes sense.. – Gero Oct 4 '15 at 5:36

Let $X \subseteq \mathbb{R}$ be compact, and let $y \in \mathbb{R} \setminus X$. It suffices to prove $\mathbb{R} \setminus X$ is open, i.e. that $\mathbb{R} \setminus X$ contains an open ball about $y$. Since $\mathbb{R}$ is Hausdorff, for each $x\in X$, there exists a neighborhood $U_{x}$ of $x$ and $U_{y}^{x}$ of $y$ such that $U_{x}$ and $U_{y}^{x}$ are disjoint. The set of all $U_{x}$'s for each $x \in X$ form an open cover for $X$, so by the compactness of $X$, there exist finitely many $U_{x_{1}}, \ldots, U_{x_{n}}$ which cover $X$. Can you wrap things up from here?

• Thanks for the suggestion. What I'm looking for is how to view this problem under real analysis? – Quang Dao Oct 3 '15 at 7:13
• Sure. I'm not sure I have a much better answer for you, I'm afraid: what tools did you have in mind, exactly? – Alex Wertheim Oct 3 '15 at 7:18

Yes. Let $A$ be a compact set and let $p\in\mathbb R\setminus A.$ For each $x\in A,$ Let $B_x$ be the open interval $\left(x-\dfrac{|p-x|}{2},x+\dfrac{|p-x|}{2}\right)$ and let $V_x$ be the open interval $\left(p-\dfrac{|p-x|}{2},p+\dfrac{|p-x|}{2}\right).$ Then by the compactness of $A,$ there are $x_1,x_2,\ldots,x_n\in A$ such that $A\subseteq B_{x_1}\cup\cdots\cup B_{x_n}$ and it follows that the set $V_{x_1}\cap\cdots\cap V_{x_n}$ does not intersect $A$ and hence $p$ is an interior point of $\mathbb R\setminus A,$ which implies that $A$ is closed.

Note that a similar argument can be used to prove that every compact subset of a metric space is closed.

If $A \subseteq \mathbb R$ is not closed, take $a \in \overline{A} \setminus A$, and for each $n > 0$ consider $$U_n = ( - \infty , a - \tfrac{1}{n} ) \cup ( a + \tfrac{1}{n} , + \infty ).$$ Then $\bigcup_n U_n = \mathbb{R} \setminus \{ a \} \supseteq A$, however no finite subfamily of $\{ U_n : n > 0 \}$ can cover $A$ since $a$ is a limit point of $A$ (for each $n > 0$ there is an $x \in A$ such that $| x - a | < \frac{1}{n}$).

Therefore $A$ cannot be compact.

(To alter this for a a general metric space $(X,d)$, take $U_n = \{ x \in X : d(x,a) > \frac{1}{n} \}$.)