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".