# distance between sets in a metric space

I was given this innocent looking homework question.

Given two nonempty sets $$A,B \subseteq X$$ where $$(X,d)$$ is a metric space.

1. Show that $$\mathrm{dist}(A,B) = \inf \{d(x,y) \mid x \in A, y \in B \}$$ is well-defined.
2. Suppose $$A \cap B = \emptyset$$. Suppose $$A$$ is closed and $$B$$ is compact. Show that $$\mathrm{dist}(A, B) > 0$$.

Aren't both (1) and (2) properties of the fact that $$S = \{ d(x,y) \mid x \in A, y \in B \}$$ is a subset of $$P = \{ x \mid x \ge 0 \}$$, which is bounded?

for (1): $$S \subseteq P$$ and $$P$$ bounded implies $$S$$ is bounded. Hence $$\mathrm{inf} S$$ exists. Since $$\mathrm{inf} S$$ is unique, we conclude that $$\mathrm{dist}(A, B)$$ is well defined.

for (2): Since $$\mathrm{inf} P \ge 0$$ and $$S \subseteq P$$, $$\mathrm{dist}(A, B) \ge 0$$. Since $$A \cap B = \emptyset$$, $$x \ne y$$ $$\forall x \in A, y \in B$$. Then $$d(x,y) \ne 0$$. Hence $$\mathrm{dist}(A,B) > 0$$.

Am I missing something very very obvious? Where does compactness come into play?

• I suspect in (1), you want $\mathrm{dist}(A,B)$ on the LHS. – Eric Towers Jan 27 '14 at 6:40
• yup. thanks for pointing that out. fixed. – kel c. Jan 27 '14 at 6:41
• The proof for (2) isn't correct. Individual dist. are > 0, but the inf may still be 0. This is why you need compactness of B. – voldemort Jan 27 '14 at 6:43
• (2) You can have two sequences of points with distances between 0 and $1/n$. Use the compactness (and the Force). – Martín-Blas Pérez Pinilla Jan 27 '14 at 6:43
• In what sense should dist be well-defined, instead of simply defined? The right hand side does not depend on any choice. – Hagen von Eitzen Jan 27 '14 at 7:15

For 1, $S$ might be unbounded, contrary to your statement. But you have exactly the right idea: it is bounded below by 0, and that is all you need.
$\def\dist{\operatorname{dist}}$But for 2 your idea is no good. Let $A = (-1,0)$ and $B = (0, 1)$. Then $A\cap B = \phi$, and yet $\dist(A, B) = 0$. There are no two points $a\in A, b\in B$ with distance zero, as you said, but there are points $a,b$ at arbitrarily small distance, and that is all we need for the infimum of $S$ to be zero. So if we want to prove that $\dist(A,B)>0$, it is not enough to know that $A$ and $B$ are disjoint; we need some additional information about $A$ and $B$. That is where the compactness comes in.
In fact it's not even enough for the two sets to be closed; the usual example is that the hyperbola $H = \{ \langle x,y\rangle \mid xy = 1 \}$ is closed and the $x$-axis $L = \{ \langle x,y\rangle \mid y = 0 \}$ is closed, but $\dist(H, L) = 0$ because for any positive $s$ we can choose $0<t<s$ and then $h = \left\langle \frac1t, t\right\rangle, \ell = \left\langle \frac1t, 0\right\rangle$ are closer than $s$.
• The important point for 1 is that $S\ne\emptyset$ – Hagen von Eitzen Jan 27 '14 at 7:17
You should show that $d_S(x):=\operatorname{inf}_{s\in S}d(s,x)$ is a continous function (for all subsets $S$). If you have that, then $$d(A,B)=\operatorname{inf}_{x\in B}d_A(x)=\operatorname{inf}_{x\in A}d_B(x)$$ Now if $B$ is compact $d_A$ has a Minimum $m$ on $B$, say at the point $b\in B$. By definition, we find a sequence $a_n \in A$ such that $d(a_n,b)\rightarrow m$. If $m=0$, this would imply that $a_n \rightarrow b$. But $A$ is closed, so $b\in A$ is impossible $\Rightarrow m>0$