Open set covering compact subset if metric space. Let $X$ be a compact metric space. Let $k$ be a compact subset of $X$ and let x∈X~k. Show that there exists two open sets $O$ and $U$ such that $U$ contains $k$ and $O$ contains $x$ for which $U \cap O = \emptyset$.
Since $K$ is totally bounded we can choose $U = \cup$ $B(x_i,r)_{i=0}^n$ such that $U$ covers $K$ for $x_i \in k$.
Now going by contradiction let for some $z\in$X~k such that $B(z,r')$ is open set containing $z$.
If for some $n$ and $B(x_n,r) \in U$, $B(x_n,r) \cap B(z,r') \neq \emptyset$
Let $B(x_n,r) \cap B(z,r') = O'$
Now two cases arise:

*

*if $O' = B(x,r'')$ doesn't have finite subcover then $x \notin k$. Hence there is contradiction!

*if $O' = B(x,r'')$ has finite subcover, then we can say that $O'$ is compact subset. It means there exist a sequence $\{x_n\}$ whose subsequence converges in $O'$. It implies that X~k is also sequentially compact which means X~k is compact. Here it is contradiction!

(Here I've presumed X~k as non-compact) Is it write way to prove?
 A: In general you can demonstrate the following:
Let $(X,\tau)$ be a Hausdorff space. Let $K$ be a compact subset of $X$ and $x\in X-K$. Then exists $U,V\in \tau$ such that $x\in U$, $K\subset V$ and $U\cap V=\emptyset$.
Proof
Let $K\subset X$ compact and $x\in X-K$. For each $z\in K$ we have $x\neq z$ and as $X$ is a Hausdorff space, then exists $U_z , V_z \in \tau$ such that $x\in U_z$, $z\in V_z$ and $U_z \cap V_z=\emptyset$. Let's consider $\Im=\{V_z \}_{z\in K}$ and note that $K\subset \bigcup_{z\in K}V_z$, therefore $\Im$ is an open cover of $K$ and because $K$ is compact there are $z_1, z_2, \ldots , z_n \in K$ such that $K\subset \bigcup_{i=1}^{n}V_{z_i}$. Clearly $V=\bigcup_{i=1}^{n}V_{z_i} \in \tau$.
Now, for each $U_z$ we build $V_z$ such that $U_z \cap V_z=\emptyset$. Let´s consider $U=\bigcap_{i=1}^{n}U_{z_i}\in \tau$ and also $x\in U$ because for each $z_i \in K$ we have $x\in U_{z_i}$.
We have $x\in U$ and $K\subset V$ finally let´s show that $U\cap V=\emptyset$. If $U\cap V\neq \emptyset$ there is $w\in U$ and $w\in V$, then exists $i_0 \in  \{1, 2, \ldots ,n \}$ such that $w\in U_{z_{i_0}}\cap V_{z_{i_0}}=\emptyset$ which is a contradiction.
For your question, remember that every metric space is a Hausdorff space.
A: In case you haven't covered Haussdorff spaces, we can do this using just metric spaces.
Let $x$ be in the complement of the compact set $K$. Consider the family of open sets $$U_n = \{y: d(x,y)\gt\frac{1}{n}\}$$ for $n\in\mathbb N$, (zero is not natural so there is not problem)
For each $k\in K$ we can find $n$ large enough so that $\frac{1}{n}\lt d(x,k)$ from which we conclude that $k\in U_n$. Therefore, the set of $U_n$s form an open cover of $K$. Since $K$ is compact there exists a finite subcover consisting of the $U_n$s, say $U_{i_1}, ... U_{i_m}$. Let $U$ be the union of these sets.
Suppose $U_j$ is such that $\frac{1}{j}$ is the minimum distance to $x$. Then the open ball $B_{\frac{1}{j}}(x)$ is open and since the points in $U$ are farther than $\frac{1}{j}$ away, $U\cap B_{\frac{1}{j}}=\emptyset$.
