Distance of sets proof Problem: Let $K$ and $L$ be non-empty compact sets, and define $$d=\inf\{|x-y|:x \in K, y \in L\}$$
(a) If $K$ and $L$ are disjoint, show $d>0$ and that $d=|x_0-y_0|$ for some $x_0\in K$ and $y_0\in L$
My proof:
Let $D=\inf\{|x-y|:x \in K, y \in L\}$, we will fist show D is compact. Let $d \in D $ then $d=|x-y|$. Because $K$ and $L$ are bounded then for any $x\in K$ and $y\in L$ there exists $M_1$ and $M_2$ s.t:
$$|x|<M_1$$
$$|y|<M_2$$
therefore:
$$d=|x-y|<|x|+|y|=M_1+M_2$$
so D is bounded.
Now let $\{d_n\} \subset D$ be a convergent sequence of in D. To show D is closed we must show $d_n \to d$ for some $d\in D$. Notice $$d_n = |x_n - y_n|$$ where $(x_n)$ and $(y_n)$ are convergent sequences in $K$ and $L$ respectively. Since  $K$ and $L$ are closed, every convergent sequence converges somewhere in that set. Hence let $(x_n) \to x$ and $(y_n) \to y$ where $x \in K$ and $y \in L$.
By the reverse triangle inequality and triangle inequality :
$$||x_n-y_n|-|x-y||<|x_n-x+y-y_n|<|x_n-x|+|y_n-y|<\frac{\epsilon}{2}+\frac{\epsilon}{2}=\epsilon $$
Hence $D$ is compact so $\inf(D)$ exists by the Axiom of completeness and $\inf(D) \in D$ therefore $d=|x_0-y_0|$ for some $x_0\in K$ and $y_0\in L$ as desired.
We will now show $d>0$ suppose for a contradiction that $d=0$ then there would exist some $x \in K$ and $y \in L$, such that $|x-y|=0$ therefore $x=y$ but this contradicts the fact that $K$ and $L$ are disjoint.
Why I am confused: The next part of the problem asks me to prove the following:
(b) Show that it is possible to have $d=0$ if we assume only that the disjoint sets $K$ and $L$ are closed
What am I confused about: I showed that the set $D$ was closed using the fact that $K$ and $L$ were closed so I think I might have done something wrong there but I am not sure what exactly.
Any help would be appreciated.
Thank you!!
 A: For a counterexample, try $C=\{(x,1/x):x>0\}$ and the $x$-axis. I do not understand your proof, but I can offer some hints on one way to do it: in fact, prove the more general result, in which $L$ is only assumed to be closed.
$1).\ $ Set $d=\inf\{|x-y|:x \in K, y \in L\}.$ Find sequences $(x_n)\subseteq K,(y_n)\subseteq L$ such that $|x_n-y_n|\to d.$
$2).\ $ Pick a point $x_0\in K$ and $y_0\in L$ and show that
$\inf\{|x-y|:x \in K, y \in L\}=\inf\{|x-y|:x \in K, y \in L\cap \overline B(x_0,2|x_0-y_0|)\}.$
$3).\ $ There is a subsequence $(x_{n_k})$ that converges to some $x\in K.$
$4).\ (y_{n_k})$ is a sequence in $L\cap \overline B(x_0,2|x_0-y_0|)$, which is compact, so there is a subsequence $(y_{n_{k_l}})$ that converges to $y\in L.$
$5).\ $ Conclude that $(x_{n_{k_l}}-y_{n_{k_l}})\to (x,y)$, that $|x-y|=d$ and that $d>0.$
Remark: the slick way to do it is to note that $d:X\times X\to \mathbb R:(x,y)\mapsto d(x,y)$ is continuous. Since $d(x,y)>0$ whenever $x\neq y$ and since $K\times L$ is compact, $d$ must have a strictly positive minimum on $K\times L$.
