I am trying to prove the following: 'If $(X_1,d_1)$ and $(X_2,d_2)$ are separable metric spaces (that is, they have a countable dense subset), then the product metric space $X_1 \times X_2$ is separable.' It seems pretty straightforward, but I would really appreciate it if someone could verify that my proof works.
Since $(X_1,d_1)$ and $(X_2,d_2)$ are separable, they each contain a countable dense subspace, say $D_1 \subset X_1$ and $D_2 \subset X_2$. We will show that $D_1 \times D_2 \subset X_1 \times X_2$ is dense and countable. First, $D_1 \times D_2$ is countable since both $D_1$ and $D_2$ are.
Now let $x=(x_1,x_2) \in X_1 \times X_2$ and let $d$ be the product metric on $X_1 \times X_2$ (given by $d(x,y)=(\displaystyle\sum_{i=1}^2 d_i(x_i,y_i)^2)^{1/2}$). We will show that every open ball $B_d(x,\varepsilon)$ containing $x=(x_1,x_2)$ also contains a distinct point of $D_1 \times D_2$. Let $a_1 \in B_{d_1}(x_1,\frac{\sqrt{2}}{2}\varepsilon)\cap D_1$ and let $a_2 \in B_{d_2}(x_2,\frac{\sqrt{2}}{2}\varepsilon)\cap D_2$ (such points exist because $D_1$ and $D_2$ are dense in $X_1$ and $X_2$, respectively.) Letting $a=(a_1,a_2)$, we then have $d(x,a)=(\displaystyle\sum_{i=1}^2 d_i(x_i,a_i)^2)^{1/2})=(d_1(x_1,a_1)^2 + d_2(x_2,a_2)^2)^{1/2} < ((\frac{\sqrt{2}}{2}\varepsilon)^2 + (\frac{\sqrt{2}}{2}\varepsilon)^2)^{1/2}=\varepsilon$, so we have that $a \in B_d(x,\varepsilon)$, so $D_1 \times D_2$ is dense in $X_1 \times X_2$. Then since $D_1 \times D_2 \subset X_1 \times X_2$ is a countable dense subspace of $X_1 \times X_2$, we have that $X_1 \times X_2$ is separable.
I can see how this would easily generalize to finite products, but does it also extend to countable products?
Best Answer
Two other thoughts about the answers so far:
Kevin in his answer gives you a metric that works for the countable product. But, you can actually use $\displaystyle{d(x,y)=\sum\frac{1}{2^i}d_i'(x,y)}$ where $d_i'$ is any metric that is compatible with $d_i$ and bounded by 1. So for example $d_i'(x,y)=\mbox{min}\{d_i(x,y),1\}$ would also work.
In the countable product space, the countable dense subset is no longer just the product of the dense subsets from each factor. Instead you have to fix a sequence of $\prod D_i$, say $\{x_i\}$ and take the subset of sequences that eventually agree with $\{x_i\}$. And this set is countable.
This set is dense because any basic open set in the product $\prod X_i$ looks like $U=\prod U_i$ where the $U_i$ are open in $X_i$ and are not all of $X_i$ for only finitely many $i$, say up through $U_n$. So we can pick a sequence $\{s_i\}$ from our eventually constant set so that the $s_i$ is in $U_i$ for the first $n$ terms of the sequence. From then on let it agree with the $\{x_i\}$ above, and we will have $\{s_i\}\in U$.
So for example in $\mathbb{R}^{\omega}$, the countable product of the reals, a dense countable subset is the set of all rational sequences that are eventually $0$.