Find two closed subsets or real numbers such that $d(A,B)=0$ but $A\cap B=\varnothing$

Take the following two sets:

$$A = \mathbb{N}$$ $$B = \{n + 2^{-n}:n\in\mathbb{N}\}$$

Then both are obviously closed subsets of the reals, and for any $\varepsilon>0$ you have some $n\in\mathbb{N}$ such that $\frac{1}{n}<\varepsilon$, and thus $d(A,B) = 0$.

Also notice that if you took one of the two sets to be bounded (say $A$), then it would be compact. In that case if $d(A,B) = 0$ you would have two sequences of points $S_A=\{a_n\}\subseteq A$ and $S_B=\{b_n\}\subseteq B$ such that $d(a_n,b_n)\rightarrow 0$. Then $S_B$ must be bounded by some $M$. $C = B\cap [-M,M]\supseteq S_B$ is compact. By compactness we get two convergent subsequences of $S_A$ and $S_B$. Their limits are contained in $A$ and $B$ respectively (since the sets are closed) and must be the same point since $d(a_n,b_n)\rightarrow 0$. This is a contradiction, and thus neither one of the sets can be bounded.


Hint: You cannot do this for bounded closed sets. Think about $\Bbb N$ and a set $\{a_n\mid n\in\Bbb N\}$ such that $\lim\frac n{a_n}=1$.