A method that is allowed to miss
Worth reading first: One solution that makes all the others.
One solution that makes all the others showed that every whole-number solution of is a power of the smallest, and found the smallest by walking the convergents of the continued fraction of . For that walk ends at the pair 1,766,319,049 and 226,153,980, after 22 convergents. It also mentioned, in a sentence, that Indian mathematicians had a faster method six centuries before Europe had a slow one.
That method is worth running in full, because its central idea is counterintuitive. It does not try to solve the equation at each step. It keeps a pair that fails by a small amount and improves the failure, and it is exactly that permission to miss that lets it move quickly.
Starting from a near miss
The method is the chakravala, the “cyclic” method, described by Jayadeva in the eleventh century and made famous by Bhāskara II’s Bījagaṇita of 1150, whose showpiece example was exactly . It begins with the obvious approximation: the square nearest to 61 is , so . The pair does not solve the equation. It misses by .
Every row of the table is such a near miss: a pair of whole numbers and and the amount by which they fail. The figure checks each row in exact arithmetic. What changes from row to row is — 3, then , , 5, 4, , , and back through the same sizes in reverse — and the method stops the moment reaches 1.
The pairs themselves grow fast: 8, 39, 164, 453, and eventually the ten-digit answer. The misses never grow at all. After the first step, stays below at every row, and that combination — numbers growing, errors staying small — is what a good approximation scheme looks like.
Combining two misses
The step rests on an identity Brahmagupta stated in 628, which the Pell essay met as the multiplication of solutions. Any two near misses can be combined:
The misses multiply. Composing two solutions of the equation gives a solution, because ; composing near misses gives a near miss whose error is the product of theirs.
On its own, composing makes things worse: the errors multiply. The chakravala composes the current near miss with a very simple helper, , whose miss is , and then does something the identity does not suggest. It chooses so that the result can be divided by , which divides the new miss by and leaves .
In the first step, composed with gives , missing by . All three numbers are divisible by 3, so divided by 3 is , and divided by 9 is . The new row misses by 4 instead of 3 — slightly worse in size, but on a pair five times larger, which makes it a far better approximation to as a fraction: against .
The choice of m
Two conditions pick the helper, and both are in the table’s second column. First, must make divisible by . That is a condition on modulo — the arithmetic of numbers that wrap — and it is enough for everything else to divide as well. The reason is a one-line identity: , so once divides , it divides , and since shares no factor with it divides . The new miss is then automatically a whole number.
Second, among the admissible values of , the method takes the one with closest to . That makes as small as the congruence allows, and since the new miss is , it keeps the new miss small. For the admissible values run through 6, 7, 8 and 9 — always one of the whole numbers whose squares straddle 61 most closely.
The second step shows the rule at work. From the row , missing by , the helper must make divisible by 4. Since 39 leaves a remainder of 3 on division by 4 and 5 leaves 1, must leave a remainder of 1: the candidates are 1, 5, 9, 13 and so on. Of these, 9 has its square closest to 61, since 81 − 61 = 20 while 25 − 61 = −36. So , and composing gives , missing by −4 × 20 = −80. Dividing the pair by 4 gives , and dividing the miss by 16 gives — the third row of the table.
The two conditions pull in different directions, and the method needs both. Divisibility alone would allow huge helpers and huge misses; closeness alone would give misses that are not whole numbers. Together they give a sequence of small whole-number misses on rapidly growing pairs, and the cycle closes when the miss comes back to 1.
A shortcut from −1
Six steps into the table for , the miss is : . That row is not a solution, but composing it with itself squares its error, and .
That is the fundamental solution, reached from the halfway row without the last seven steps. Brahmagupta already had rules of this kind: from a miss of square once; from a miss of square and halve; from a slightly longer formula finishes the job. The second half of the table for runs the misses back in reverse order — , 4, 5, , , 3, 1 — which is the cycle closing on itself, and the shortcut simply jumps across it.
The same halfway shortcut explains a pattern from the Pell essay. An equation whose miss reaches along the way is one for which has a solution — the row itself is one — and that happens exactly for the equations whose continued fraction has an odd period.
A second equation
For the miss never reaches , and the continued fraction of has an even period of 16, so has no solution. The chakravala still reaches the fundamental solution, , in 9 steps. Its misses run 6, , 9, 3, 2 and back, symmetric about the middle row just as for 61.
The middle row has a miss of 2, and Brahmagupta’s second rule applies there. The row is . Composing it with itself gives , missing by 4, and halving both numbers — which divides the miss by 4 — gives with a miss of 1. The fundamental solution is again reached from the middle of the cycle.
The symmetry of the misses is no accident. It is the same palindrome that appears in the period of the continued fraction of , which reads the same forwards and backwards before its last term, and the halfway row sits where the sequence turns round.
Keeping the miss small
Dividing each miss by puts four equations on one scale, and all four runs stay strictly between and after the first step. The same bound held in every equation from to when the method was run on all of them. The new miss is , and an admissible can always be found within about of , because the admissible values are spaced apart. That makes at most about , and dividing by leaves a new miss of roughly at most. That is a sketch of why the bound holds, not a proof of the strict inequality the runs display.
Small misses matter because a near miss makes an excellent approximation to : dividing by gives , and since is close to , the error in is about . A classical theorem makes the conclusion exact: whenever , the fraction is one of the convergents of . Every row the chakravala produces after the first is a convergent, so it walks the same road as the continued fraction — it just does not stop at every milestone.
Read as fractions, the rows for close in fast. is off from by about a hundredth; by about seven ten-thousandths; by about one ten-thousandth. How close a fraction can get shows that every irrational number has infinitely many fractions within of it, and the chakravala’s rows land inside half of that allowance, which is what being a convergent guarantees.
Fewer steps, every time
Run both methods on every equation with up to 100 that is not a square. They find the same fundamental solution every time, and the chakravala takes fewer steps on all 90 of them: 240 steps in total against 476 convergents, roughly half. The saving is largest exactly where the continued fraction’s period is long, which is where the fundamental solution is large and the problem is hard.
The reason became clear only in the twentieth century. The ordinary continued fraction always rounds down, taking the whole part of each complete quotient. The chakravala’s choice of nearest to corresponds to rounding to the nearest whole number, sometimes up, and a continued fraction that rounds to the nearest integer reaches the same convergents while skipping some of the intermediate ones. Rounding to the nearest is never worse and usually better, and Bhāskara’s method had been rounding to the nearest all along.
The tree of every fraction exactly once makes the saving visible. The path down that tree towards turns right seven times, then left once, then right four times, then left three times, and so on: the lengths of the runs are the terms of the continued fraction, , and the convergents are the fractions where the path changes direction. The ordinary expansion reports every change of direction — 7/1, 8/1, 39/5, 125/16, 164/21. The chakravala’s rows are 8/1, 39/5, 164/21: it passes 7/1 and 125/16 without stopping, and on longer periods it skips more.
The same idea recurs across number theory. The composition identity is a law for combining numbers of the form , and two squares and a lattice uses its cousin, , to build sums of two squares from smaller ones — the same trade of a hard target for a product of easy ones.
Why it has to stop
The Indian texts give the method and a great many worked examples, but no proof that the cycle always returns to a miss of 1. That proof came much later, and it rests on the same fact that makes the continued fraction periodic: the state of the computation is a small amount of whole-number data confined to a finite range, so it must repeat, and when it repeats the miss has come back to where it started. Why the expansion has to repeat makes that argument for the continued fraction and draws the finite set of states it moves through.
The chakravala’s structure also has a shape that a fraction that never closes would recognise: at every step it takes the best available whole-number approximation and carries the remainder forward. What distinguishes it is only which approximation counts as best.
It is also the mirror image of a proof by descent. The square that cannot shrink assumes an exact solution of and produces a smaller one, and a smaller one, until whole numbers run out — so no exact solution exists. The chakravala starts from an inexact solution and produces larger ones whose errors stay bounded, until one of them is exact — so an exact solution is found. One method shrinks a solution into a contradiction; the other grows a near miss into an answer, and both depend on a quantity that can only take finitely many values along the way.
A method from the other side of the world
Fermat posed the case to English mathematicians in 1657 as a challenge, apparently because he knew the answer was large, and Brouncker and Wallis solved it with methods related to continued fractions. Bhāskara had published the same answer, by the cyclic method, five centuries earlier, and Jayadeva’s description of the method is older still. The equation carries the name of John Pell because of a misattribution by Euler, as the Pell essay recounts; the method that solves it most efficiently by hand carries no European name at all.
The chakravala was not a lucky trick. It encodes three ideas that European mathematics reached separately and later: a composition law for near misses, a rounding rule that picks the nearest approximation, and the periodicity that guarantees termination. Brahmagupta’s identity is the first; the choice of is the second; and the symmetric cycle of misses is the visible trace of the third.
Generating an infinite family of solutions from one by a fixed rule is a pattern that recurs well beyond Pell’s equation. A tree that holds every triple produces every Pythagorean triple from by three matrices, just as powers of the fundamental solution produce every solution here. The chakravala sits one level earlier: it is the rule that finds the seed.
A bound on the miss that was observed, not proved
Every table was computed, not quoted. Each row is a near miss checked in exact whole-number arithmetic, each division was checked to leave no remainder, and each final answer was checked against the continued fraction’s; but the tables stop at the first solution, and the infinite family of later solutions is the Pell essay’s, not these figures’.
The bound on the miss is observed. That stays below after the first step held for every up to 1,000; the figure shows four of them. The argument above says why the choice of keeps small, but it is a sketch, not a proof of the exact bound.
And the count stops at 100. The comparison of steps against convergents is shown for 90 equations and was run to 1,000 with the same result; beyond that it is the theory of nearest-integer continued fractions, not the figure, that says it continues.
Still open: how large the first solution can be
The chakravala finds the fundamental solution faster than the continued fraction, but both take a number of steps that grows with the period of , and both must write down the solution, which can have enormously many digits. The logarithm of the fundamental solution, the regulator, is linked to the class number by Dirichlet’s class number formula, and the product of the two grows, on a logarithmic scale, like . How that product divides between the two factors is not understood: it is conjectured that for most prime the class number is 1 and the regulator is as large as it can be, but it is not even known whether infinitely many real quadratic fields have class number 1.
Aim beside the target
The cyclic method solves an equation by never trying to solve it until the last step. It keeps an approximation that misses by a small amount, combines it with a helper chosen so that the miss can be divided out, and lets the misses cycle until one of them is exactly 1. The approximations grow exponentially while the misses stay small, which is what makes the method fast.
When a direct search for an exact solution is slow, look for an approximate object that can be improved by an exact operation. Near misses compose; exact solutions are just the near misses whose miss happens to be 1.
What links here
Computed from the collection, not written here: the essays that point at this one.
Reads more easily once this is understood
Essays that name this one as worth reading first.
Named objects
A dashed tag is an object no other essay names yet.
AlgorithmContinued fractionsConvergentFundamental solutionModular arithmeticPell equationUnit