Why the expansion has to repeat
Worth reading first: One solution that makes all the others · A method that is allowed to miss.
One solution that makes all the others solved Pell’s equation by walking the continued fraction of to the end of its period, and a method that is allowed to miss solved it faster by a cycle of near misses. Both leaned on the same unproved promise: that the expansion of repeats, so that the walk has an end and the cycle closes.
The promise is Lagrange’s theorem of 1770, and the proof is a counting argument of the plainest kind. The interesting part is what the counting leaves behind — a finite set of states, arranged in cycles, with the expansion of running round exactly one of them.
The expansion as a machine with a state
To expand , take its whole part, 7, and invert what is left: . Rationalising gives , a number of the same kind. Its whole part is 1; subtract, invert, rationalise, and the result is again of the form with whole numbers and . Every complete quotient of has this shape, and the whole expansion can be run in whole numbers:
The division in the middle always comes out exact, because always divides , and only the very first whole part needs a square root. The pair is the whole state of the computation. Knowing it determines the next term and the next pair, and nothing else about the history matters.
The first state after the whole part, , is the number , whose whole part 1 is the next term; its conjugate will matter shortly. For the states run , , , , , , , , , , , and then again. From that point the terms must repeat, because the machine is in the state it was in before.
Why only finitely many states
The pairs are not merely whole numbers; after the first step they are confined. Each complete quotient is greater than 1, since it is the tail of a continued fraction, and its conjugate — the same expression with replaced by — lies between and 0. Those two facts together force
The band comes straight from the two facts. Write and . Their difference is , which exceeds 1 because and , so . Their sum is , which is positive because outweighs , so . The conjugate being negative forces ; being above forces ; and forces .
Why every complete quotient after the first has those two properties is a short induction. The first, , can be checked directly; and if a state is greater than 1 with its conjugate between and 0, then subtracting its whole part and inverting produces a number greater than 1 whose conjugate, the inverse of something below , lies between and 0 again. The property is inherited at every step, so the band holds the whole expansion after its first term.
That is the shaded band in the figure. For , can only be 1 to 7 and only 1 to 14, and the requirement that divide cuts the band’s cells down to 14 qualifying pairs. A machine with 14 possible states, run for 15 steps, must revisit one of them — the pigeonhole principle of more things than boxes — and from the first revisit on, everything repeats.
The same argument, with the band replaced by a finite set, is the reason the orbit that must come back comes back: any deterministic process on finitely many states is eventually periodic. The work is all in showing that the states are finite. Lagrange’s theorem extends the conclusion from to every quadratic irrational, , whose complete quotients have the same shape.
The same reason decimals repeat
The argument is the continued-fraction version of a fact met much earlier. Divide 1 by 7 by long division and the digits run , repeating with period 6. The state of long division is the remainder, and the remainders after each step are 1, 3, 2, 6, 4, 5 and then 1 again: a remainder on division by 7 can only be one of six nonzero values, so it must recur, and the digits repeat from there. That is arithmetic in numbers that wrap: each new remainder is ten times the last, reduced modulo 7.
The two facts are parallel, and so are their converses. A decimal expansion eventually repeats exactly when the number is a fraction, and a continued fraction eventually repeats exactly when the number is a quadratic irrational. For fractions the continued fraction does not repeat at all — it stops, because the Euclidean algorithm that computes it strictly decreases a pair of whole numbers until one of them reaches zero, as a fraction that never closes shows. Stopping, cycling and wandering are three different fates, and they sort numbers into rational, quadratic and everything else.
“Everything else” is not uniform. The continued fraction of runs , a pattern Euler found, with no repetition but a perfectly regular rule; the number of the curve that is its own slope is not quadratic, yet its expansion is anything but random. The continued fraction of shows no pattern at all that anyone has found. Periodicity picks out the quadratic irrationals exactly, and says nothing about the rest.
A palindrome in every period
The periods have more structure than repetition. For the period is 1, 4, 3, 1, 2, 2, 1, 3, 4, 1, 14. Leave off the last term and the rest reads the same backwards; the last term, 14, is twice the first whole part, 7. The same holds for , whose period 2, 1, 1, 2, 10 is a palindrome followed by twice 5, and for every up to 1,000, where the figure checked all 969 that are not squares.
The last term is explained by the state it returns to. The final state has , and its complete quotient is , whose whole part is 14 and whose fractional part is — exactly where the expansion began after taking off its first 7. Twice the first term marks the moment the machine is back at its start.
The palindrome is explained by reversal. Running the expansion of backwards corresponds to expanding over the conjugate of each state, and for the conjugates reproduce the same numbers in reverse order. So reading the period backwards is reading the same expansion from the other end, and the two readings must agree.
The states that repeat from the start
Some quadratic irrationals repeat from their very first term, and the golden ratio, , is the familiar case that the rectangle that eats itself builds. Évariste Galois proved in 1829, in his first published paper, exactly which ones: a quadratic irrational has a purely periodic expansion if and only if it is reduced — greater than 1, with its conjugate between and 0.
The figure plots all 14 reduced states of discriminant 61 by their value and their conjugate, and all of them fall in that strip. The golden ratio is reduced too: it is about 1.618, and its conjugate is about . is not, since its conjugate is , far below the strip; that is why its expansion has a first term, 7, standing outside the period, and why every expansion of has the shape .
Reducedness does a second job in the proof of periodicity. A reduced state has only one possible predecessor that is also reduced, because the conjugate’s position in pins down the term that was taken. So the step is reversible on reduced states, and a reversible process on a finite set cannot have a tail leading into a cycle — every state lies on a cycle. That is why the expansion of does not merely become periodic eventually, but repeats from its second term.
States the root never visits
Because the step is reversible, the reduced states split into disjoint cycles, and the expansion of is only one of them. For the other three states — , and in the grid — form a cycle of their own: they are the complete quotients of numbers like , whose expansion never passes through 's states. For there are three cycles, of 4, 6 and 6, and uses only the cycle of 4. For and a single cycle holds every reduced state.
These cycles were not invented for continued fractions. Gauss organised the reduced indefinite quadratic forms — expressions taking both positive and negative values, built from the same kind of whole-number data as the states here — into cycles of exactly this sort in 1801, and used them to sort forms into classes: two forms represent the same numbers under a change of variables when their reduced forms lie on the same cycle. The number of cycles is therefore closely tied to the number of classes of forms, and it is one of the routes by which the continued fraction of is connected to the class numbers that the chakravala essay ended on.
The count matters for Pell’s equation directly. When ’s cycle holds every state, a single cycle carries all the arithmetic of the discriminant; when it does not, the other cycles describe numbers of the form that ’s own convergents never produce.
How long the period can be
The counting argument gives a bound immediately: the period is at most the number of reduced states, and the band has room for no more than about of them. That bound is honest and nearly useless. The actual periods up to 1,000 are much shorter, scattered below a ceiling that grows roughly like : the longest is 60, at , and none exceeds 1.98 times in this range.
The scatter is wide. Next to with its period of 60 sit values with periods of 1 or 2, such as and , because one less than a square always has period 2: . Nothing about the size of alone predicts the period. It is known that the period can never be much longer than , a bound that comes from the same class number formula mentioned above, but which come close to it is irregular.
The odd periods, 152 of the 969, are the ones the Pell essay singled out: an odd period is exactly the condition for to have a solution, and for the chakravala to pass through a miss of on its way.
Where Pell’s equation sits on the cycle
The cycle also shows where the solutions of Pell’s equation come from. At each state, the convergent reached so far, , satisfies for the of the next state, with the sign alternating. So the value of along the convergents is the sequence of ’s read off the cycle, with signs: for the ’s run 12, 3, 4, 9, 5, 5, 9, 4, 3, 12, 1, and the convergents’ values run , 3, , 9, , 5, , 4, , 12, .
A value of appears exactly where , and within a period that happens only at the last state, . The solution of Pell’s equation is the state on the cycle whose is 1, reached once per period. Whether it gives or depends on whether the period is even or odd: for , with period 11, the first return gives , and the second, 22 convergents in, gives — the 22 that the chakravala essay compared its 13 steps against.
That also explains the palindrome’s use to anyone computing by hand. The ’s along the cycle read the same backwards, just as the terms do, so the middle of the period already determines the whole; it is the same symmetry the chakravala’s sequence of misses displayed, seen here in the states rather than in the misses.
What periodicity buys
A guarantee that searching ends. Both the continued-fraction walk and the chakravala are searches that stop when something returns to 1. Periodicity is what promises the return: the state that means “solved” is on the cycle, and the cycle is finite.
A certificate that a number is quadratic. Euler proved the converse of Lagrange’s theorem: any eventually periodic continued fraction is a quadratic irrational. So periodicity characterises exactly one class of numbers, and a long enough computed expansion that has visibly not repeated is evidence — though never proof — that a number is not quadratic.
And a finite description of an infinite object. The expansion of is infinite, but eleven terms and a promise describe all of it, in the same way that the orbit written as a word describes a periodic orbit of a map by one repeating block. Continued fractions are themselves the orbits of a map — take the reciprocal of the fractional part — and the quadratic irrationals are exactly its eventually periodic points.
Every state listed, and Gauss’s forms only quoted
Every state was enumerated, not argued about. The grid, the cycles and the reduced strip were computed by listing every pair in the band and following the step; the palindrome and the final term were checked for all 969 non-square up to 1,000. The reasons given — reversal for the palindrome, reversibility for pure periodicity — are the standard proofs, stated in words rather than drawn.
The correspondence with quadratic forms is described, not computed. That the cycles of reduced states match Gauss’s cycles of reduced forms, and count classes of forms, is quoted from the theory; no figure checks it against an independent count of classes.
And the period bound is observed up to 1,000. The ratio 1.98 is the largest in the range drawn; the theoretical bound of order is stated and not shown.
Still open: whether a cube root’s expansion stays small
Quadratic irrationals are the numbers whose continued fractions repeat. For the next simplest numbers — roots of cubic equations, such as , which begins — nothing comparable is known. It is not known whether the terms of the continued fraction of are bounded, or whether they grow without limit, although computations of millions of terms find the occasional very large one and suggest they behave like the terms of a randomly chosen number. For no algebraic number of degree three or more has anyone determined whether its terms are bounded.
Finite states, forced repetition
The continued fraction of repeats for the same reason a clock does: its state is a small amount of whole-number information, and there are only so many states it can be in. The states form cycles because the step can be run backwards, the period is a palindrome because running it backwards gives the same numbers, and the cycles that does not visit are the other classes of forms of the same discriminant.
To prove that a process repeats, find what it remembers and show that it can only remember finitely much. The repetition then comes for free, and the structure of the finite set says far more than the repetition alone.
What links here
Computed from the collection, not written here: the essays that point at this one.
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- How close a fraction can get — both name continued fractions, pigeonhole principle
- On the circle and never home — both name conjugate, pigeonhole principle
- The square that cannot shrink — both name continued fractions, pell equation
Named objects
A dashed tag is an object no other essay names yet.
ConjugateContinued fractionsPell equationPeriodicityPigeonhole principleQuadratic formQuadratic irrational