# The distance between two sets inside euclidean space

Let $$A,B \subseteq \mathbb{R}^d$$ be non-empty sets. Define their distance to be

$$d(A,B) = \inf \{ \|x-y\| : x \in A, \; \; y \in B \}$$

For any $$A,B$$, I want to prove that $$d(A,B) = d( \overline{A}, \overline{B} )$$.

## My Attempt

Put $$\alpha = d(A,B)$$. Therefore, $$\alpha = \|x_0 - y_0 \|$$ for some $$x_0 \in A$$ and some $$y_0 \in B$$. But, notice $$x_0 \in \overline{A}$$ and $$y_0 \in \overline{B}$$ by definition. hence

$$\| x_0 - y_0\| \geq \inf\{ \|x' - y'\| : x' \in \overline{A}, \; \; y' \in \overline{B} \} = d( \overline{A}, \overline{B} )$$

$$\therefore d(A,B) \geq d( \overline{A}, \overline{B} )$$

I am stuck trying to show the other direction: $$d(A,B) \leq d( \overline{A}, \overline{B} )$$

Can someone help me? thanks a lot

• You must not assume $\alpha$ is attained. This you can only do if the closure of at least one of the sets is compact. Feb 15, 2014 at 10:51
• 'Looking for an answer drawing from credible and/or official sources.' is like asking 'I must have a proof from a textbook that $\sin x e^x x^7$ is differentiable at the point $\pi$', when you could have done it by hand yourself? Feb 17, 2014 at 13:09
• why did you ask the question again after you asked it math.stackexchange.com/questions/673213/… and accepted an answer which you clearly did not understand? Feb 18, 2014 at 20:02

Note that the function $\Phi:\mathbb R^d\times \mathbb R^d\to\mathbb R^+$ defined by $\Phi(x,y)=\Vert x-y\Vert$ is continuous, and that $\overline A\times \overline B=\overline{A\times B}$. So, in order to prove what you want, it is enough to show that if $\Phi:X\to\mathbb R^+$ is a continuous function on a topological space $X$, then $\inf\, \Phi(M)=\inf\, \Phi (\overline M)$ for any (nonempty) set $M\subset X$. Now, you have $\Phi(M)\subset \Phi(\overline M)\subset \overline{\Phi(M)}$, the second inclusion being true because $\Phi$ is continuous. So $\inf\, \overline{\Phi(M)}\leq \inf\, \Phi(\overline M)\leq \inf\, \Phi(M)$. To conclude, it remains to observe that for any (nonempty) set $E\subset\mathbb R^+$ you have $\inf\, E\in \overline E$, so that $\inf \, E=\inf\overline E$. Aplying this with $E=\Phi(M)$, this gives $\inf\, \Phi(\overline M)=\inf \,\Phi(M)$ as required.

• seriously? is this necessary? 10 bucks says the OP has no clue what you are on about. Feb 17, 2014 at 22:48

Let's try a more detailed description, but similar to Hagen's answer (as it is the most straightforward approach). $$\mathrm{d}(\overline{A},\overline{B})=\inf\{\mathrm{d}(a,b):a\in\overline{A},b\in\overline{B}\}\tag{1}$$ and $$\mathrm{d}(A,B)=\inf\{\mathrm{d}(a,b):a\in A,b\in B\}\tag{2}$$ Since $A\subset\overline{A}$ and $B\subset\overline{B}$, $\mathrm{d}(\overline{A},\overline{B})$ is the infimum over a larger set than $\mathrm{d}(A,B)$. Therefore, $$\mathrm{d}(\overline{A},\overline{B})\le\mathrm{d}(A,B)\tag{3}$$ Now, suppose that for $\epsilon\gt0$, $$\mathrm{d}(A,B)=\mathrm{d}(\overline{A},\overline{B})+\epsilon\tag{4}$$ that is, the inequality in $(3)$ is strict.

Definition $(1)$ says that we can find an $\overline{a}\in\overline{A}$ and a $\overline{b}\in\overline{B}$ so that $$\mathrm{d}(\overline{a},\overline{b})\lt\mathrm{d}(\overline{A},\overline{B})+\frac\epsilon3\tag{5}$$ By the definition of closure, we can find $a\in A$ so that $$\mathrm{d}(a,\overline{a})\lt\frac\epsilon3\tag{6}$$ and $b\in B$ so that $$\mathrm{d}(b,\overline{b})\lt\frac\epsilon3\tag{7}$$ By $(5)$, $(6)$, $(7)$, and the triangle inequality, we get \begin{align} \mathrm{d}(a,b) &\le\mathrm{d}(a,\overline{a})+\mathrm{d}(\overline{a},\overline{b})+\mathrm{d}(b,\overline{b})\\[3pt] &\lt\frac\epsilon3+\mathrm{d}(\overline{A},\overline{B})+\frac\epsilon3+\frac\epsilon3\\ &=\mathrm{d}(\overline{A},\overline{B})+\epsilon\tag{8} \end{align} But by $(2)$ \begin{align} \mathrm{d}(A,B) &\le\mathrm{d}(a,b)\\ &\lt\mathrm{d}(\overline{A},\overline{B})+\epsilon \end{align}\tag{9} which contradicts $(4)$. Therefore, $$\mathrm{d}(\overline{A},\overline{B})=\mathrm{d}(A,B)\tag{10}$$

– user124140
Feb 19, 2014 at 11:56

Apparently we need to show the following two inequalities:

1. $d(A,B)\le d(\bar A,\bar B)$ and

2. $d(A,B)\ge d(\bar A,\bar B)$.

The second inequality is straightforward: Clearly $$\big\{d(x,y): (x,y)\in A\times B\big\}\subset \big\{d(x,y): (x,y)\in \bar A\times \bar B\big\},$$ and hence $$d(A,B)=\inf\big\{d(x,y): (x,y)\in A\times B\big\}\ge \inf\big\{d(x,y): (x,y)\in \bar A\times \bar B\big\}=d(\bar A,\bar B).$$

For the first inequality, assume that $\varrho=d(\bar A,\bar B)$. Then there exist sequences $\{x_n\}\subset \bar A$ and $\{y_n\}\subset \bar B$, such that $d(x_n,y_n)=\varrho.$ But as $x_n\in\bar A$ and $y_n\in\bar B$, there exist $x_n'\in A$ and $y_n'\in B$, such that $$d(x_n,x_n')<\frac{1}{2n} \quad\text{and}\quad d(y_n,y_n')<\frac{1}{2n},$$ since arbitrarily near to a point of $\bar E$ it is possible to find a point of $E$. Now $$d(A,B)\le d(x_n',y_n')\le d(x_n',x_n)+d(x_n,y_n)+d(y_n,y_n')<d(x_n,y_n)+\frac{1}{n},$$ and letting $n\to\infty$, the right-hand side of the above tends to $\varrho$ and hence $$d(A,B)\le \varrho=d(\bar A,\bar B).$$ This completes the proof of inequality 1.

• thank you very much!! I have to wait some time to award you the $100$ points. One question: what definition of closure are you using?
– user124140
Feb 17, 2014 at 19:45
• I am using the following one: $x\in\bar A$ if and only if, for every $\varepsilon>0$, there exists a $y\in A$, such that $d(x,y)<\varepsilon$. -- This definition implies that if $\{x_n\}\subset \bar A$, then there exists a sequence $\{x_n'\}\subset A$, such that $d(x_n,x_n')<1/n$. Feb 17, 2014 at 19:48

The direction $d(A,B)\ge d(\bar A,\bar B)$ has nothing to do specifically with cloures. It follows simply from $A\subseteq \bar A$, $B\subseteq \bar B$ and that we take the infimium over a larger set of values.

Assume $\epsilon:=d(A,B)-d(\bar A,\bar B)>0$. Find points $a'\in \bar A$, $b'\in\bar B$ width $d(a',b')<d(\bar A,\bar B)+\frac\epsilon 3$ and $a\in A$, $b\in B$ with $d(a,a')<\frac\epsilon3$, $d(b,b')<\frac\epsilon3$.

• I dont understand the second paragraph. Would you mind explaining a little bit less dry ? thanks a lot.
– user124140
Feb 15, 2014 at 11:55
• What's dry about it? Feb 15, 2014 at 13:17
• the way you wrote it. I cannot understand it. :(
– user124140
Feb 15, 2014 at 17:43

Note, why do you always have $d(A,B)\geq d(\bar{A},\bar{B})$?

if $d(\bar{A},\bar{B}) = d$ then $\exists x_1,x_2,...\in \bar{A}$ and $y_1,y_2,...\in \bar{B}$, for $\epsilon>0$, $\exists N$ such that $d(x_n,y_n)\leq d+\epsilon$ for $n>N$

now find a sequence $x_1',x_2',...\in A$ and $y_1',y_2',...\in B$ which also does the job, i.e. for $\epsilon>0$, $\exists N$ such that $d(x_n',y_n')\leq d+\epsilon$ for $n>N$ (how? use definition of closure)

• can you explain a little bit more? thanks a lot
– user124140
Feb 17, 2014 at 1:38
• @Learner which bit needs clarification? I have actually given you a proof, except 2 gaps you need to fill yourself? Normally I'd vote to close your question because you made no attempt yourself. Feb 17, 2014 at 13:07