The Daily Reckoning
Why Does a Repeating Decimal Always Hide a Fraction?
A repeating decimal is a long-division machine revisiting an old remainder. That loop proves the number is an exact fraction, not an approximation.
- Difficulty
- Foundational
- Area
- Numbers and algebra
- Reading time
- 9 minutes
- Prerequisites
- Fractions and long division · Multiplication by powers of ten · Solving a one-step equation
Divide by and the decimal refuses to end:
The six digits return in the same order forever. The repetition is not a coincidence in the digits. Long division has returned to a remainder it has seen before. Once the same remainder returns, every later decision repeats too.
The interactive remainder machine makes that loop visible. Start with , then compare it with a fraction that has a shorter loop and one whose decimal terminates. Each card records one exact long-division step.
Long division, one state at a time
Follow the remainder
1/7 = 0.142857…
What to notice: a repeated remainder creates a loop because it forces the same next digit and next remainder. Remainder zero ends the process. The cards use words, equations, and borders as well as color.
The claim in precise form
A rational number is a number that can be written as
where and are integers and .
A decimal is eventually periodic when some finite block of digits repeats forever after a possible nonrepeating beginning. For example,
has the nonrepeating beginning and the repeating block . A terminating decimal counts as eventually periodic if zeros are appended forever: .
The central theorem is an exact two-way statement:
A real number is rational if and only if its decimal expansion terminates or eventually repeats.
The two directions need different explanations. Long division proves that fractions must loop. Multiplication by a power of ten followed by subtraction turns any repeating decimal back into a fraction.
Why a fraction must terminate or repeat
Suppose and we calculate by long division. At every step, the current remainder is one of
There are only possible remainders.
For , the first step multiplies the remainder by :
The quotient digit is , and the next remainder is . The next step is
so the next digit is and the next remainder is . Continuing gives the remainder path
The path has returned to remainder . The same input to long division produces the same quotient digit and the same next remainder, so the six-digit cycle starts again.
The general argument is just as tight. If a remainder becomes , the decimal terminates. If no remainder becomes , long division keeps choosing from the finite list . Eventually one remainder must recur. From that recurrence onward, the digits repeat.
This is the pigeonhole principle inside long division: an endless process with only finitely many possible states must revisit a state.
Worked example: turn a mixed decimal into a fraction
Let
The repeating block begins after two decimal places and contains one digit. First multiply by to move the nonrepeating beginning left of the decimal point:
Now multiply the original number by . This moves one additional digit—the entire repeating block—left of the decimal point:
The infinite tails are now identical. Subtract the first shifted equation from the second:
Divide both sides by :
No infinite approximation remains. The repeating decimal is exactly .
The same calculation gives a reusable formula. Suppose a decimal has nonrepeating digits followed by a repeating block of digits. Let be the integer formed by the first digits, and let be the integer formed by the first digits. Then
For , we have , , , and , so
A pure repeating block has a denominator made of nines
When repetition begins immediately after the decimal point, . A block of digits represents an integer , and the formula becomes
The denominator is a row of nines. Therefore
and
The leading zero in the block matters because the period contains three positions, so the first denominator is , not .
This calculation also settles the famous edge case:
The symbols and are two decimal representations of the same real number. There is no positive gap between them waiting beyond every finite decimal place.
The idea developed across several mathematical cultures
Decimal fractions were not produced by one isolated inventor. Positional calculation grew through Indian arithmetic and its transmission and development in the Islamic world. MacTutor identifies a tenth-century text by Abu’l-Hasan al-Uqlidisi as the earliest known direct treatment of decimal fractions. Al-Uqlidisi wrote for working arithmetic, including calculations performed without a dust board, so the notation belonged to practical computation as well as theory.
In the fifteenth century, the astronomer and mathematician Jamshid al-Kashi gave a systematic account of decimal fractions and used them in high-precision numerical work. Astronomy, surveying, commerce, and measurement all rewarded notation that made fractional calculation behave more like whole-number calculation.
Simon Stevin’s short 1585 book De Thiende—The Tenth—helped make decimal fractions widely usable in Europe. Stevin advocated decimal arithmetic for measurement, money, and everyday calculation. That influence once led European histories to credit Stevin with invention; later scholarship restored the much earlier work of al-Uqlidisi, al-Kashi, and other mathematicians. MacTutor’s history of fraction notation and the Mathematical Association of America’s account of research on Islamic mathematics trace that correction.
Where the loop matters now
The theorem distinguishes a number from the notation used to store it. The fraction terminates in base ten, but its binary expansion repeats. Most computer hardware therefore stores the nearest available binary floating-point value rather than itself. The official Python floating-point tutorial uses to explain why a displayed decimal can hide a nearby binary fraction and why small rounding effects are inherent in binary floating-point arithmetic.
Programs that require exact ratios can store a numerator and denominator instead. Python’s fractions module implements that approach. Programs that need familiar base-ten rounding rules—for example, some financial calculations—can use decimal arithmetic with an explicit precision and rounding policy. The choice of representation is part of the mathematics of the program, not a formatting detail.
The length of a repeating block also comes from remainder arithmetic. The six-step loop for is a cycle of powers of modulo . That connection leads directly to modular arithmetic, full-reptend primes, and divisibility tests. The earlier Reckoning How Can 7²²² Fit on a Clock? develops the same remainder arithmetic from a different direction.
Try two
Problem 1: Convert to a fraction in lowest terms.
The repeating block has three digits, so multiply by :
Subtract the first equation from the second:
Therefore
Both numerator and denominator are divisible by :
Problem 2: Show that is exactly .
There are two nonrepeating digits and one repeating digit. Let
Then
and
Subtract:
Thus
Long division checks the result: because the remainder becomes after the second digit and then stays , producing another at every later step.
The idea to keep
A repeating decimal is finite-state arithmetic in disguise. A fraction’s long division can use only finitely many remainders, so it must stop or revisit one; a repeated digit block can be shifted and subtracted, leaving an exact ratio of integers.
Continue with modular arithmetic to study remainder cycles directly, or with geometric series to reach the same fractions by adding an infinite sequence of shrinking terms.
Sources
- University of Kentucky, Rational and irrational numbers, including the proof that rational numbers are exactly the numbers with eventually periodic decimal expansions.
- MacTutor History of Mathematics, Al-Uqlidisi and Al-Kashi.
- MacTutor History of Mathematics, Earliest Uses of Symbols for Fractions.
- Mathematical Association of America, Our Recent Work on History of Mathematics in the Islamic World.
- Python documentation, Floating-Point Arithmetic: Issues and Limitations and
fractions— Rational numbers.