# Why is the set of all $\infty$-tuples with finitely many non-zero rational terms dense in $\ell_2$?

This statement has been given as an example in the book "Introductory real analysis" written by Kolmogorov and Fomin:

The set of all points $x=(x_1,x_2,\cdots,x_n,\cdots)$ with only finitely many non-zero coordinates, each a rational number, is dense in the space $\ell_2$.

and $\ell_2$ is defined this way:

$$\ell_2 = \{ (x_1,x_2, \cdots, x_n, \cdots): \sum_{n=1}^\infty x_n^2 <\infty \text{ and } x_n \in \mathbb{R} \}$$

Analysis is one of my weak subjects in math. So, please bear with me.

I know what I need to show. Suppose that I define: $$A = \{ (x_1,x_2, \cdots, x_n, \cdots): \text{only finitely many terms are non-zero and } x_i \in \mathbb{Q} \}$$

I need to show that if $(x_n)_{n \in\mathbb{N}}$ is in $l_2$ then one can find a "sequence of sequences in $A$" such that the limit approaches to $(x_n)_{n \in \mathbb{N}}$.

So, if I was allowed to use sequences like $(x_1,x_2, \cdots, x_n, \cdots)$ where only finitely many terms are non-zero but the terms were allowed to be in $\mathbb{R}$ I was done because for any sequence $(x_n)$ the sequence $(y_k)$ where $y_k = (x_1, x_2, \cdots, x_k, 0, 0, 0, \cdots, 0, \cdots)$ works. Am I right?

Now the problem is that I should find a sequence like $y_k$ where this time all terms must be chosen from rational numbers.

This is my solution for this:

Since $\mathbb{Q}$ is dense in $\mathbb{R}$ I can find a sequence of rational numbers that approaches any given real number $x_i$. therefore:

$$x_1 = \lim (q_{11},q_{12},q_{13}, \cdots, q_{1n}, \cdots)$$ $$x_2 = \lim (q_{21},q_{22},q_{23}, \cdots, q_{2n}, \cdots)$$ $$\vdots$$ $$x_i = \lim (q_{i1},q_{i2},q_{i3}, \cdots, q_{in}, \cdots)$$ $$\vdots$$

Now I create my new sequence this way:

$$y_1 = (q_{11},0,0,0,0,0,0,\cdots)$$ $$y_2 = (q_{12},q_{22},0,0,0,0,\cdots)$$ $$y_3 = (q_{13},q_{23},q_{33},0,0,\cdots)$$

and $y_k$ is formed the similar way. I mean you go the $k$-th column and choose $q_{1k},q_{2k},\cdots,q_{kk}$ on the rows and put zero for all other entries beyond the $k$-th coordinate.

I want to claim that given any $x=(x_1,x_2, \cdots, x_n, \cdots)$ in $\ell_2$, the sequence $(y_k)_{n \in \mathbb{N}}$ constructed in the way just explained approaches $x \in \ell_2$. I think it is obvious that this is true because:

$$\lim_{k \to \infty} y_k = (\lim_{k \to \infty} q_{nk})_{n \in \mathbb{N}} = (x_n)_{n \in \mathbb{N}}$$

Does what I'm saying makes sense? Is my solution correct or it needs to be modified?

Let me offer a simpler proof. First, let $c_{00}$ denote the subset of $\ell_2$ that consists of sequences with finite support, that is, sequences with finitely many non zero terms. Then your set, let's call it $r$, with rational entries, is a subset of this. I claim that $r$ is dense in $c_{00}$ and $c_{00}$ is in turn dense in $\ell_2$.

Proof Given $\varepsilon >0$ and $x\in c_{00}$, say $x=(x_1,x_2,\ldots,x_n,0,0,0,\ldots)$ pick rationals $r_1,\ldots,r_n$ such that $$|r_i-x_i|^2<2^{-i+1}\varepsilon$$ for $i=1,\ldots,n$. We can do this, for $\Bbb Q$ is dense in $\Bbb R$. Let, $q=(r_1,\ldots,r_n,0,\ldots)\in r$. Then we see $$\lVert x-q\rVert^2 =\sum_{i=1}^n|x_i-r_i|^2<\varepsilon\sum_{i=1}^n2^{-i+1}\leqslant \varepsilon\sum_{i=1}^\infty 2^{-i+1}=\varepsilon$$

This proves $r$ is dense in $c_{00}$. Now, we'll prove $c_{00}$ is dense in $\ell_2$. Pick thus $x\in\ell^2$. By definition, $$\sum_{n\geqslant 1}x_n^2<+\infty$$ where $x=(x_1,x_2,\ldots)$. In particular, given $\varepsilon >0$; there exists $N$ large enough so that $$\sum_{n> N}x_n^2<{\varepsilon}$$

But now all is easy: consider the element $x'=(x_1,\ldots,x_N,0,0,0,\ldots)\in c_{00}$. Then $$\lVert x-x'\rVert^2 =\sum_{n> N}x_n^2<{\varepsilon}$$

Thus $c_{00}$ is dense in $\ell_2$. Since density is transitive, we conclude $\bar r=\ell_2$, as desired. $\blacktriangleleft$

Observe this is easily adapted to prove $\ell^p$ is separable for each $p\geqslant 1$, for $r\subseteq c_{00}\subseteq \ell^p$ and $r$ is countable: it is essentially the same as $$\bigcup_{k\geqslant 1} \Bbb Q^k$$

Your ideas are essentially correct. However, the devil is in the details. You have to be careful about the values of $q_{i,j}$, and choose them correctly.

For example, if in your sequence, $|q_{i,i} - x_i|> 1 \quad \forall i$, then you will never converge to the sequence (since we are always at least distance 1 away), even though you have pointwise convergence.

You can verify that the choice of variables $q_{i,j}$ such that for $i<j$, $|q_{i,j} - x_j| < \frac{1}{2^n}$ would work.