Every subspace of a separable metric space is separable. [duplicate]

I want to know if this is an adequate proof.

Proof:
Let $X$ be a separable metric space and let $A$ be a subspace of $X$. Since $X$ is separable, it contains a countable dense subset $D$. So $\forall$ neighborhood $U$ of $x$ in $X$, $\exists$ a $d \in D: d\in U$.

Let $x\in A\implies U\cap A$ is a neighborhood of $x$ relative to $A$.
Which implies that $\exists d\in D:d\in U\cap A$.

Let $D^{*}$ represent all elements of $D$ which are also elements of $U\cap A$.

This implies $D^{*}$ is dense in $A\implies A$ is separable.

• I think your statement is unclear or wrong, indeed $\{0\}$ is a subspace of $\mathbb{R}$ but is not separable. It might work if you ask your subspace to be open! Dec 2, 2017 at 15:01
• I am referencing Willard's, "General Topology" problem 16G2 on page 114 and it states that "Every subspace of a separable metric space is separable." Please let me know if there is something that I am missing from this exercise. Dec 2, 2017 at 15:08
• @TommasoSeneci Any finite space is separable. Dec 2, 2017 at 15:54
• Ok sorry I got what you mean. Dec 2, 2017 at 16:18
• IIf it were right it would apply to every separable space because you have not used any of the metric properties. But a separable non-metrizable space can have a non-separable subspace. For example let $S$ be an uncountable set and take $p\in S.$ Let a non-empty $T\subset S$ be open in $S$ iff $p\in T.$ Then $\{p\}$ is dense in $S$ but $S$ \ $\{p\}$ is a discrete uncountable subspace of $S.$ Dec 3, 2017 at 7:31

For a metric space we have that if $(X,d)$ is separable, it has a countable base (we can take all open balls with centre in a countable dense subset and radius rational, e.g.). A subspace of a space with a countable base also has a countable base (the intersections of the countable base elements with the subspace), and a subspace with a countable base is separable (pick an element from each non-empty base element).
So a direct proof idea from the above: let $D$ be countable and dense in $X$, and let $A$ be a subspace. Consider $D' = \{(d,q) \in D \times \mathbb{Q}: B(d,q) \cap A \neq \emptyset\}$, and note that $D'$ is countable and for each $(d,q) \in D$ pick $a(d,q) \in A \cap B(d,q)$. Then $\{a(d,q): (d,q) \in D'\}$ is countable and dense in $A$.
• For proving second countable $\implies$ separable, we need axiom of choice. Right? May 29 at 7:24
Defining $D^*$ in terms of $U$ won't work. (Already, this fails if $A$ is all of $X$.) This is because $U$ depends on a fixed $x \in A$, so there is no reason for $D^* = D \cap U \cap A$ to be dense.
In fact, even the "obvious" candidate $D^* = D \cap A$ won't work. (Consider $X = \mathbb R, D = \mathbb Q, A = \mathbb R - \mathbb Q$.)