# proof of rational numbers as repeating or terminating decimal

As an exercise in my conceptual algebra class we attempted to determine the reason why this theorem holds true in the forward direction. (Note we decided not to tackle the opposite direction) I wrote out a proof of it for the discussion that laid it out rather simply but I would like to make it more formal. However, the more formal version doesn't seem as clear to me as my original did.

Original plain English proof: If we take any rational number p/q and begin to work out the division we see that at each step we have a remainder. This remainder will always be a value between 0 and q-1 because if it was not we would know from the rules of division that our quotie t was wrong.

If our remainder is 0 then the decimal terminates and we are finished. If we never get 0 then there are only a limited set of numbers our remainder can be and eventually one of them will be repeated. As soon as a remainder is repeated the entire decimal will repeat itself giving us a repeating decimal.

Therefore every rational number is represented by a decimal that either terminates or repeats.

Formal proof attempt: Claim: if a number is rational, then it's decimal expansion either terminates or repeats.

Proof: let a/b be a rational number. Then by the definition of rational numbers a/b is a ratio of the integers a and b where b divides a.

Then by the division algorithm a=bq+r for some integers q,r and 0 <= r < b

It follows that if r is 0 the decimal terminates. If r is not 0 then, because r can only be a restricted set of integers, by the pigeonhole principle at some point r must repeat.

Thus the decimal expansion of a rational number either terminates or repeats.

• If $b$ divides $a$, $\frac ab$ is an integer. You'll want to leave that out in the definition of a rational. – AlexR Jun 22 '15 at 21:36

This theorem is about the decimal number system, this suggests that the number $10$ might play some role here.
Indeed, for any rational $x=a/b\$ (with $\gcd(a,b)=1$), if $b|10^n$ then $x$ will have at most $n$ fractional digits.
Else, deduce the problem to the case when $\gcd(b,10)=1\$ (by multiplying a power of $10$).
Finally, for such a $b$ one needs to find an $n$ that makes $b|(10^n-1)$. Then $n$ will be a period for the infinite sequence.
The classical $1/7=0.(142857)^\bullet$ is a good example to study. Observe that $7|999999$.