# Distance between closed and compact sets.

This question is (1-21)(b) from M. Spivak's Calculus on Manifolds.

Question: If $A$ is closed, $B$ is compact, and $A \cap B = \emptyset$, prove that there is $d > 0$ such that $||y - x|| \geq d$ for all $y \in A$ and $x \in B$.

Now, I interpret this as an instruction to find a single $d$ that works for all $y \in A$ and $x \in B$. However, I can't see why the following is not a counter-example:

Consider the set $$A_0 = (-\infty, 0) \cup \left[\bigcup_{n=1}^{\infty} \left(\frac{1}{n + 1}, \frac{1}{n}\right)\right] \cup (1, \infty)$$ where $(a,b)$ denotes the open interval as usual. Since $A_0$ is a union of open sets, it too is open. Thus $$A = \mathbb{R} - A_0 = \left\{ \frac{1}{n} \quad \colon \quad n \in \mathbb{N}\right\}$$ is closed. The set $$B = [-1, 0]$$ is certainly compact. Moreover, $A \cap B = \emptyset$. However, for all $d > 0$, there exists a $y \in A$ such that $$||0 - y|| = ||y|| < d$$

I must be overlooking something somewhere. Any help spotting where will be appreciated.

-
The complement is not $\{1/n\mid n\in\mathbb N\}$. You should also change the end points of the intervals as they are not in the correct order. –  Stefan Hamcke Apr 21 '13 at 22:32
$0\in A_0$? or maybe it is in $A$...? Also correct the definition of $A_0$, since $\frac{1}{n}>\frac{1}{n+1}$ –  Dimitrios Ntalampekos Apr 21 '13 at 22:36
@StefanH. I believe I have corrected the mistakes you mention. –  providence Apr 21 '13 at 22:36
Check an answer to the question here : math.stackexchange.com/questions/109167/… –  Dimitrios Ntalampekos Apr 21 '13 at 22:38
But now $0\in A$. –  Stefan Hamcke Apr 21 '13 at 22:38
show 1 more comment

Here we prove the result of the book:

Recall that the function $x\mapsto d(x,A)$ is continuous and that (since $A$ is closed): $$x\in A\iff d(x,A)=0$$

$$d=\inf_{x\in B}d(x,A)$$

The function

$$f:B\to \mathbb{R}\quad,\quad x\mapsto d(x,A)$$ is continuous on the compact $B$ then it's bounded and there's $x_0\in B$ s.t $$f(x_0)=\min_{x\in B}f(x)=d=d(x_0,A)>0$$ since $x_0\not\in A$

-
The counter-example fails as the set $A$ contains $0$ so $A \cap B \ne \emptyset$. I had overlooked this fact for some reason.