Let $(X,d)$ be a metric space and non-empty $A\subset X$. The distance from $x$ to $A$ is defined as $$\mbox{dist}(x,A)=\inf\{d(x,a):a\in A\}$$
I want to show that dist$(x,A)=0$ if and only if $x$ is in the closure of $A$.
(=>): dist$(x,A)=0$ implies $\inf \{d(x,a):a\in A\}=0$. Suppose $x\not\in \overline{A}$, then $x\in X\setminus \overline{A}$, which is an open set. Thus $\exists\epsilon >0$ such that punctured open ball $B(x;\epsilon)\setminus\{x\}= \{y\in X:0<d(x,y)<\epsilon\} \subset X\setminus\overline{A}$. But then dist$(x,A)=\inf\{d(x,a):a\in A\}\ge \inf\{d(x,y):y\in B(x,\epsilon)\setminus\{x\}\}>0$. This is a contradiction! Hence, $x\in \overline{A}$.
(<=): Suppose $x\in \overline{A}$. If $x\in A^\circ$ (the interior of $A$) then $\inf\{d(x,a):a\in A\}=d(x,x)=0$. If $x\not\in A^\circ$ then $\exists $ a sequence $(a_k)_k\subset A$ such that $a_k$ converges to $x$. Then, $\forall \epsilon > 0, \exists N\in\mathbb{N}$ such that $k\ge N\implies d(a_k,x)<\epsilon$.
So that dist$(x,A)=\inf\{d(x,a_k)\}=\lim\limits_{k\to\infty} d(x,a_n) = 0$.
Please let me know if my proof is rigorous / correct. I'm not completely sure, think it's better to check.