# Separated sets on a metric space

Let $(X,\rho)$ be a metric space. Two sets $A,B\subseteq X$ are separated if $\overline{A}\cap B=\varnothing$ and $\overline{B}\cap A=\varnothing$. Show that $A$ and $B$ are separated if and only if there exist open sets $U$ and $V$ with $A\subseteq U, B\subseteq V$ such that $U\cap V=\varnothing$.

I think I have a solution but I have a couple of questions about it.

Assume $A$ and $B$ are separated. If $A$ and $B$ are open, then we can take $U=A$ and $V=B$ and we're done. If either of $A$ or $B$ are closed, then we get the stronger condition that $\overline{A}\cap\overline{B}=\varnothing$. Let $\text{diam}(A)=\alpha$ and $\text{diam}(B)=\beta$. Let $x\in A, y\in B$ be such that $\rho(x,y)$ is minimal over all $x\in A,y\in B$. Then $x\in\overline{A}, y\in\overline{B}\Rightarrow x\neq y \Rightarrow \rho(x,y)=\epsilon>0$. The let $U,V$ be open sets such that $$\text{diam}(U)=\alpha+\frac{\epsilon}{4} \qquad \text{diam}(V)=\beta+\frac{\epsilon}{4}$$ and $A\subseteq U, B\subseteq V$. Then $U\cap V=\varnothing$ and we're done.

Assume we have $U$ and $V$ as above. Because $\text{diam}(X)=\text{diam}(\overline{X})$ for any set $X$ in a metric space, $$\text{diam}(\overline{A})\leq \text{diam}(U) \qquad \text{diam}(\overline{B})\leq \text{diam}(V)$$ Let $x\in\overline{A}$ and consider $\min\{\rho(x,y)\;|\;x\in\overline{A}, y\in B\}=:\epsilon$. We want to show that $\epsilon>0$. First notice that $\min\{\rho(u,v)\;|\;u\in U, v\in V\}>0$. Since $B\subseteq V,\min\{\rho(u,y)\;|\;u\in U, y\in B\}>0$. But we also have that $u$ is at least as close to $B$ as $x\Rightarrow \epsilon>0$. Thus, $\overline{A}\cap B=\varnothing$. By the same argument, $\overline{B}\cap A=\varnothing$. Thus $A$ and $B$ are separated.

What happens if $A$ or $B$ is neither open nor closed though? I always confuse myself with these types of arguments because I'm assuming that a set is always either open or closed, but that's clearly not true. Is there a way to justify only considering these cases?

-

$\newcommand{\cl}{\operatorname{cl}}$No, in general there isn’t. In particular, you can’t do it here.
Suppose that $A$ and $B$ are separated sets in $X$. For each $a\in A$ there is an $\epsilon_a>0$ such that $\rho(a,b)\ge 2\epsilon_a$ for each $b\in B$, and for each $b\in B$ there is an $\epsilon_b>0$ such that $\rho(b,a)\ge 2\epsilon_b$ for each $a\in A$. Let $$U=\bigcup_{a\in A}B(a,\epsilon_a)\quad\text{and}\quad V=\bigcup_{b\in B}B(b,\epsilon_b)\;.$$
If $x\in U\cap B$, then there are $a\in A$ and $b\in B$ such that $\rho(a,x)<\epsilon_a$ and $\rho(x,b)<\epsilon_b$. But then $$\rho(a,b)<\epsilon_a+\epsilon_b\le2\max\{\epsilon_a,\epsilon_b\}\;;$$ do you see the contradiction?