# Show a set in a metric space is dense, if and only if, the metric space is the union of open balls.

Show that if $(X, d)$ is a metric space, $S \subseteq X$ is dense if and only if, $\space \forall r > 0$, $X = \bigcup_{x\in S}B(x; r)$.

This problem has been confusing me, as I've tried to justify that, starting from the left, since $\bar S = X$ I could show $\bar S = \bigcup_{x\in S}B(x; r)$ and conclude that $X = \bigcup_{x\in S}B(x; r)$.

I don't know what to do since I'm mostly confused by how the closure of a set could be the union of all of the open balls in $X$, especially when the union of all of the open balls would be open.

I've included some definitions to show the framework I'm working in. Any input would be greatly appreciated!

Definitions:

Given a metric space $(X, d)$:

• A set $S \subseteq X$ is dense if $\bar S = X$.
• Given a set $S \subseteq X$, the closure of $S$ is $\bar S = \{\space x\in X \space | \space \forall r>0, B(x;r)\cap S\neq \emptyset \}$.
• The open ball is defined as $B(x;r)= \{a\in X \space | \space d(x,a)<r\}$.

• If I'm not mistaken that fact directly comes from the definition of metric space topology on $X$. – onurcanbektas Dec 4 '17 at 6:49

It suffices to show that show that $X\subset \bigcup_{s\in S}B(s; r)$ (the other inclusion is trivial).
Let $x\in X$ then, since $S$ is dense in $X$, i. e. $\bar S = X$, it follows that for any $r>0$, $B(x;r)\cap S\neq \emptyset$. Let $y$ be an element of the non-empty set $B(x;r)\cap S$ then $d(y,x)<r$ AND $y\in S$, which means that $$x\in B(y;r)\subset \bigcup_{s\in S}B(s; r).$$
Clearly, $$\bigcup B(r, x) \subset X.$$ We have to prove now that $$X\subset \bigcup B(r, x).$$ Suppose $x\in X$. In order to prove that x lies in the union, we have to prove that there exists $B(r, y)$ such that $x \in B(r, y)$.