# 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. 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). 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. Jul 17 '16 at 23:54
• @MonstrousMoonshine True, so I've edited the first sentence. Thanks.
– user296602
Jul 17 '16 at 23:56
{"ft_lang_label":"__label__en","ft_lang_prob":0.5616109,"math_prob":0.99988174,"size":889,"snap":"2021-31-2021-39","text_gpt3_token_len":308,"char_repetition_ratio":0.17740113,"word_repetition_ratio":0.07575758,"special_character_ratio":0.32508436,"punctuation_ratio":0.12568305,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99999213,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-27T14:08:03Z\",\"WARC-Record-ID\":\"<urn:uuid:ddeac7ca-05e5-4aa8-8ea0-c29b09277c9d>\",\"Content-Length\":\"187442\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:0958c8fe-803e-492a-88df-4f92c6451337>\",\"WARC-Concurrent-To\":\"<urn:uuid:24cd62b0-cefe-47a8-98fc-231e0cbdcdd4>\",\"WARC-IP-Address\":\"151.101.65.69\",\"WARC-Target-URI\":\"https://math.stackexchange.com/questions/1862654/show-a-cap-b-neq-varnothing-rightarrow-operatornamedista-b-0-and\",\"WARC-Payload-Digest\":\"sha1:FRW6KODUL6HRDXHLPNNVTDBV3LPSEMAG\",\"WARC-Block-Digest\":\"sha1:IHPZOTD3USOXNULYS43FCTIDL6S2UMIU\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780058450.44_warc_CC-MAIN-20210927120736-20210927150736-00150.warc.gz\"}"}