Prove existence of disjoint open sets containing disjoint closed sets in a topology induced by a metric.

Question: Let $(X, d)$ be a metric space. Let $A$ and $B$ be disjoint subsets of $X$ that are closed in the topology induced by $d$. Prove that there exist disjoint open sets $U$ and $V$ such that $A\subset U$ and $B\subset V$.

Is this proof correct? : By assumption, $A\cap B=\emptyset$, so there is no pair like $(x_A,x_B)$ (i.e., $x_A\in A$ and $x_B\in B$), such that $x_A=x_B$. Because every metric space is Hausdorff, so for every pair $(x_A,x_B)$ there are two disjoint open sets $U_A\ni x_A$ and $V_B\ni x_B$; and thus union of all $U_A$s (which is an open set containing A) are disjoint from union of all $V_B$s (which is an open set containing A).

Thanks a lot for any help.

PS In special case of standard metric topology on $\mathbb{R}$, if $[a,b]$ and $[c,d]$ are disjoint (say $c>b$), intuitively it is apparent that there is a 'space' between $c$ and $b$ so we can have two disjoint open sets, each of them containing $[a,b]$ or $[c,d]$.


Solution 1:

In fact, you don't quite have to assume that $A$ and $B$ are disjoint closed sets, or even that they have disjoint closures; it's enough to assume that they are separated sets, i.e., each is disjoint from the closure of the other, a condition which is plainly necessary as well as sufficient.

Theorem. Let $A$ and $B$ be subsets of a metric space $(X,d)$. If $A\cap\overline B=\emptyset$ and $B\cap\overline A=\emptyset$, then there are disjoint open sets $U$ and $V$ such that $A\subseteq U$ and $B\subseteq V$.

Proof. If one of the sets is empty, it's easy; e.g., if $A=\emptyset$, we can take $U=\emptyset$ and $V=X$. So we may assume that $A$ and $B$ are nonempty sets. In that case the functions $$x\mapsto d(x,A)=\inf\{d(x,a):a\in A\}$$ and $$x\mapsto d(x,B)=\inf\{d(x,b):b\in B\}$$ are well-defined and continuous. It follows that the sets $$U=\{x:d(x,A)\lt d(x,B)\}$$ and $$V=\{x:d(x,B)\lt d(x,A)\}$$ are open sets, and of course they are disjoint. Finally, we have $A\subseteq U$ because $d(x,A)=0\lt d(x,B)$ for all $x\in A$, and $B\subseteq V$ because $d(x,B)=0\lt d(x,A)$ for all $x\in B$.