The image of a separable space is also separable Let $X$ and $X^\prime $ be metric spaces, where $X$ is separable. Let $f: X \rightarrow X^\prime$ be a continuous surjective function. Show that $X^\prime$ is separable.
I would like verification that my solution is valid. Thank you.
Proof. Suppose that $X$ is separable. Then there exists a set $A$ that is dense in $X$, where $A$ is countable. Since $A$ is dense in $X$, then by definition $\bar{A} = X$, hence for all $x \in X$ and every $\delta > 0$, we have $B_\delta (x) \cap A \neq \emptyset$. The same ball $B_\delta$ centered at $\alpha, B_\delta (a),$ will contain $x$ by the symmetry of $d(x,a)$.
Since $f$ is continuous, for each $\alpha \in A$ we have that for all $r > 0$, there exist a $\delta > 0$, such that for all $x \in X$ satisfying $d(x,a) < \delta$, we have that $d^\prime (f(x), f(a)) < r$.
Let $B_r(f(a))$ be the open ball in $X^\prime$ centered at the image of $a$, where $r$ is arbitrary from the definition of $f$ being continuous. Now construct  $$B = \{f(\alpha):  \alpha \in A\}.$$ Note that since $A$ is countable, so is $B$. Then we have that for all $f(x) \in X^\prime$ and for an arbitrary $r > 0$, the open ball $B_r(f(x)) \cap B \neq \emptyset$, (because $f(a) \in B$). Since every open ball centered at $f(x) \in X^\prime$ intersected with $B$ is nonempty, by definition every $f(x)$ is in the closure of $B$, hence $\bar{B} = X$. By the surjectivity of $f$, we know that this applies to every image $f(x)$. Hence, $B$ is dense in $X^\prime$ and by the construction of $B$ from $A$, it is also countable. Therefore, $X^\prime$ is separable.
QED
 A: $\newcommand{\cl}{\operatorname{cl}}$The proof is correct, apart from the error noted in the comments, but it is unnecessarily long and clumsy and for that reason harder than necessary to follow. Here is essentially the same idea expressed more straightforwardly.

Suppose that $X$ is separable, let $A$ be a countable dense subset of $X$, and let $B=f[A]$; clearly $B$ is countable, so we need only show that $B$ is dense in $X'$. To do this it suffices to show that each $y\in X'$ is in $\cl B$, so let $y\in X'$ be arbitrary; we want to show that $B_{d'}(y,\epsilon)\cap B\ne\varnothing$ for each $\epsilon>0$, so let $\epsilon>0$.


Since $f$ is surjective, $y=f(x)$ for some $x\in X$, and since $f$ is continuous, there is a $\delta>0$ such that $f[B_d(x,\delta)]\subseteq B_{d'}(y,\epsilon)$. $A$ is dense in $X$, so there is some $a\in B_d(x,\delta)\cap A$. Clearly $f(a)\in f[B_d(x,\delta)]\cap f[B]\subseteq B_{d'}(y,\epsilon)\cap B$, so $B_{d'}(y,\epsilon)\cap B\ne\varnothing$, as desired, $B$ is dense in $X'$, and $X'$ is separable. $\dashv$

