Distance between compact sets Let $K$ and $L$ be nonempty compact sets, and define 
$$d = inf\{\lvert x-y \rvert : x \in K, y \in L\}$$
If $K$ and $L$ are disjoint, show $d \gt 0$ and that $d = \lvert x_{0}-y_{0} \rvert $ for some $x_{0}$ in $K$ and $y_{0}$ in $L$.
 A: By definition of infimum there are sequences $(x_n)_{n\in\mathbb{N}}\subseteq K, (y_n)_{n\in\mathbb{N}}\subseteq L$ with $\lim_{n\to\infty}|x_n-y_n|=d$. From compactness we have convergent subsequences $x_{n_k}, y_{n_k}$ (it's possible to take the same indices $n_k$!), so there are $x_0\in K, y_0\in L$ with $\lim_{k\to\infty}x_{n_k}=x_0$ and $\lim_{k\to\infty}y_{n_k}=y_0$.
So form continuity of $|\cdot|$ we get
$$|x_0-y_0|=|\lim_{k\to\infty} (x_{n_k}-y_{n_k})|=\lim_{k\to\infty}| (x_{n_k}-y_{n_k})|=d.$$
For $K, L$ disjoint, $d=0$ we get the contradiction $x_0=y_0\in K\cap L=\emptyset$.
A: Consider the function
$$f: K \times L \rightarrow \mathbb{R}$$
$$(x,y) \mapsto |x-y|.$$
$f=\vert\cdot\vert \circ -|_{K \times L},$ where $-: \mathbb{R} \times \mathbb{R}$ is the subtraction and $| \cdot|$ is the module function. Hence, $f$ is the composition of continuous functions, therefore continuous. It is clear that $\inf_{x \in K \times L} f=d$. It is also clear, since those sets are disjoint, that $f>0$. Since $f$ is a real continuous function in a compact set, it achieves its infimum in its domain. Therefore, $d>0$.
A: Given a non-empty set $A$ of a metric space $X$, note the function $$\textrm{dist}_A(x) = \inf_{a\in A} |a-x|$$ is continuous and $\textrm{dist}_A(x) = 0$ iff $x \in \textrm{cl}(A)$. Also recall continuous functions on compact sets attain their infimums. Hopefully you can put the pieces together.
A: Hint: Assume that $d=0$ would be true, and take sequences $(x_{n})\subset K$ and $(y_{n})\subset L$ so that $d(x_n,y_n)\to 0$. Use compactness to conclude a contradiction.
