# How can I prove that all rational numbers are either terminally real or repeating real numbers?

I am trying to figure out how to prove that all rational numbers are either terminally real or repeating real numbers, but I am having a great difficulty in doing so.

Any help will be greatly appreciated.

Thanks!

-
Next time, please make the body of your post self-contained. Don't just put the question you're asking in the title. – J. M. Sep 5 '11 at 1:59

HINT$\$ Consider what it means for a real $\rm\ 0\: < \: \alpha\: < 1\$ to have a periodic decimal expansion:

$\rm\qquad\qquad\qquad\qquad\ \ \: \alpha\ =\ 0\:.a\:\overline{c}\ =\ 0\:.a_1a_2\cdots a_n\:\overline{c_1c_2\cdots c_k}\ \$ in radix $\rm\:10\:$

$\rm\qquad\qquad\iff\quad \beta\ :=\ 10^n\: \alpha - a\ =\ 0\:.\overline{c_1c_2\cdots c_k}$

$\rm\qquad\qquad\iff\quad 10^k\: \beta\ =\ c + \beta$

$\rm\qquad\qquad\iff\quad (10^k-1)\ \beta\ =\ c$

$\rm\qquad\qquad\iff\quad (10^k-1)\ 10^n\: \alpha\ \in\ \mathbb Z$

Thus to show that a rational $\rm\:\alpha\:$ has such a periodic expansion, it suffices to find $\rm\:k,n\:$ as above, i.e. so that $\rm\ (10^k-1)\ 10^n\:$ serves as a denominator for $\rm\:\alpha\:.\:$ Put $\rm\:\alpha\: = a/b,\:$ and $\rm\: b = 2^i\:5^j\ d,\:$ where $\rm\:2,5\:\nmid d\:.\:$ Choosing $\rm\:n\: >\: i,\ j\:$ ensures that $\rm\:10^n\:\alpha\:$ has no factors of $\rm\:2\:$ or $\rm\:5\:$ in its denominator. Hence it remains to find some $\rm\:k\:$ such that $\rm\:10^k-1\:$ will cancel the remaining factor of $\rm\:d\:$ in the denominator, i.e. such that $\rm\:d\:|\:10^k-1\:,\:$ or $\rm\:10^k\equiv 1\pmod{d}\:.\:$ Since $\rm\:10\:$ is coprime to $\rm\:d\:,\:$ by the Euler-Fermat theorem we may choose $\rm\:k = \phi(d)\:,\:$ which completes the proof sketch. For the converse, see this answer.

-
+1 Exactly the kind of answer I was going to write. – Sasha Sep 5 '11 at 1:24

First, it’s clear that you need only look at proper fractions. Now look at the long division algorithm for calculating the decimal expansion of a rational number. At each stage you get a remainder. What happens if you get a remainder of $0$ at some stage? If you don’t ever get a remainder of $0$, can you keep getting different remainders forever, or must a remainder repeat at some point? What happens if you do get a repeated remainder?

-

Remainders must be less than the divisor. So, for example, if you divide the numerator by the denominator, n, the only remainders can lie between 0 (in which case the division ends) and n-1. What happens if and when you run out of remainders (i.e. you've used all of the numbers between 1 and n-1)? You will be facing division of some remainder, r, by n again. You've been there and done that so you know what the next remainder (hence, the next dividend) will be. And so on...

-

Recall that in long division, one gets a remainder at each step: $$\begin{array} & & & 0 & . & 2 & 2 & 7 & 2 \\ \hline 22 & ) & 5&.&0&0&0&0&0 \\ & & 4 & & 4 \\ & & & & 6 & 0 & \leftarrow \\ & & & & 4 & 4 \\ & & & & 1 & 6 & 0 \\ & & & & 1 & 5 & 4 \\ & & & & & & 6 & 0 & \leftarrow & \text{repeating}\\ \end{array}$$ 6 is a remainder. The next remainder is 16. Then the next is 6. This brings us back to where we were at an earlier step: Dividing 60 by 22. We have to get the same answer we got the previous time. Hence we have repetition of "27". The answer is $0.2272727\overline{27}\ldots$, where "27" keeps repeating.

The question then is: Why must we always return to a remainder that we saw earlier? The answer is that the only possible remainders are $0, 1, 2, 3, \ldots, 21$ (if $22$ is what we're dividing by) and there are only finitely many. If we get 0, the process terminates. If we never get 0, we have only 21 possibilities, so we can go at most 21 steps without seeing one that we've seen before. As soon as we get one that we've seen before, the repetition begins.

A related question worth asking is how you know that every repeating decimal corresponds to a rational number. E.g., if you're handed $0.2272727\overline{27}\ldots$ with "27" repeating forever, how do you figure out that it's exactly $5/22$? There's a simple algorithm for that too.

-