Vargaprakrti: The 'Pell Equation' 1,000 Years Before Pell
India's solution to one of mathematics' hardest problems
Discover the chakravala (cyclic method) for solving indeterminate quadratic equations, Bhaskara II's elegant solution predating Fermat and Pell by centuries.
Fermat's Challenge to England
In 1657, in his study in Toulouse, the French magistrate Pierre de Fermat dipped his pen and wrote a letter to the mathematicians of England with a challenge. Find positive integer solutions to the equation 61x² + 1 = y². He added, with a touch of malice, that he was not interested in the easy cases like x = 1 that work for small coefficients. He wanted real solutions, and he wanted them for a number, 61, that he had chosen because he knew the answer would be enormous. The smallest positive integer x that satisfies 61x² + 1 = y² is 226,153,980. The corresponding y is 1,766,319,049. Fermat already knew this. He wanted to see whether Europe could find it.

Europe could not. John Wallis and William Brouncker in England produced a method that worked in principle but missed the elegance Fermat was looking for. A century later, in 1768, Joseph-Louis Lagrange finally gave a systematic proof that solutions exist for every such equation. By then the problem had been named after the wrong man. In 1732 Leonhard Euler, reading Wallis's account of the Fermat-Brouncker correspondence, attributed the equation in passing to John Pell, an English mathematician whose actual contribution to the problem was essentially nothing. The name stuck. Every textbook on number theory still calls it the Pell equation.
The problem has a different name in Sanskrit. It is called vargaprakṛti, literally 'square-nature', the study of equations where a square quantity enters as the essential structure of the relationship. And by the time Fermat wrote his challenge, vargaprakṛti had been a solved topic in Indian mathematics for more than a thousand years. The cyclic method that closes it, the chakravāla, was already complete in Bhāskara II's Bījagaṇita, written in 1150 CE. The specific case Fermat chose, 61x² + 1 = y², was already worked out as an example in that same text, with the full answer Fermat thought nobody could find.
This lesson is about how that happened.
Brahmagupta Opens the Door

The first step in the Indian solution is Brahmagupta's. In the Brāhmasphuṭasiddhānta of 628 CE, he introduces what he calls the bhāvanā, or composition principle, for equations of the form Nx² + k = y². If you know two triples (x₁, y₁, k₁) and (x₂, y₂, k₂) that each satisfy the relation with their own remainder, you can compose them to produce a new triple whose remainder is exactly k₁k₂. The composition is a multiplication rule for solution triples, and it is the engine of everything that follows. Brahmagupta shows that if you can stumble on any starting triple at all, even one with a large remainder, you can chain compositions together to reach triples you could never find by direct search. He uses the method to crack 92x² + 1 = y², finding the smallest solution x = 120, y = 1151, and sets the problem as a public challenge to any mathematician who can match the feat within a year. The challenge was not rhetorical. Brahmagupta was serving notice that his school had a new tool.
What Brahmagupta does not yet have is a way to close the loop on every case. If your starting triple has remainder k equal to ±1, ±2, or ±4, he can finish the problem in one further step. For other values of k, his method sometimes stalls and sometimes requires a lucky guess. The bhāvanā is powerful but incomplete. It opens the door to vargaprakṛti as a solvable class of equations but leaves the last step occasionally blocked.
The Chakravāla: The Cycle That Closes the Loop
The missing step is supplied sometime around 950 CE by a mathematician named Jayadeva, whose work survives only through a quotation in a later commentary by Udayadivākara, and then developed into its final form by Bhāskara II in 1150. This is the chakravāla, the cyclic method. The name means 'wheel', and the method deserves it. You start with any easy triple for the target equation. You apply the bhāvanā to a carefully chosen auxiliary, with a simple rule for how to choose the next step. The auxiliary is picked so that the new remainder is always smaller in absolute value than the one you started with, and always divisible by the previous one. Each turn of the wheel brings the remainder closer to ±1, ±2, or ±4, at which point Brahmagupta's finishing moves take over. The chakravāla terminates in a finite number of steps for every positive non-square N. It does not search. It converges.

Bhāskara works the case 61x² + 1 = y² as a worked example. He begins with the obvious seed 8² = 64, writing it as 61·1² + 3 = 8². He applies one turn of the cycle and reaches a new triple. He applies another. After a small finite number of turns, the remainder reaches +1 and the loop terminates with x = 226,153,980, y = 1,766,319,049. The largest number in his calculation runs to ten digits, and he writes it out without apology, in a verse, in the Bījagaṇita, a book composed for the same daughter whose name, Līlāvatī, means 'the playful one'. The biggest Pell solution ever computed before the modern era sits inside a medieval Sanskrit textbook of algebra.
Why the Name Is Wrong, and Why It Matters
Euler's misattribution in 1732 was an accident, not a conspiracy. Fermat himself had no access to the Indian work. By the 17th century, Brahmagupta and Bhāskara were names in Sanskrit manuscripts that European mathematicians could not read and largely did not know existed. The Indian solution was not stolen. It was simply not present in the European conversation until Henry Thomas Colebrooke translated the Bījagaṇita into English in 1817, by which time Lagrange had already re-derived a weaker version of the result from scratch.
What Colebrooke's translation revealed was that Europe had spent a century rediscovering a method that was already complete in a 12th century Sanskrit textbook. And the comparison was not flattering. In 1975, the Danish-Swedish mathematician Clas-Olof Selenius proved that the chakravāla is not merely equivalent to the continued-fraction method Lagrange and his successors had developed. It converges faster on every tested case, reaching the solution in fewer steps than the European algorithm. The medieval Indian method is not a historical curiosity. It is the better algorithm.
That is the shape of vargaprakṛti. A class of equations Europe would not pose as a problem until 1657, would not solve systematically until 1768, and would not correctly attribute until Colebrooke in the 19th century. In Sanskrit the class already had a name, a theory, a public challenge problem, a worked example in verse form, and an algorithm faster than the one that eventually replaced it. The equation is still called 'Pell' in most textbooks. The method that actually solves it is called chakravāla, and it is one of the most elegant algorithms the medieval world produced.
Key figures
Brahmagupta
598 to after 668 CE, Bhillamāla (modern Bhinmal), Rajasthan
Bhāskara II (Bhāskarācārya)
1114 to c. 1185 CE, Vijjalavīḍa (near modern Bijapur), Karnataka
Jayadeva
c. 950 CE, India (precise location unknown)
Case studies
628 CE: Brahmagupta's Public Challenge on 92x² + 1 = y²
In 628 CE, at the astronomical observatory of Bhillamāla on the western edge of the Pratīhāra kingdom, Brahmagupta finished work on a verse treatise of more than a thousand stanzas, the Brāhmasphuṭasiddhānta. Chapter 18, on algebra, introduced the world to rules for arithmetic with zero, rules for negative numbers (dhana and ṛṇa), and, in its closing sections, the bhāvanā composition method for the equation Nx² + k = y². Brahmagupta did not present the bhāvanā as a theoretical curiosity. He embedded it in a public dare. He named the specific equation 92x² + 1 = y² and announced that any mathematician who could solve it within one year was a calculator worthy of the name. The smallest positive integer solution turns out to be x = 120, y = 1151. The numbers are small enough that a modern reader can check them in a minute with a calculator. What made the problem hard for Brahmagupta's contemporaries was not the size of the answer but the absence of any method to reach it without blind search.
Indian mathematical culture in the 7th century operated through a system of named schools and public knowledge contests, gaṇaka-sabhās, where scholars gathered under royal patronage to pose and solve problems in verse. A mathematician's reputation was established not by private notebooks but by public demonstrations. Brahmagupta's 92x² + 1 = y² challenge is a textbook example of this tradition. The problem was posed in a form that could be memorised in a single śloka, passed along oral networks, and carried from court to court. The answer, once found, could be verified by anyone with working arithmetic. Knowledge validation by community, not by peer review, produced the same rigour the modern academy now produces by different means.
Brahmagupta's bhāvanā solved 92x² + 1 = y² within his own school and set the agenda for Indian algebra for the next five hundred years. Every subsequent treatment of vargaprakṛti in Sanskrit, including Jayadeva's and Bhāskara II's, built on the composition rule Brahmagupta had formulated. When Fermat posed the 61x² + 1 = y² challenge to European mathematicians a thousand years later, the structural similarity to Brahmagupta's 92 challenge was not coincidence. Both men were using the same method, challenge followed by verification, to announce that their school had a new tool. The difference is that Fermat's Europe did not yet have the tool that Brahmagupta's Bhillamāla already had, and would not acquire it in its full form until Colebrooke translated Bhāskara in 1817.
A public challenge problem is a research tool, not a performance. Brahmagupta used the 92 equation to certify that his school had something new, and to invite others to confirm it. The culture of public verification produced a kind of peer review that did not require journals or proof systems. In your own work, try announcing a specific, checkable result before you announce a general method. You will attract exactly the scrutiny that will either break the work or validate it.
Brahmagupta's Brāhmasphuṭasiddhānta was translated into Arabic as the Sindhind in the 8th century at the court of Caliph al-Manṣūr in Baghdad. Every subsequent Arabic treatment of indeterminate analysis draws, directly or indirectly, on the text that contained the 92 challenge.
1150 CE: Bhāskara II Cracks 61x² + 1 = y² in a Daughter's Textbook
At the Ujjain observatory in the middle of the 12th century, Bhāskara II, head of the oldest astronomical institution in India, sat down to compose a pair of textbooks for students of mathematics. The first, Līlāvatī, covered arithmetic in verse, with problems about markets, debts, and fields, and was named for his daughter. The second, Bījagaṇita, covered algebra, and its final section was a chapter on Vargaprakṛti. In that chapter Bhāskara presented the chakravāla as a finished algorithm and worked a single example in detail. The example was 61x² + 1 = y². He began with the seed 8² = 64 and the triple (1, 8, 3), turned the wheel of the chakravāla a small finite number of times, and arrived at x = 226,153,980, y = 1,766,319,049, written out in full in Sanskrit numerals within a textbook a student might read at thirteen.
Indian pedagogical tradition places the hardest problems inside the most welcoming containers. Līlāvatī, Bhāskara's arithmetic textbook, is written in poetry addressed to a young reader, with problems that sound like games. Bījagaṇita continues the same style. The Vargaprakṛti chapter does not mark itself as the culmination of five centuries of research. It offers an algorithm, walks through one case, and moves on. A student encountering 61x² + 1 = y² in the Bījagaṇita is not told that this problem is hard. They are shown how to do it, and the difficulty only becomes visible in retrospect when the student tries to construct the same answer from scratch. This is the classical guru-śiṣya method of teaching. Make the impossible look routine, let the student absorb the method by following along, and let the appreciation of the achievement develop later.
The 61 example in Bhāskara's Bījagaṇita is the single most influential worked exercise in the history of vargaprakṛti. Five hundred years later, Fermat chose the same equation as a challenge to Wallis and Brouncker in 1657, almost certainly without knowledge of Bhāskara's solution. Wallis and Brouncker answered with a method that worked but lacked Bhāskara's structure. Lagrange produced a rigorous European proof in 1768. And in 1817 Colebrooke's English translation of the Bījagaṇita made Bhāskara's solution available to European readers for the first time, including the observation that 226,153,980 and 1,766,319,049 had been sitting inside a Sanskrit textbook for more than six centuries before Europe's best mathematicians were first shown the problem.
Elegance and difficulty are not opposites. The hardest algorithmic problems admit their most beautiful solutions when the right framework is found, and the right framework often looks embarrassingly simple in retrospect. Bhāskara's chakravāla is only a few lines of pseudocode. Its discovery took five centuries of Indian mathematical work. When a method seems too simple to be a discovery, ask how long it took to find it.
The answer Bhāskara computed, y = 1,766,319,049, would not be independently obtained in Europe until the 18th century. Fermat himself knew the answer in 1657 but did not publish his method, and Wallis and Brouncker's published approach required significantly more computation than the chakravāla.
1975: Clas-Olof Selenius Proves the Chakravāla Is Not Just Equal, It Is Faster
In 1975, the Danish-Swedish mathematician Clas-Olof Selenius published a paper in Historia Mathematica titled 'Rationale of the Chakravāla Process of Jayadeva and Bhāskara II'. The stated purpose of the paper was to give a modern mathematical analysis of the medieval Indian algorithm, translating it into the language of continued fractions and comparing it directly to the European methods developed by Lagrange and his successors. Selenius proved two things. First, he showed that the chakravāla can be re-expressed as a specific acceleration of the continued-fraction algorithm. Second, he proved that on every test case he examined, including Fermat's 61 and Brahmagupta's 92, the chakravāla reaches the solution in strictly fewer iterations than the Lagrange method. The medieval Indian algorithm was not merely equivalent to the modern one. It was measurably better.
Indian mathematical tradition treats elegance as evidence of correctness. A method that runs faster, uses less paper, and terminates more quickly is understood to be closer to the true structure of the problem, not merely a cosmetic improvement. Bhāskara himself would have recognised this standard. The chakravāla is built around a specific rule for choosing each auxiliary step so as to minimise the remainder, and the whole algorithm is shaped by the aesthetic principle that the wheel should turn as few times as possible before reaching its goal. Selenius's 20th century paper is in effect a verification of that medieval aesthetic, carried out in the technical language of a different era. The chakravāla is fast because its designers were optimising for something, and what they were optimising for turned out to be the right thing.
Selenius's paper is now the standard modern reference for the chakravāla. It has convinced the mainstream history of mathematics community that the Indian method is algorithmically superior to anything Europe produced on the same problem until the 19th century. It has also prompted a slow but visible change in terminology. Some current number theory textbooks now refer to the problem as the 'chakravāla equation' or at least note in their historical commentary that the cyclic method of Jayadeva and Bhāskara predates and outperforms the European approaches that superseded it. The equation is still most commonly called the Pell equation in English, but the claim that this name is historically accurate no longer has defenders.
An algorithm can be forgotten for nine hundred years and still turn out to be the best one. The chakravāla's superiority was not diminished by being ignored, and its recovery by Selenius does not change what it was when Bhāskara wrote it down. In your own work, do not assume that the standard modern approach is the best one just because it is standard. Older methods deserve to be tested against modern ones on their own terms, and the answer sometimes goes the other way.
Selenius's paper remains the single most cited modern scholarly work on the chakravāla and is the reference most often pointed to by historians of Indian mathematics when asked to substantiate the claim that the medieval Indian method was not merely equivalent to European approaches but actually faster.
Historical context
The classical Indian algebra tradition from the 7th to the 12th century CE, running from Brahmagupta at Bhillamāla through Jayadeva in the 10th century to Bhāskara II at Ujjain, and extending through the 17th to 19th century European rediscovery and misattribution of the same problem
Brahmagupta worked at the astronomical observatory of Bhillamāla, now Bhinmal in southwestern Rajasthan, under the patronage of the Chavda dynasty and later of the Gurjara-Pratihāras. Jayadeva's exact location is unknown, but the only surviving evidence of his work comes through Udayadivākara's commentary, composed in Kerala in the 11th century, suggesting that the chakravāla was already circulating through the southern mathematical network. Bhāskara II was born near Bijapur in what is now Karnataka and spent most of his career as head of the observatory at Ujjain, the oldest astronomical institution in India, which had been continuously active since at least the time of Varāhamihira in the 6th century. Across all three men, the institutional context is the same. Indian mathematics was produced inside stable astronomical observatories, funded by royal or temple patronage, with a continuous transmission from master to student that could sustain research programmes across generations.
Vargaprakṛti is the clearest single case in the history of mathematics where an Indian tradition was measurably ahead of Europe on a hard problem and where the gap was not closed until the 18th century. Unlike the invention of zero, which is philosophically enormous but conceptually simple, the chakravāla is a technical algorithm whose correctness and efficiency can be compared line by line with the European methods that eventually replaced it. The comparison is not close. Brahmagupta had the bhāvanā in 628. Bhāskara had the full chakravāla in 1150. Europe had an equivalent method in 1768 and a proof that the Indian version was faster in 1975. The facts leave no room for the usual softening language about 'precursors' and 'anticipations'. The Indian tradition had a working, proven, optimal algorithm for a thousand years before Europe developed its own.
Living traditions
The chakravāla is now a standard topic in modern number theory. Every serious textbook on algebraic number theory that treats the Pell equation includes at least a paragraph on Bhāskara II, and since Selenius's 1975 paper the algorithm has been recognised as computationally superior to the classical continued-fraction method. Modern cryptography, including the RSA and Diffie-Hellman systems that secure every online banking transaction, depends on the broader field of number theory whose indeterminate-equation tradition flows directly from Brahmagupta and Bhāskara. The chakravāla's specific role in contemporary mathematics is primarily pedagogical and historical, but the habit of thinking about quadratic forms as objects with their own compositional structure, which is what Brahmagupta's bhāvanā gave the world, is now a foundational idea in a dozen different research areas. Every student who takes a graduate number theory course reads the definition of a vargaprakṛti without being told that the Sanskrit word for it is vargaprakṛti. The equation they study is the same one Bhāskara solved for his daughter's generation.
- Bhinmal (ancient Bhillamāla), Brahmagupta's home: A small market town in southwestern Rajasthan that was the capital of the Chavda dynasty and later a regional centre under the Gurjara-Pratihāras. This is where Brahmagupta directed the astronomical observatory and wrote the Brāhmasphuṭasiddhānta in 628 CE, including the vargaprakṛti rules and the 92 challenge. The town preserves a number of medieval Jain temples and a memorial to Brahmagupta, and for any student of Indian mathematics it is the single most important pilgrimage site connected to the invention of algebra. The observatory itself has not survived, but the town retains the atmosphere of the semi-desert trading centre that produced it, and it is easy to imagine a 7th century scholar composing verse mathematics in its shaded courtyards.
- Ujjain Observatory and Mahakaleshwar area, Bhāskara II's working city: Ujjain was the official prime meridian of Indian astronomy, the zero-longitude point of the classical siddhānta system, and the site of an unbroken astronomical tradition from the time of Varāhamihira in the 6th century through Bhāskara II in the 12th and on into the Mughal era. Bhāskara II served as head of the observatory here, and the Bījagaṇita, including its Vargaprakṛti chapter, was composed in this city. The later Vedh Shala (observatory) built by Jai Singh II in the 18th century, while two centuries younger than Bhāskara, stands on the same tradition of instrumental astronomy and is the closest surviving structure a visitor can examine. Ujjain is also one of the four sites of the Kumbh Mela and the home of the Mahakaleshwar Jyotirlinga, giving the mathematician's city a depth that extends well beyond its calculations.
Reflection
- Where in your own work or field have you attached a person's name to an idea or method without ever checking who actually originated it?
- Why do you think the Indian tradition chose the image of a wheel, chakra, to name its most powerful algorithmic method?
- If an algorithm can be forgotten for nine hundred years and still turn out to be the best one known, what does that say about the relationship between time, progress, and truth in mathematics?