# Formally writing a proof about distance to a set and point in closure

The function $d_{A}\left(x\right)=\inf_{a\in A}d\left(x,a\right)$ is defined from X a metric space to $\mathbb R$. I want to show that $x \in \bar A \iff d_A(x) = 0$.

It seems so obvious to me that I can't really figure out how to write it. i.e:

one way we have that $x\in \bar A$ and so there is a sequence converging to x in A causing the infimum to be 0. The other way we have that $d_A(x) = 0$ and so either x=a or there exists a sequence in A converging to x which means that $x\in \bar A$.

Is this formal enough or could you help me to reformulate it into a possibly better written proof?

• I think you mean $d_{A}\left(x\right)=\inf_{a\in A}d\left(x,a\right)$ Commented May 20, 2014 at 12:20
• Ah right, yes that's what I meant :)
– Tito
Commented May 20, 2014 at 12:21
• BTW, I think your proof is okay. Personally I would avoid sequences if that is possible (and it is). Commented May 20, 2014 at 12:36

Let $A$ be a nonempty subset of $X$ and let $(X,d)$ be a metric space.
If $x\in\overline{A}$ and $\varepsilon>0$ then $d\left(x,y\right)<\varepsilon$ for some $y\in A$ and consequently $d_{A}\left(x\right)\leq d\left(x,y\right)<\varepsilon$. Since this is true for any $\varepsilon>0$ we are allowed to conclude that $d_{A}\left(x\right)=0$.
If conversely $d_{A}\left(x\right)=0$ then for every $\varepsilon>0$ it must be possible to find some $y\in A$ with $d\left(x,y\right)<\varepsilon$. This means exactly that $x\in\overline{A}$.
Let $x\in \bar A - A$, then for every $\epsilon > 0$ there's $a\in A$ s.t. $a\ne x$ and $d(x,a)<\epsilon$.
Therfore, for every $\epsilon > 0$ we have $d_A(x)<\epsilon$ which implies $d_A(x)=0$.