Prove that a subset of a separable set is itself separable

The problem statement, all variables and given/known data:
Show that if $X$ is a subset of $M$ and $(M,d)$ is separable, then $(X,d)$ is separable. [This may be a little bit trickier than it looks - $E$ may be a countable dense subset of $M$ with $X\cap E = \varnothing$.] Definitions Per our book:

A metric space $(M,d)$ is separable if there exists a countable dense $E$ contained in $M$.

$E$ contained in $M$ is dense if $\forall m\in M$, $\forall ε>0\in\mathbb R$, $\exists e\in E$ s.t. $d(m,e) < ε$

The attempt at a solution

My best attempt was doomed from the start, because I don't quite understand the hint. My thought process went as follows:

Since $X$ is a subset of $M$, $\forall x\in X, x\in M$. Thus, since $E$ is dense in $M$,

$\forall x\in X$, and ε > 0, $\exists e\in E$ st $d(x,e)<ε $.

At this point, I was done, because the set of $e$'s satisfying the above, is a subset of $E$, a countable set. So a subset of a countable set is dense in $X$, and $X$ is separable. This is incorrect, but I cannot see why. Any help clearing up the confusion would be greatly appreciated. Thanks!

Edit: I wish I could upvote all of you for your help! I really appreciate the speedy replies and attempts to make this information clear to me.


Solution 1:

Note that it’s very important here that you’re working in a metric space, because the statement isn’t true in topological spaces in general.

Since $X$ is a subset of $M$, $\forall x\in X, x\in M$. Thus, since $M$ is dense in $E$,

$\forall x\in X$, and $\epsilon > 0$, $\exists e\in E$ st $d(x,e)< \epsilon $.

‘Since $M$ is dense in $E$’ doesn’t make sense. First, you never defined $E$. I can guess that it’s supposed to be a countable dense subset of $M$, but then your statement is just backwards: $E$ is dense in $M$. In any case, finding points of $E$ near $x$ doesn’t help to show that $X$ is separable: to show that you must find a countable subset of $X$ that is dense in $X$, and $E$ might be completely disjoint from $X$. For a concrete example of this possibility, let $M=\Bbb R$ with the usual metric, and let $X$ be the set of irrational numbers. We know that $\Bbb R$ is separable, because $\Bbb Q$ is a countable dense subset of $\Bbb R$. The theorem that you’re to prove says that $X$ is also separable, i.e., that there is some countable set $D$ of irrational numbers that is dense in $X$, but $D$ certainly can’t be $\Bbb Q$, our familiar countable dense set of reals: no member of $\Bbb Q$ is even in $X$.

One way to prove the theorem is to show that if $E$ is a countable dense subset of $M$, then $$\mathscr{B}=\{B(e,r):e\in E\text{ and }0<r\in\Bbb Q\}$$ is a base for $M$, meaning that if $x\in M$, and $U$ is an open set containing $x$, then there is some $B(e,r)\in\mathscr{B}$ such that $x\in B(e,r)\subseteq U$. Note that $\mathscr{B}$ is a countable family of open balls. Then let $$\mathscr{B}_0=\{B\cap X:B\in\mathscr{B}\text{ and }B\cap X\ne\varnothing\}\;,$$ and show that $\mathscr{B}_0$ is a base for $X$. Since $\mathscr{B}$ is countable, so is $\mathscr{B}_0$. Finally, for each $B\in\mathscr{B}_0$ pick one point $x_B\in B$, and let $D=\{x_B:B\in\mathscr{B}_0\}$; $D$ is countable, and it’s not too hard to show that it’s dense in $X$ and hence that $X$ is separable.

Solution 2:

EDIT: Fixed a mistake.

Here is a slightly different answer, though of course basically equivalent to the other two.

$X$ is a subset of $M$. $E$ is a countable dense subset of $M$. We would like to find a countable dense subset of $X$.

The problem, as hashed out in the comments above, is that we would like to use $E$ as our countable dense subset of $X$, but the points of $E$ may not actually belong to $X$.

So one thing we can do is this: Every point $e$ in $E$ has some distance $$ d(e, X) = \inf\{ d(e, x) : x\in X\} $$ i.e. how far it is from the set $X$.

For every $e$ in $E$, choose points $a_n$ in $X$ whose distance from $e$ is, say, less than $d(e,X) + 1/n$. (I may not be able to get $a$ exactly distance $d(e,X)$ from $e$, but I can get close.)

Now, let $A$ be the set of all $a_n$ that I made, countably many from each $e$ in $E$. (Okay, some $a_n$ may belong to multiple $e$'s, but so what.) $A$ is in $X$, by definition, and $A$ is countable, as $E$ was (countable union of countable sets is countable).

So I just have to show that $A$ is dense in $X$. Let $x$ be any point of $X$, and take any $\epsilon>0$. Then there is some $e\in E$ within $\epsilon/3$ of $x$, i.e. $d(x,e)<\epsilon/3$. That means $d(e, X)\leq \epsilon/3$, so there is some $a\in A$ such that $$ d(e,a) < d(e,X) + \epsilon/3 \leq 2\epsilon/3. $$

So $$ d(x,a) \leq d(x,e) + d(e,a) < \epsilon/3 + 2\epsilon/3 = \epsilon. $$

So $A$ is dense in $X$.