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

Solution 1:

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$.

Solution 2:

EDIT: New and (hopefully)Improved!: As stated above, and as pointed out by Theo, a having both $A,B$ be closed but neither of them compact is not enough, a counterexample being that of S={(x,0)} and $S'=\{(x,1/x)\}$ in $\mathbb{R}^n$, as well as other counters given in the above comments. And the above assumption of $A,B$ both closed doesn't either allows us to conclude from $d(A,B)=0$, that there is an $a$ in $A$ with $d(a,B)=0$; for this last, we need to use the full hypothesis, i.e., we need $A$ to be compact. After showing that $A,B$ as given and $d(A,B)=0$ implies the existence of $a$ with $d(a,B)=0$, we use the fact that points at distance $0$ from a subset $S$ of a metric space are precisely the points in the closure of $S$, to lead to the contradiction that $A,B$ are not disjoint if we assume $d(A,B)=0$.

So we prove that $d(A,B)\neq0$ for $A$ compact, $B$ closed and $A,B$ disjoint. Without compactness, the best we can conclude from $d(A,B)=0$, is that there are sequences $\{a_n\}$ in A and $\{b_n\}$ in B, with $d(a_n,b_n) \lt 1/n$. But now we use compactness+ metric, to use that there is a convergent subsequence $\{a_{n_k}\}$ of $a_n$; say the limit is a. Then, given any positive integer n, we can select an index j in $\{a_{n_k}\}$ with $d(a_{n_k},b_{n_m})\lt 1/2n $ for $m\gt j$, and, by convergence of ${a_{n_k}}$ to a, it follows that $d(b_{n_k},a)$, and so (triangle ineq) a is in B, (since B is assumed closed, and a closed subset of a metric space contains all points at distance 0 from B; specifically, in a metric space, the closure of a subset contains all points at distance 0 from that subset), contradicting the assumption that A,B are disjoint.

Note that the choice of $S:=\{(x,0)\}$ and $S':=\{(x,1/x) : x \in \mathbb{R}\}$ is not a counterexample, since the sequence $\{1/x\}$ does not have a convergent subsequence. Then S is not compact.