Show $A\cap B \neq \varnothing \Rightarrow \operatorname{dist}(A,B) = 0$, and $\operatorname{dist}(A, B) = 0 \not\Rightarrow A\cap B \neq \varnothing$

I have a question

Let $d$ be a metric on $X$, and define the set to set distance

$$\operatorname{dist}(A,B) = \inf\{d(x,y): x\in A, y \in B\}$$

where $A,B \subseteq X$ are nonempty sets

Show that $A\cap B \neq \varnothing \Rightarrow \operatorname{dist}(A,B) = 0$, and $\operatorname{dist}(A, B) = 0 \not\Rightarrow A\cap B \neq \varnothing$

First: ($A\cap B \neq \varnothing \Rightarrow \operatorname{dist}(A,B) = 0$)

Trivial, since $A \cap B \neq \varnothing \implies \exists z \in A$ and $B$, so $\operatorname{dist}(A,B) = \inf\{d(z,z)\} = 0$

Second: ($\operatorname{dist}(A, B) = 0 \not\Rightarrow A\cap B \neq \varnothing$)

We want to produce $A \cap B = \varnothing$ such that $\operatorname{dist}(A,B) = 0$. Is there a metric space where this can happen?

I've checked the discrete metric, all the $\ell_p$ metrics. I don't think you can have disjoint sets with their distance zero.

Let $X=\mathbb{R}$, with the Euclidean metric. Let $A=(-1,0)$ and $B=(0,1)$. Then this is the desired contradiction.

For the second statement to be $\implies$, you need that $A$ and $B$ be compact.

• I see, so the $\inf$ drives their distance to zero. – Shamisen Expert Jul 17 '16 at 23:59
• Yes. For some sort of intuition, at least for the case $X=\mathbb{R}$, note that $d:\mathbb{R}^2\to\mathbb{R}_{\geq 0}$ is a continuous function, and therefore $\mathrm{dist}(A,B)=\inf \mathrm{im}(A\times B)$, the image of the compact set $A\times B$, which is compact in $R$, and therefore closed. The argument here can be made more precise if you're familiar with the product metric (which is on wikipedia). – Monstrous Moonshine Jul 18 '16 at 0:04
• In fact, you need only $A$ compact and $B$ closed for example. There are counter-example if both $A$ and $B$ are closed. – user171326 Jul 18 '16 at 0:08

Hint: think $(0,1)$ and $(1,2)$.

Look for sets $A$ and $B$ so that $A \cap B = \emptyset$ but $\overline{A} \cap \overline{B} \ne \emptyset$, where $\overline{E}$ is the closure of a set $E$ in the $d$-metric. This will work if the sets are compact.

Some intuition about why this is what you'd look for: Because you're looking at sequences within the sets $A$ and $B$ approximating the distance between $A$ and $B$, it's natural to think of the closures of $A$ and $B$ instead. So you're looking for two sets whose closures intersect but who don't intersect, which is why you'd look for something missing part of its boundary.

For further Googling: This is the Hausdorff metric.

• It's not enough to look at the closures. Think of $A=\bigcap_{n\in\mathbb{N}} [2n,2n+1-\frac{1}{n}]$, $B=\bigcap_{n\in\mathbb{N}} [2n+1,2n+\frac{1}{2}]$. What's really needed is compactness. – Monstrous Moonshine Jul 17 '16 at 23:54
• @MonstrousMoonshine True, so I've edited the first sentence. Thanks. – user296602 Jul 17 '16 at 23:56