5

I have read that rationals are dense in the reals, but I've been curious if the terminating decimals are as well. Since, in applied math, all effectively "real" numbers are approximated with terminating decimals, I would expect the terminating decimals to have this property, and if not I'm curious why. Here I'm defining the terminating decimals like this:

$$D = \{\frac{m}{10^n} \in \mathbb{Q} : m \in \mathbb{Z} \wedge n \in \mathbb{N}_0\}$$.

4 Answers4

6

Yes, they are.

First, think informally (and you do this, with your sentence beginning "since"). A set $X$ is dense iff every real number $r$ can be "well-approximated" by an element of $X$. For terminating decimals, this approximation amounts to simply ... truncating at a certain point! E.g. $\pi$ is the limit of the sequence $$3.0000..., 3.1000..., 3.1400..., ...$$ of reals with terminating decimal expansions.


OK, now we need to make this rigorous. Fix reals $a<b$.

  • First, show that there is some $n$ such that $10^{-n}<b-a$. (This is actually the most substantial step, but at the same time may be the intuitively clearest one.)

  • Let $X=\{z\cdot 10^{-n}: z\in\mathbb{Z}\}$. Show that $X\cap (-\infty,a]$ has a greatest element - that is, there is a largest "$n$-place decimal" which is $\le a$.

    • It may be easiest to first assume $a>0$ here.
  • Calling that number "$\alpha$," what can you say about $\alpha+10^{-n}$?

Note that this works for any base, not just $10$.

Noah Schweber
  • 245,398
1

Another approach is to show that the dyadic rationals (IE numbers of the form $\frac{ a}{ 2^b}$, where $a$ is an integer and $b$ is a natural number) are dense.
Another number can be approximated by a dyadic sequence by bisecting the interval that it is in.

The 2-adic rationals terminates with at most $b$ decimal places. (In fact, it needs $b$ decimal places if $a$ is odd.)

Calvin Lin
  • 68,864
0

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$.

CopyPasteIt
  • 11,366
-3

Suppose $a$ and $b$ are terminating decimals. We will find a terminating decimal that lies between them, namely $\frac{a+b}2$. For example, between $1.7$ and $0.0001$ is $\frac{1.7+0.0001}2 = 0.850005$.

First, as you said, write $$a=\frac A{10^i}, b=\frac B{10^j}.$$

Without loss of generality, $i\le j$. Then write $$a=\frac{A\cdot 10^{j-i}}{10^j}.$$

Now $$\frac{a+b}2= \frac{A\cdot10^{j-i} + B}{2\cdot 10^j} = \frac{5A\cdot 10^{j-i} + 5B}{10^{j+1}} $$

is a terminating decimal between $a$ and $b$.

MJD
  • 65,394
  • 39
  • 298
  • 580
  • 4
    This isn't actually enough to show that the set of reals with terminating decimal expansions is dense in $\mathbb{R}$: we can have a set $X\subseteq\mathbb{R}$ such that between any two elements of $X$ there is a third element of $X$ but which is nonetheless nowhere dense. For example, consider the set of midpoints of intervals removed in the Cantor set construction. (There's an annoying terminological issue here re: "dense." When we say a set $X$ is dense in the reals, as in the OP, we mean that topologically: every nonempty open subset of $\mathbb{R}$ contains an element of $X$.) – Noah Schweber Dec 23 '20 at 05:03
  • Yes, thanks.for the counterexample. – MJD Dec 23 '20 at 05:16
  • 1
    I had deleted this but on second thought I decided that the mistake was instructive, and I should leave it up. – MJD Dec 26 '20 at 21:55
  • 1
    I wrote up the mistake on my blog, with a more detailed explanation of the counterexample. – MJD Jan 01 '21 at 17:04
  • 1
    It seems the definition you had in mind is that $X$ is dense if, for every two elements of $X$, there is an element of $X$ between them. As Noah said, this is not the right definition and there are even easier examples: on top of very trivial ones, such as $X$ being a singleton, we can also take $X$ to be the closed interval $[0,1]$. – verret Jan 04 '21 at 04:50
  • On the other hand, changing a single symbol, one can get a correct definition: $X$ is dense if, for every two elements of $\mathbb{R}$, there is an element of $X$ between them. (It's not hard to see this is equivalent to the perhaps more usual definition. This is how I learned it, and I'm guessing this is where your confusion came from.) – verret Jan 04 '21 at 04:50