# Dense Set

Let \(X \subset \mathbb{R}\). A subset \(S \subset X\) is called **dense in \(X\)** if any real number can be arbitrarily well-approximated by elements of \(S\). For example, the rational numbers \(\mathbb{Q}\) are dense in \(\mathbb{R}\), since every real number has rational numbers that are arbitrarily close to it.

Formally, \(S \subset X\) is dense in \(X\) if, for any \(\epsilon > 0\) and \(x\in X\), there is some \(s\in S\) such that \(|x - s| < \epsilon\).

An equivalent definition is that \(S\) is dense in \(X\) if, for any \(x\in X\), there is a sequence \(\{x_n\} \subset S\) such that \[\lim_{n\to\infty} x_n = x.\]

## Examples Of Dense Sets

The canonical example of a dense subset of \(\mathbb{R}\) is the set of rational numbers \(\mathbb{Q}\):

The rational numbers \(\mathbb{Q}\) are dense in \(\mathbb{R}\).

Take \(x\in \mathbb{R}\). We may write \(x = n + r\) where \(n \in \mathbb{Z}\) and \(0 \le r < 1\). Consider the decimal expansion \[r = 0. r_1 r_2 r_3 \cdots. \] Setting \[x_k = n + 0.r_1 r_2 \cdots r_k, \] we see that each \(x_k\) is rational and \[\lim_{k\to\infty} x_k = x.\]

In fact, for any irrational number \(\alpha \in \mathbb{R}\), the set \[S_{\alpha} := \{a+b\alpha \, | \, a, b \in \mathbb{Z}\}\] is dense in \(\mathbb{R}\). This is harder to prove than the above example, and requires clever use of the pigeonhole principle.

For any irrational \(\alpha \in \mathbb{R}\), the set \(S_{\alpha}\) is dense in \(\mathbb{R}\).

Assume \(\alpha > 0\). The proof when \(\alpha < 0\) is entirely analogous.

Let \(\{x\}\) denote the fractional part of \(x\). First, we claim that the set \[R_{\alpha} = \{\{n\alpha\} \, | \, n \in \mathbb{Z}\}\] is dense in \([0,1]\).

Choose \(\epsilon > 0\) and pick an integer \(m\) such that \(m > 1/\epsilon\). Divide the unit interval \([0,1]\) into \(m\) subintervals, each of length \(1/m\). By the pigeonhole principle, some two of the numbers \(\{\alpha\}, \{2\alpha\}, \cdots, \{m\alpha\}, \{(m+1)\alpha\}\) must be in the same subinterval, so there exist integers \(1\le i < j \le m+1\) such that \(|\{i\alpha\} - \{j\alpha\}| < 1/m\).

But \(|\{j\alpha\} - \{i\alpha\}| = \{(j-i)\alpha\} \), so \( \{(j-i)\alpha\} < 1/m \). For any \(y \in [0,1]\), there is some \(0\le k \le m-1\) such that \(y \in [k/m, (k+1)/m]\). We may then pick an integer \(q\) such that \[q\{(j-i)\alpha\} = \{q(j-i) \alpha\} \in \left [ \frac{k}{m}, \frac{k+1}{m} \right], \] so that \(|y - \{q(j-i)\alpha\}| < 1/m < \epsilon\). Thus, \(R_{\alpha}\) is dense in \([0,1]\).

Now, for any \(z \in \mathbb{R}\), write \(z = a + r\) where \(a \in \mathbb{Z}\) and \(0\le r <1\). Since \(R_{\alpha}\) is dense in \([0,1]\), there is \(b \in \mathbb{N}\) such that \(|r - \{b \alpha\}| < \epsilon\). It follows that \[|a- \lfloor b \alpha \rfloor + b\alpha - z| = |\{b\alpha\} - r| < \epsilon\] Since \(a- \lfloor b \alpha \rfloor + b\alpha \in S_{\alpha}\), we conclude \(S_{\alpha}\) is dense in \(\mathbb{R}\).

Let \(\alpha \in \mathbb{R}\) be an irrational number. Consider the set \[S := \{\{2^n \alpha\} \, | \, n \in \mathbb{N}\},\] where \(\{x\}\) denotes the fractional part of \(x\). Is \(S\) dense in \([0,1]\)?

Consider the set \[S:= \{\sqrt{m}-\sqrt{n}\, : \, m, n \in \mathbb{N}\}.\] Is \(S\) dense in \(\mathbb{R}\)?

## Dense Sets In General Metric Spaces

One may define dense sets of general metric spaces similarly to how dense subsets of \(\mathbb{R}\) were defined.

Suppose \((M, d)\) is a metric space. A subset \(S \subset M\) is called

dense in \(M\)if for every \(\epsilon > 0\) and \(x\in M\), there is some \(s\in S\) such that \(d(x, s) < \epsilon\).

For example, let \(\mathcal{C}[a,b]\) denote the set of continuous functions \(f: [a,b] \to \mathbb{R}\). One may give \(\mathcal{C}[a,b]\) the structure of a metric space by defining \[d(f,g) = \max_{x\in [a,b]} |f(x) - g(x)|\] By the extreme value theorem, this maximum exists for any two \(f, g \in \mathcal{C}[a,b]\), so the distance function is well-defined. One can easily check that \(d\) satisfies the axioms of a metric space.

Let \(\mathcal{P} \subset \mathcal{C}[a,b]\) be the subset consisting of polynomial functions. The Stone-Weierstrass Theorem states that \(\mathcal{P}\) is dense in \(\mathcal{C}[a,b]\). Intuitively, this means any continuous function on a closed interval is well-approximated by polynomial functions!