Compactness, open covers and intersection 
Let $K\subseteq \mathbb{R}$ be a compact subset and $A\subseteq \mathbb{R}$ be a closed subset such that $A\cap K= \emptyset.$ Show that there exists open sets $U,V$ that satisfy the following conditions:  $U\cap V = \emptyset$; $\ K\subset U, A\subset V. $

My first thought after seeing this was to see how the statement would hold applied to a simple case and then to see if I could come up with a more general proof. For simplicity I assumed $K=\{ x_i\}$ as a single point, since as far as I know single points in $\mathbb{R}$ are compact, and then chose $U=(x_{i-1},x_{i+1} )$ as an open interval. From here it was easy to choose  the other two intervals as $A= [x_{i+2},x_{i+3}]$ and $V=(x_{i+1},x_{i+4})$. Assuming that $x_i<x_{i+1}$ holds true what I've shown implies that the statement holds true for every subset that contains only a single number, but I don't really know how I can continue further, I'd appreciate the help.
 A: For each point $x \in K$, we can define the distance $d_x := d(x,A)$ where $d$ is the usual metric on $\mathbb{R}$. Then, we can consider the sets $U_x := B(x,d_x/3)$, $T_x := \overline{B(x,2d_x/3)} \setminus U_x$, and $V_x := \mathbb{R} \setminus (U_x \cup T_x)$. We note that $F \subset V_x$. By construction, $U_x$ is open, $T_x$ is closed, which means that $U_x \cup V_x$ is open. However, $U_x$ is an open interval disjoint from $V_x$, which implies that $V_x$ is open as well.
We use the compactness of $K$ and choose a finite cover of the $\cup_{x \in K} U_x$, denoted $U := \cup_{n=1}^N U_n$. We consider the corresponding $V_n$ and let $V = \cap_{n=1}^N V_n$. Then, $U$ and $V$ are both open, and disjoint by construction. Moreover, $U$ covers $K$, while $V$ covers $A$, as desired.
A: Jeff's answer is absolutely fine, but I would add that this holds more generally for $K,A \subseteq \mathbb{R}$ closed. You may be familiar with the Heine-Borel theorem, which states that for $S \subseteq \mathbb{R}^n$, $S$ closed and bounded iff $S$ compact. More generally, any compact subset of a Hausdorff space is closed.
Proof sketch
Let $X$ be a metric (or topological) space, and let $Y \subseteq X$ be closed. Show that if $U \cap Y \neq \emptyset$ for all neighbourhoods $U$ of $x \in X$, then $x \in Y$.
Now returning to your specific question, deduce that $\forall x \in A$, $\exists \varepsilon_x >0$ such that $D_{\varepsilon_x}(x) \cap K = \emptyset$, and the corresponding result for $x \in K$.
Hence, deduce that there exist disjoint open sets $U,V$ with $A \subseteq U$, $K \subseteq V$.
A: Let $A,K$ be separated subsets of a metric space. That is, $A\cap\overline K=\emptyset=\overline A \cap K.$ Then $A,K$ are completely separated. That is, there are open sets $U,V$ with $A\subset U$ and $K\subset V$ and $U\cap V=\emptyset.$
Proof: The case $(A=\emptyset\lor K=\emptyset)$ is trivial.
If $A\ne\emptyset\ne K$ then for $a\in A$ let $f(a)=\frac {1}{2}\inf \{d(a,x):x\in K\}$ and for $k\in K$ let $g(k)=\frac {1}{2}\inf \{d(y,k):y\in A\}.$ Note that if $a\in A$ or $k\in K$ then $f(a)>0$ and $g(k)>0$ because $A,K$ are separated.
Let $U=\cup_{a\in A}B_d(a,f(a))$ and $V=\cup_{k\in K}B_d(k,g(k)).$
To show $U\cap V=\emptyset,$ suppose by contradiction that $p\in U\cap V.$ Then take $a\in A$ and $k\in K$ such that $p\in B_d(a,f(a))\cap B_d(k,g(k)).$ We have $f(a)>0$ and $g(k)>0$ so by definition of $f$ and $g$ we have $$d(a,p)<f(a)\le \frac {1}{2}d(a,k)$$ $$ d(p,k)<g(k)\le \frac {1}{2}d(a,k).$$ So we have $$d(a,p)<\frac {1}{2}d(a,k)$$ $$ d(p,k)<\frac {1}{2}d(a,k).$$ Therefore by the $\triangle$ inequality we have $$d(a,k)\le d(a,p)+d(p,k)<$$ $$<\frac {1}{2}d(a,k)+\frac {1}{2}d(a,k)=$$ $$=d(a,k)$$ which is the desired contradiction.
