# A and B disjoint, A compact, and B closed implies there is positive distance between both sets

Claim: Let $$XX$$ be a metric space. If $$A,B⊂XA,B\subset X$$ are disjoint, $$AA$$ is compact, and $$BB$$ is closed, then there is $$δ>0\delta>0$$ so that $$|α−β|≥δ∀α∈A,β∈B |\alpha-\beta|\geq\delta\;\;\;\forall\alpha\in A,\beta\in B$$.

Proof. Assume the contrary. Let $$αn∈A,βn∈B\alpha_n\in A,\beta_n\in B$$ be chosen such that $$|αn−βn|→0|\alpha_n-\beta_n|\rightarrow0$$ as $$n→∞n\rightarrow \infty$$.

Since $$AA$$ is compact, there exists a convergent subsequence of $$αn(n∈N)\alpha_n\;(n\in\mathbb{N})$$, $$αnm(m∈N)\alpha_{n_m}\;(m\in\mathbb{N})$$, which converges to $$α∈A\alpha\in A$$.

We have

$$|α−βnm|≤|α−αnm|+|αnm−βnm|→0asm→∞.|\alpha-\beta_{n_m}|\leq|\alpha-\alpha_{n_m}|+|\alpha_{n_m}-\beta_{n_m}|\rightarrow0 \;\;\;as\;\;m\rightarrow\infty.$$
Hence $$α\alpha$$ is a limit point of $$BB$$ and since $$BB$$ is closed $$α∈B\alpha\in B$$, contradiction.

Is my proof correct? I feel as though I am missing something simple which would trivialize the proof.

For the sake of having an answer addressing your question:

Yes, your proof is perfectly okay and I don’t think you can get it any cheaper than you did it.

Let me expand a little on what you can do with these arguments (also providing details to gary’s answer). I’m not saying my proof at the end is better than yours in any way, I’m just showing a slightly alternative way of looking at it.

Define the distance between two non-empty subsets $A,B \subset X$ to be $d(A,B) = \inf_{a \in A, b \in B} d(a,b)$ and write $d(x,B)$ if $A = \{x\}$.

1. If $B \subset X$ is arbitrary and non-empty then $x \mapsto d(x,B)$ is $1$-Lipschitz continuous, that is $|d(x,B) - d(y,B)|\leq d(x,y)$ for all $x,y \in X$.
2. We have $d(x,B) = 0$ if and only if $x \in \overline{B}$.
3. If $d(\cdot,A) = d(\cdot,B)$ then $\overline{A} = \overline{B}$.
1. Choose $b\in B$ such that $d(x,b) \leq d(x,B) + \varepsilon$. Then the triangle inequality yields $d(y,B) - d(x,B) \leq d(y,b) - d(x,b) + \varepsilon \leq d(y,x) + \varepsilon$. By symmetry we get $|d(x,B) - d(y,B)| \leq d(x,y) + \varepsilon$, and 1. follows because $\varepsilon$ was arbitrary. Update: In this closely related answer I show that $1$ is in fact the best Lipschitz constant as soon as $B$ isn’t dense. Don’t miss Didier’s answer to the same thread which relies on a useful general fact which is as easy to prove and Zarrax’s answer providing a cleaned-up argument of the one I’m giving here.

2. Choose $b_n \in B$ with $d(x,b_n) \leq d(x,B) + \frac{1}{n} = \frac{1}{n}$. Then $d(x,b_n) \to 0$ and hence $x \in \overline{B}$. Conversely, if $b_n \to x$ then $d(x,b_n) \to 0$ hence $d(x,B) = 0$.

3. Immediate from 2.

Let me combine these facts: assume $A$ is compact and $B$ is closed. As $d(\cdot, B): X \to [0,\infty)$ is continuous by 1. above, we conclude from compactness of $A$ that $d(\cdot,B)$ assumes its minimum when restricted to $A$ (if you think about how one usually proves this, you’ll find your argument again!). Hence there is $a \in A$ with the property that $d(a',B) \geq d(a,B)$ for all $a' \in A$. But if $d(a,B) = 0$ then $a \in B$ by 2. above, since $B = \overline{B}$. So either $A$ and $B$ are not disjoint or $d(a',B) \geq d(a,B) \gt 0$. By choosing $\delta \in (0,d(a,B))$, we get the claim again.

Finally, if you don’t assume that one among $A$ and $B$ is compact, then the result is false. There was the example $A = \mathbb{N}$ and $B = \{n + \frac{1}{n}\}_{n\in\mathbb{N}}$ given in the comments, or, a bit more geometrically appealing to me, let $A$ be the $x$-axis in $\mathbb{R}^2$ and $B$ the graph of the function $x \mapsto \frac{1}{x}$, $x \neq 0$.