$X, Y \subset \mathbb{R}^n$. Define $d(K, F) = \inf\{ d(x,y), x \in K, y \in F\}$, show that $d(a,b) = d(K,F)$ for some $a$, $b$

Some caveats: Let $K$ be non-empty and compact, $F$ be non-empty and closed, $X, Y \subset \mathbb{R}^n$.

Define $d(K, F) = \inf\{ d(x,y), x \in K, y \in F\}$, where $d(x,y)$ is one of the metrics $d_1$, $d_2$, or $d_\infty$ on $\mathbb{R}^n$.

Show that $d(a,b) = d(K,F)$ for some $a\in K$, $b\in F$.

It seems like the solution would use some properties of compactness and perhaps the Heine-Borel theorem, but I can't figure out where to start. Any help much appreciated.

• @t.b. Thanks for this! I think the questions are different, though: this question doesn't require disjoint sets, and is more about attaining the inf instead of finding that it is greater than 0. – dhz Dec 2 '11 at 12:06
• I just noticed that I didn't prove exactly the statement you wanted to see. The point is that $d(\cdot,F)$ is continuous, hence it assumes its minimum at some point $k \in K$ because $K$ is compact. Now choose $f_n \in F$ such that $d(k,f_n) \to d(k,F)$. Since the intersection of $F$ with the closed ball of radius $d(k,F) + \varepsilon$ around $k$ is compact, we may extract a convergent subsequence of the $f_n$. The limit point $f$ will satisfy $d(k,f) = d(k,F) = d(K,F)$ and $f \in F$ because $F$ is closed. – t.b. Dec 2 '11 at 12:08
• got it. thanks! Brilliant. – dhz Dec 2 '11 at 13:02
• You start off with X and Y and seem to change them to K and F... – Daniel Freedman Dec 2 '11 at 14:56

For each $n$ there are $k_n \in K$ and $f_n \in F$ such that $d(K,F) \leq d(k_n,f_n) \leq d(K,F) + 1/n$ by definition of the infimum. Since $K$ is compact, we may pass to a subsequence $k_{n_i} \to k \in K$. For $\varepsilon \gt 0$ we can ensure for $i$ large enough that $d(k,f_{n_i}) \leq d(k,k_{n_i})+d(k_{n_i},f_{n_i}) \leq d(K,F) + \varepsilon$. Since the intersection $F'$ of $F$ with the closed ball of radius $d(K,F)+\varepsilon$ around $k$ is compact and $f_{n_i} \in F'$ we can pass to a further subsequence such that $f_{n_i}$ converges to some $f \in F' \subset F$. Then $$d(K,F) \leq d(k,f) = \lim_{i \to \infty} d(k_{n_i},f_{n_i}) \leq \lim_{i \to \infty} \left(d(K,F) + \frac{1}{n_i} \right)= d(K,F)$$ proves that $d(k,f) = d(K,F)$ as desired. (this works for any of the metrics you're interested in)
Notice that we used compactness crucially twice. First for passing to a subsequence $k_{n_i}\to k$ and then we used compactness of closed balls to conclude that the intersection of some closed ball with the closed set $F$ is compact and thus we could pass to a further subsequence.
Without assuming that either one of $F$ or $K$ is compact, the statement you ask about becomes wrong. For instance the subsets $F = \mathbb{N}$ and $K = \{n+1/n: n\in\mathbb{N}, n \geq 2\}$ of $\mathbb{R}$ have $d(K,F) = 0$ but as $F \cap K = \emptyset$ there are no points $f \in F$ and $k \in K$ such that $d(k,f) = 0 = d(K,F)$.
The first one is the one I erroneously identified as a duplicate, the second one shows that the distance function $d(\cdot,A)$ from a non-empty set is continuous and the third one shows in particular that for answering your question the ingredient that closed and bounded sets are compact (a special feature of $\mathbb{R}^n$, also called the Heine-Borel property) is crucial, too.