How to prove that a compact set in a Hausdorff topological space is closed?

How to prove that a compact set $K$ in a Hausdorff topological space $\mathbb{X}$ is closed? I seek a proof that is as self contained as possible.

Thank you.

Solutions Collecting From Web of "How to prove that a compact set in a Hausdorff topological space is closed?"

Fix $x\in\mathbb{X}\setminus K$. Since $\mathbb{X}$ is Hausdorff, for each $y\in K$ there are disjoint open sets $U_y$ and $V_y$ such that $x\in U_y$ and $y\in V_y$. $\{V_y:y\in K\}$ is an open cover of $K$, so it has a finite subcover, say $\{V_y:y\in F\}$, where $F$ is some finite subset of $K$. Let $$U=\bigcap_{x\in F}U_x\;;$$ clearly $U$ is an open nbhd of $x$ disjoint from $K$. Since $x$ was an arbitrary point of $\mathbb{X}\setminus K$, $K$ must be closed.

A “sequential” proof: Let $x_\alpha \in K$ be a net with limit $x \in \mathbb{X}$. By compactness of $K$, there exists a subnet $x_{\alpha_{\beta}}$ which converges in $K$. Let $y \in K$ denote its limit. Since it’s a subnet of $x_\alpha$, it follows that also $x_\alpha \to y$. Since $\mathbb{X}$ is Hausdorff, nets have unique limits, so $y=x$ and in particular $x \in K$.