TITLE: 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$
QUESTION [6 upvotes]: 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.

REPLY [8 votes]: 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.

REPLY [4 votes]: Hint: think $(0,1)$ and $(1,2)$.

REPLY [3 votes]: 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.