In a metric $(X,d)$, prove that for each subset $A$, $x\in\bar{A}$ if and only if $d(x,A)=0.$
In a metric space $(X,d)$, prove that for each subset $A$, $x\in\bar A$ if and only if $d(x,A)=0$
I feel like this isn't necessarily true. For example, let $X$ equal the reals and $A$ be some open subset of $X$, let's say $(0,1)$. Then $0.5$ is an element of $\bar{A}$, but $d(x,A) = d(0.5,0) \neq 0$
This question seems simple enough; I don't know why it's giving me such trouble.
Solution 1:
Let $x \in \bar{A}$. Then for any $\epsilon > 0$ there exists an open ball $B_\epsilon(x)$ centered around $x$ and of radius $\epsilon$ such that $B_\epsilon(x) \cap A \neq \emptyset$. Let $y_\epsilon \in B_\epsilon(x) \cap A$. Then $d(x,A) \leq d(x,y_\epsilon) < \epsilon$, and since $\epsilon > 0$ was arbitrary, it follows that $d(x,A) = 0$.
Conversely, if $d(x,A) = 0$ then for any $\epsilon > 0$ there exists $y_\epsilon \in A$ such that $d(x,y_\epsilon) < \epsilon$, and so $B_{\epsilon}(x) \cap A \neq \emptyset$. But any open ball centered at $x$ will contain $B_\epsilon(x)$ for some $\epsilon > 0$ and hence have nonempty intersection with $A$.
Solution 2:
Your counterexample is wrong. $0.5$ is certainly in the closure of $(0,1)$, and $d(0.5,(0,1))=0$, so everything is ok. I think you didn't notice you need to compute $d(x,A)$, the distance from $x$ to the set $A$.
To prove the general assertion, be explicit about what each of the conditions means. With that done, the proof will fall from the sky.