Distance between two points in different sets

Solution 1:

So we consider the quantity

$$d'(A,B):= \max_{x \in B}\left(\min_{x' \in A} d(x,x')\right) \tag{1}$$

which is well defined as the function $d: X \to X$ is continuous to $\Bbb R$ and so assumes all maxima and minima on compact sets $A$ and $B$.

So assume $B \subseteq A$ first. Then for any fixed $b \in B$ we know that $b \in A$ too, so we can take $x=b, x'=b$ in the formula for $d'(A,B)$ and note that $\min_{x' \in A} d(b,x') = 0$ and the maximum we're taking of all these minima (over all posssible $b \in B$) is just a maximum of a set consisting only of $\{0\}$. It follows that $d'(A,B)=0$.

We can use a contrapositive for the other direction. If $B \nsubseteq A$ there is some fixed $b \in B$ such that $b \notin A$. Well, for that fixed $b$ we already know that $\min_{x' \in A} d(x', b) = d(b,A) >0$ (because e.g. $d(b,A)=0$ iff $b \in \overline{A}$ in any metric space, and $A$ is closed and $b \notin A$) and so the maximum of all these, $d'(A,B) \ge d(b,A) >0$ as well.

This shows the equivalence in what I think is the simplest way.