Set of rational sequences is countable and dense in $l_2$ Let
$$D=\{(a_n):\quad (\forall n\in \mathbb{N}\space a_n\in \mathbb{Q})\land (\exists p\in \mathbb{N}:\space \forall n\geq p\space a_n=0) \}.$$
I want to show that $D$ is countable and dense in $l_2$. I proved there is an injection $h:\mathbb{Q}\rightarrow D$ by considering $$h(q)= (q, q, ...,q,0,0,...).$$
I also thought of the function $f:D\rightarrow \mathbb{Q}$ defined by $$f(a_n)=\sum_{i=1}^{p-1}a_i$$ for some $p$ as in the definition of $D$. But I can't seem to prove it is in fact an injection. On the other hand, to show that $D$ is dense in $l_2$: knowing that $\mathbb{Q}$ is dense in $\mathbb{R}$ can I directly conclude that $D$ is dense in $l_2$?
 A: For each sequence $(x_n) = (x_1, x_2, ..., x_k, \ldots)$ in $l_2$, consider the sequences in $c_{00}$ defined by
$(x^i_n) = (x_1, x_2, ..., x_i, 0, ...)$ for all $i ∈ \mathbb{N}$. Then you see that $\lim_{i} (x^i_n) = (x_n)$:
$$||(x_n) - (x_n^i)  ||_2^n = \sum_{j = i+1}^{\infty}|x_j|^2 \rightarrow 0 $$
when $j$ goes to infinity, its show that $c_{00}$ is dense em $l_2$.
But you could repeat this argument for elements of the $D$ space, since $\mathbb{Q}$ is dense in $\mathbb{R}$ (if this is the scalar field you are working on), and so, replace the sequences $(x^i_n) = (x_1, x_2, ..., x_i, 0, ...)$ with $x_i \in \mathbb{R}$ with $x_i \in \mathbb{Q}$, taking for each $i$, the rational number closest to $ x_i $.
A: Your function $f$ is not injective. For example $f((1,0,0,0,...))=f((0,1,0,0,...))=1$.
What you can do is: Define $D_p=\{(a_n)\in D:a_n=0$ for $n\geq p\}$. Then since a countable union of countable sets is countable it suffices to show that each $D_p$ is countable. Then try to show that $D_p$ is in bijection with $\mathbb Q^{p-1}$.
Also it is true that  $\mathbb Q$ is dense  in $\mathbb R$ implies that $D$ is dense in $l_2$. But this needs to be proven.
A hint for that: If $(x_n)\in l_2$ and $\epsilon>0$ there is $N\in\mathbb N$ with
$${\sum_{n=N}^\infty |x_n|^2}<\frac{\epsilon^2} 2$$ So if you can find $(a_n)\in D$ with $a_n=0$ for $n\geq N$ and  $$\sum_{n=1}^{N-1} |a_n-x_n|^2<\frac{\epsilon^2}2$$
you will have $\|(a_n)-(x_n)\|_2<\epsilon$. For this last step, try to use that $\mathbb Q$ is dense in $\mathbb R$.
