Separability of a product metric space 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?
 A: Your proof goes through. For countable products, make the analogous argument using the metric
$$d(x,y)=\sum_{i=1}^\infty \frac{1}{2^i}\frac{d_i(x_i,y_i)}{1+d_i(x_i,y_i)}$$ The summands are now bounded by $\frac{1}{2^i}$, so the sum always converges, and defines a metric on the product space.
Incidentally, if you take an even larger cardinality in your product, you're no longer guaranteed first countability, in which case you don't get a metric space. The product space in the pure topological category might still be separable, but it's no longer guaranteed. Steen and Seebach, Counterexamples in Topology, is a good place to look for general topology tidbits like this.
A: 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$.  
A: I think it is not the answer for your question. It's better to see it as a comment after answering of Kevin Carlson. However I know there is a result from Pondiczery, Hewitt and Marczewski that (recently when I read a textbook I found):

If there are not more than $\mathfrak{c}$ ( which is the continuum), separable topological spaces, then their product is still separable.

A: You can bypass a lot of details in proving that $Y=X_1\times X_2$ is separable  by observing that for $ z=(p_1,p_2) \in Y$ and for $r>0$, we have $I_1\times I_2 \subset B_d(z.r)$, where $I_1=B_{d_1}(p_1,r/2)$ and $I_2=B_{d_2}(p_2,r/2)$. So if $D_1$ is dense in $X_1$ and $D_2$ is dense in $X_2$ then $$\phi\ne (D_1 \cap I_1)\times (D_2 \cap I_2)=(D_1\times D_2)\cap (I_1\times I_2)\subset (D_1\times D_2)\cap B_d(z,r).$$
A: The answer to your question whether the countable product of seperable metric spaces is seperableis affirmative. However I thnik it's useful to prove a slight generalization of this, namely that the countable product of second countable topological spaces is countable. Indeed, suppose $\{X_n\}_{n=1}^{\infty}$ is a sequence of second countable topological spaces; for each $n$ let $\mathcal{U}_n$ be a countable basis for $X_n$ containing $X_n$. Defining $\mathcal{U}:=\{\prod\limits_n U_n: U_n\in \mathcal{U}_n \text{ for each }n \text{ and }U_n=X_n \text{ for all but finitely many }n\}.$ Then $\mathcal{U}$ is a countable collection of open sets of $\prod\limits_n X_n$ (there is an obvious bijection from $\mathcal{U}$ into the set of $\mathbb{N}$-valued functions on finite subsets of $\mathbb{N}$). It is easily checked that $\mathcal{U}$ is a basis for the product topology on $\{X_n\}_{n=1}^{\infty}$, hence this space is second countable. What you wanted to prove now follows from the fact that seperable metric spaces are second countable, and second countable spaces, in general, are seperable.
