On showing that every separable metric space has a countable base

Theorem: Every separable metric space $(M, d)$ has a countable base


I've glanced over a couple of proofs for this theorem (for example see the one provided here), but I'm still stuck at the following: Why the neighborhood of an arbitrary element of the metric space $M$ (which might not belong to the dense subset) necessarily contains an element of the countably dense subset? Specifically, let $X$ be a countable dense subset of $M$, $z \in M$ and $G \subset M$ be open such that $z \in G$. Then why necessarily at a distance $h$ for which the open ball $B(z, h) \subset G$ does there exist an element $x_k \in X$ such that $d(z, x_k) < h$?

Element inclusion the other way around makes perfect sense to me: If we take the countably dense subset $X$ of $M$ and consider the collection $C = \{B(x, r)\mid x \in X, r \in \mathbb{Q}_{+}\}$ then of course any $z \in M$ is contained in any neighborhood of the elements of $X$ for some radius $r \in \mathbb{Q}_{+}$ (since we can take arbitrarily large/small radius $r$).

Bonus question: I know it is not a pretty proof, but to prove the theorem, could we do the following: i.) order the elements of the countably dense subset $X$ in to the sequence $x_1, x_2,\dots = \left(x_n\right)_{n \in \mathbb{N}}$, ii.) form the collection of neighborhoods $\{B(x_n, n)\mid n \in \mathbb{N}\}$? Since $X$ is dense, there exists an infinite number of elements of the sequence $\left(x_n\right)_{n \in \mathbb{N}}$ in any neighborhood $\delta > 0$. Thus when moving a small distance $\delta > 0$, we necessarily cover all elements of the space $M$.


Solution 1:

Let $\{x_n\}_{n=1}^{\infty}$ be a dense subset of $(M,d)$. For each $n$, let $\{B_{n,k}\}_{k=1}^{\infty}$ be a countable base at $x_n$. Such a countable base exists at every point in every metric space. Then $\{B_{n,k}\}_{k,n}$ is a countable base for the entire space $(M,d)$. To prove this, pick any point $u\in X$. Given an open set $U$ containing $u$, there exists some $n$ such that $U$ contains an open ball around $x_n$, (because $\{x_n\}$ is dense in $(M,d)$), and consequently it also contains $B_{n,k}$ for sufficiently large $k$, (because $B_{n,k}$ is a local base at $x_n$ and $U$ is open). This proves that $\{B_{n,k}\}_{k,n}$ is a base for $(M,d)$, and it is a countable union of countably many sets, hence countable.