TITLE: If a set is compact then it is closed
QUESTION [9 upvotes]: Show that if a set is compact then it is closed.
definitions: Let $A\subset \mathbb{R}$. A point $p\in\mathbb{R}$ is an accumulation point or limit point of $A$ if and only if every open set $G$ containing $p$ contains a point of $A$ different from $p$. A subset $A$ of $\mathbb{R}$ is closed if and only if $A$ contains each of its points of accumulation. 
proof: Suppose $A\subset \mathbb{R}$ is compact and $A\subset \bigcup O_\alpha$ where $O_\alpha$ is open. Since, $A\subset \bigcup O_\alpha$ there exists $\alpha_1,\dots,\alpha_n$ such that $$A\subset O_{\alpha_{1}}\cup O_{\alpha_{2}}\cup \ldots \cup O_{\alpha_{n}}$$
Now suppose we have a point $p\in\mathbb{R}$. Let $G = \bigcup_{i=1}^{n}O_{\alpha_{i}}$, and $p\subset G$. Then $p$ is an accumulation point of $A$ since every open set $G$ contains $p$ can also contain a point of $A$ different from $p$.
I am not sure if this is the right approach but it makes sense to me, I just don't know how to go on from here. Any suggestions would be greatly appreciated.

REPLY [3 votes]: Theorem:
If $A \subseteq \mathbb{R}^p$ is compact then $A$ is closed

Proof:
We will show that $\mathbb{R}^p \setminus A$ is open.
Let $x \in \mathbb{R}^p \setminus A$.
We must show that there exists a $r>0$ such that $B(x,r) \subset \mathbb{R}^p \setminus A$.
For each $m \in \mathbb{N}$, let $G_m = \{ y \in \mathbb{R}^p : ||y-x|| > \frac{1}{m} \}$. Each set $G_m$ is open in $\mathbb{R}^p$ (Try to show this)
Now we know $$\displaystyle \bigcup_{m \in \mathbb{N}} G_m =\mathbb{R}^p \setminus \{x\} $$
Since $x \not \in A$, we have $A \subseteq \mathbb{R}^p \setminus \{x\} = \displaystyle \bigcup_{m \in \mathbb{N}} G_m $.
In the view of the compactness of $A$, it follows that there exists a natural number $M$ such that
$$A \subseteq G_1 \cup G_2 \cup \dots \cup G_M$$
Since the sets $G_m$ increase with $m$ we have that $$G_1 \cup G_2 \cup \dots \cup G_M = G_M$$ and
$$A \subseteq G_M = \{ y \in \mathbb{R}^p : ||y-x|| > \frac{1}{M} \}$$
Hence the neighborhood $$B\bigg(x, \frac{1}{M}\bigg) = \{z \in \mathbb{R}^p : ||z - x|| < \frac{1}{M} \} $$ does not intersect with $A$. In other words
$$B(x, \frac{1}{M}) \subset \mathbb{R}^p \setminus A$$ Hence $\mathbb{R}^p \setminus A$ is open and consequently $A$ is closed