We have
$\quad D \subset \Bbb Q \subset \Bbb R$
We know $\Bbb Q$ is dense in $\Bbb R$.
We'll now show that $D$ is dense in $\Bbb Q$, leaving it to the OP to
complete the argument (i.e. denseness is transitive) that $D$ is dense in $\Bbb R$.
Let $s \in \Bbb Q$ so that we can write
$\quad s = \Large \frac{u}{v} \normalsize \quad \text{with } u,v \in \Bbb Z \text{ and } v \ge 1$
If $n \in \Bbb N$ consider the division of $u\cdot 10^n$ by $v$,
$\quad u\cdot 10^n = vq + r \text{ with } 0 \le r \lt v$
But then
$\quad \Large \frac{u}{v} - \large q \cdot 10^{-n} = \Large \frac{r}{v} \large 10^{-n}$
Since $q\cdot 10^{-n} \in D$ and
$\quad \large 0 \le \Large \frac{r}{v} \large 10^{-n} \lt 10^{-n}$
we've demonstrated that $s \in \Bbb Q$ can be approximated
to any specified precision with a terminating decimal.
Using the above theory a simple algorithm can be specified to find these expansions.
Example: Approximate $\large \frac{23}{7}$ up to $6$ (fractional) decimals of precision;
i.e. repeat $6$ times: multiply the numerator (the residue) by $10$ and then divide by $7$.
Divide |
Approximate (append quotient) |
$23\cdot 10 = 7 \cdot 32 + 6$ |
$\large \frac{23}{7} \approx 3.2$ |
$6\cdot 10 = 7 \cdot 8 + 4$ |
$\large \frac{23}{7} \approx 3.28$ |
$4\cdot 10 = 7 \cdot 5 + 5$ |
$\large \frac{23}{7} \approx 3.285$ |
$5\cdot 10 = 7 \cdot 7 + 1$ |
$\large \frac{23}{7} \approx 3.2857$ |
$1\cdot 10 = 7 \cdot 1 + 3$ |
$\large \frac{23}{7} \approx 3.28571$ |
$3\cdot 10 = 7 \cdot 4 + 2$ |
$\large \frac{23}{7} \approx 3.285714$ |
Since the decimal expansions of fractions eventually keep repeating a block of digits, this algorithm is useful. For the above, the algorithm can be designed to determine that
$\large \frac{23}{7} = 3.\overline{285714}$
Note that the above theory and algorithm design does not depend on the base being equal to $10$;
it follows the same logic path for any base $b \ge 2$.