$K$ is compact and $x\in X$ but $x\notin K$. Show $\exists G_1,G_2$ open in $(X,d)$ s.t. $x\in G_1$ and $K\subseteq G_2$ Suppose $K$ is a compact subset of a metric space $(X,d)$ and $x \in X$ but $x\notin K$. Show that there exist two disjoint open sets of $G_1$ and $G_2$ of $X$ such that $x\in G_1$ and $K\subseteq G_2$.
I attempted the proof as follows:
Since $K$ is compact, it is closed and bounded. Since $x\notin K$ and $K$ is closed, $x\notin \bar{K}$. This means that $d(x,K) \neq 0 \Rightarrow d(x,K) = r$ for some $r>0$. Then just take $G_1 = B(x,r/2)$ and take $$G_2 = \cup_{k\in K} B(k,r/2)$$
$G_2$ is open since the union of arbitrary open sets is open and the two sets are disjoint.
Is this correct? The question gave the following hint which I have not used any of which leads me to think I am doing something wrong:
Hint: use the version of compactness we called "having a compact topology" (this is the definition in terms of open covers) and the Hausdorf property of metric spaces".
 A: Your proof is correct - assuming you know how to show that $G_1$ and $G_2$ are indeed disjoint.
You only used that compact subsets of metric spaces are closed in your proof, so you have effectively proved the stronger assertion that metric spaces are completely regular/$T_{3\frac{1}{2}}$.
Using the hint, you would prove a different strengthening of the assertion:

Let $X$ be a Hausdorff space, $K \subset X$ compact, and $x \in X\setminus K$. Then there are open sets $G_1, G_2 \subset X$ with $x \in G_1$, $K \subset G_2$ and $G_1 \cap G_2 = \varnothing$.

Proof: For every $y\in K$, by the Hausdorff property, there are disjoint open neighbourhoods $V_y$ of $x$ and $W_y$ of $y$. The family $\{ W_y : y \in K\}$ is an open cover of $K$, hence there is a finite subset $F \subset K$ such that $\{ W_y : y \in F\}$ still covers $K$. Then
$$G_1 := \bigcap_{y\in F} V_y$$
is an open neighbourhood of $x$, and
$$G_2 := \bigcup_{y\in F} W_y$$
is an open set containing $K$, and $G_1 \cap G_2 = \varnothing$.
