# Distance between two compact sets

Let's say we have E and F, two compact sets in a metric space (X,d). We remember that the distance between two sets is :

dist(E,F) = inf { d(x,y) | x belongs to E , y belongs to F }

Show that dist (E,F) > 0 if and only if the intersection between E and F is an empty set.

**I feel like I am able to prove this without using the fact that these are compact sets... Am I missing something ?

• If $X$ are the real numbers with the usual distance, and $E=(-\infty, 0), F= [0,\infty)$ they are disjoint but their distance is still 0. – Ingix Oct 15 '18 at 18:16
• I see... how can compactness help us prove this – mimi Oct 15 '18 at 19:15
• Are you familiar with the extreme value theorem: en.wikipedia.org/wiki/Extreme_value_theorem ? – Ingix Oct 15 '18 at 21:15

Show that $$\operatorname{dist} (E,F) > 0$$ if and only if the intersection between $$E$$ and $$F$$ is an empty set.
If $$\operatorname{dist} (E,F) > 0$$ then $$E$$ and $$F$$ have no common points. Conversely, assume that $$E$$ and $$F$$ have no common points. Then $$\operatorname{dist}|E\times F\to\Bbb R$$, $$(x,y)\mapsto \operatorname{dist}(x,y)$$ is a continuous map of a compact set $$E\times F$$. So its image is a compact $$K$$ not containing the zero. Since $$K$$ is closed, the distance (in $$\Bbb R$$) between $$K$$ and the zero is bigger than $$0$$. And this distance is $$\operatorname{dist} (E,F)$$.