Decimal expansions: repeating means rational
P82.rationals.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: From counting to fractions: ℕ, ℤ and ℚ, √2 is not a fraction
P82.rationals.02 · Audience: Guest, IT/ML learner, Language professional · Prerequisites: From counting to fractions: ℕ, ℤ and ℚ, √2 is not a fraction
Every fraction can be written as a decimal, and every school pupil has watched 1 ÷ 3 turn into 0.3333… without end. The goal of this lesson is to see why that always happens: the decimal of a fraction either stops or falls into a block of digits that repeats for ever, and, the other way round, every decimal that stops or repeats is a fraction. You need the first lesson's fractions in lowest terms and long division as you learnt it at school.
Some fractions give a decimal that ends: 1/2 = 0.5, 3/4 = 0.75, 3/8 = 0.375. Each is a fraction whose bottom can be turned into a power of 10:
3/8 = (3 × 125)/(8 × 125) = 375/1000 = 0.375
A decimal that ends like this is a terminating decimal. A power of 10 is made of 2s and 5s only (1000 = 2 × 2 × 2 × 5 × 5 × 5), so the trick works when the bottom of the fraction, in lowest terms, is also made of 2s and 5s only: 2, 4, 5, 8, 10, 16, 20, 25, and so on. Then multiplying top and bottom by enough 2s or 5s makes the bottom a power of 10.
A bottom with any other factor, a 3 or a 7, can never be turned into a power of 10, and the decimal never ends. (That this is really impossible, and not just hard, needs one fact stated here without proof, which a later lesson proves: a whole number splits into a product of prime numbers, whole numbers above 1 that only 1 and themselves divide, such as 2, 3, 5 and 7, in only one way.) So what does such a decimal do?
Divide 1 by 7 the way you learnt at school. At every turn you hold a remainder, multiply it by 10, write down how many 7s fit, and keep what is left over:
| Turn | Remainder × 10 | Digit | New remainder |
|---|---|---|---|
| 1 | 1 × 10 = 10 | 1 | 3 |
| 2 | 30 | 4 | 2 |
| 3 | 20 | 2 | 6 |
| 4 | 60 | 8 | 4 |
| 5 | 40 | 5 | 5 |
| 6 | 50 | 7 | 1 |
After six turns the remainder is 1 again, exactly where the division started. The machine has no memory but its remainder, so from here it must do the same six turns again, and again, for ever:
1/7 = 0.142857 142857 142857 …
A decimal that falls into a block of digits repeated for ever is a repeating decimal. The length of the block is its period: 1/7 has period 6, and 1/3 = 0.333… has period 1.
Dividing by 7, the only possible remainders are 0, 1, 2, 3, 4, 5 and 6. If a 0 ever appears, the division stops and the decimal terminates. If not, every remainder is one of just six values, 1 to 6. The starting remainder and the six that follow it are seven remainders drawn from six values, so two of them must be equal: within six turns, some remainder turns up for a second time.
This is the pigeonhole principle: put more pigeons than holes into the holes, and some hole holds two. It sounds too simple to matter, and it is the whole proof. Nothing about 7 was special: dividing by any whole number q, there are q − 1 non-zero remainders, so one repeats within q − 1 turns, and
the decimal of every fraction p/q stops or repeats, and the period is at most q − 1.
1/7 reaches that ceiling: it uses all six non-zero remainders before it comes back. Some fractions use fewer: 1/13 has period 6, not 12. And a decimal may wait a little before it settles: 1/6 = 0.1666… starts with a 1 that is never seen again, then repeats the 6.
The period of 1/7 is 6 because 999999 (six nines) is the first string of nines that 7 divides exactly: 999999 = 7 × 142857, and there is the block. In general, for a bottom with no factor 2 or 5, the period is the number of nines in the first string of nines it divides (stated here without proof). For 3 that is 9 itself, so the period is 1; for 13 it is 999999 = 13 × 76923, so the period is 6.
The road also runs the other way. Take x = 0.272727…, which repeats the block 27. Multiplying by 100 moves one whole block in front of the point:
100x = 27.272727…
x = 0.272727…
99x = 27
The third line is the first minus the second. The endless tails are the same, so they cancel completely, and 99x = 27. So x = 27/99, which is 3/11 in lowest terms.
The recipe works for any block: a block of k digits that repeats from the point
on is the block divided by k nines. And a decimal that waits before it repeats
needs one more shift. For x = 0.1666…, compare 100x = 16.666… with
10x = 1.666…: the tails cancel again, 90x = 15, and x = 15/90 = 1/6. Python's
Fraction confirms each one:
from fractions import Fraction
print(Fraction(142857, 999999)) # 1/7
print(Fraction(27, 99)) # 3/11
print(Fraction(15, 90)) # 1/6
Put the two directions together and you have the theorem in the title:
A number is rational exactly when its decimal stops or repeats.
A decimal that stops is a special case of one that repeats: 0.375 is 0.375000…, repeating the block 0.
Yes, and the recipe says so. Let x = 0.999…. Then 10x = 9.999…, subtract x, and the tails cancel: 9x = 9, so x = 1.
If that feels like a trick, here are two more ways to see it.
So 0.999… and 1 are two ways of writing one number, as 1/2 and 2/4 are. The same happens to every terminating decimal: 0.5 is also 0.4999….
Now write a decimal that obeys no block at all: a 1, then one 0, then a 1, then two 0s, then a 1, then three 0s, and so on.
0.1 0 1 00 1 000 1 0000 1 …
The runs of zeros keep growing, so no block of digits ever repeats, and by the theorem this number is not a fraction. The same goes for √2 = 1.41421356…: an earlier lesson proved it is not a fraction, so its digits never settle into a repeating block, however far you look.
That raises a question this lesson cannot answer. An endless decimal that never repeats is not a fraction, so what is it, and in what sense is it a number at all? The next lesson answers with the idea of a limit. Physics and Astronomy write every measured value as a decimal cut off at a stated number of digits; this lesson is why such a cut-off is a fraction close to the value, not the value itself.
Loading the exercise...
Ask a question about this content. The mentor explains and grounds its answer in what you are studying; asking is recorded as a learning signal, not a grade.
Off by default. The mentor always gets your file; this only decides whether your own copy stays here. Copies live in this browser only - they do not follow you to another device, and clearing site data removes them.
Two coding rungs in your browser, in a little Python (Beginner Python teaches it): first the long-division machine, then the same machine run backwards. Run checks the visible tests; Submit grades against hidden tests.
Loading exercise…
Loading exercise…
Loading your notes...