Pell's equation, also called the Pell–Fermat equation, is any
Diophantine equation
In mathematics, a Diophantine equation is an equation, typically a polynomial equation in two or more unknowns with integer coefficients, such that the only solutions of interest are the integer ones. A linear Diophantine equation equates to a ...
of the form
where ''n'' is a given positive
nonsquare integer
An integer is the number zero (), a positive natural number (, , , etc.) or a negative integer with a minus sign ( −1, −2, −3, etc.). The negative numbers are the additive inverses of the corresponding positive numbers. In the languag ...
, and integer solutions are sought for ''x'' and ''y''. In
Cartesian coordinates
A Cartesian coordinate system (, ) in a plane is a coordinate system that specifies each point uniquely by a pair of numerical coordinates, which are the signed distances to the point from two fixed perpendicular oriented lines, measured in ...
, the equation is represented by a
hyperbola
In mathematics, a hyperbola (; pl. hyperbolas or hyperbolae ; adj. hyperbolic ) is a type of smooth curve lying in a plane, defined by its geometric properties or by equations for which it is the solution set. A hyperbola has two pieces, ca ...
; solutions occur wherever the curve passes through a point whose ''x'' and ''y'' coordinates are both integers, such as the
trivial solution with ''x'' = 1 and ''y'' = 0.
Joseph Louis Lagrange proved that, as long as ''n'' is not a
perfect square, Pell's equation has infinitely many distinct integer solutions. These solutions may be used to accurately
approximate the
square root
In mathematics, a square root of a number is a number such that ; in other words, a number whose '' square'' (the result of multiplying the number by itself, or ⋅ ) is . For example, 4 and −4 are square roots of 16, because .
...
of ''n'' by
rational number
In mathematics, a rational number is a number that can be expressed as the quotient or fraction of two integers, a numerator and a non-zero denominator . For example, is a rational number, as is every integer (e.g. ). The set of all ra ...
s of the form ''x''/''y''.
This equation was first studied extensively
in India starting with
Brahmagupta
Brahmagupta ( – ) was an Indian mathematician and astronomer. He is the author of two early works on mathematics and astronomy: the '' Brāhmasphuṭasiddhānta'' (BSS, "correctly established doctrine of Brahma", dated 628), a theoretical tr ...
, who found an integer solution to
in his ''
Brāhmasphuṭasiddhānta
The ''Brāhmasphuṭasiddhānta'' ("Correctly Established Doctrine of Brahma", abbreviated BSS)
is the main work of Brahmagupta, written c. 628. This text of mathematical astronomy contains significant mathematical content, including a good underst ...
'' circa 628.
Bhaskara II in the 12th century and
Narayana Pandit
Nārāyaṇa Paṇḍita ( sa, नारायण पण्डित) (1340–1400) was an Indian mathematician. Plofker writes that his texts were the most significant Sanskrit mathematics treatises after those of Bhaskara II, other than the K ...
in the 14th century both found general solutions to Pell's equation and other quadratic indeterminate equations. Bhaskara II is generally credited with developing the
''chakravala'' method, building on the work of
Jayadeva and Brahmagupta. Solutions to specific examples of Pell's equation, such as the
Pell number
In mathematics, the Pell numbers are an infinite sequence of integers, known since ancient times, that comprise the denominators of the closest rational approximations to the square root of 2. This sequence of approximations begins , , , , an ...
s arising from the equation with ''n'' = 2, had been known for much longer, since the time of
Pythagoras
Pythagoras of Samos ( grc, Πυθαγόρας ὁ Σάμιος, Pythagóras ho Sámios, Pythagoras the Samian, or simply ; in Ionian Greek; ) was an ancient Ionian Greek philosopher and the eponymous founder of Pythagoreanism. His poli ...
in
Greece
Greece,, or , romanized: ', officially the Hellenic Republic, is a country in Southeast Europe. It is situated on the southern tip of the Balkans, and is located at the crossroads of Europe, Asia, and Africa. Greece shares land borders wi ...
and a similar date in India.
William Brouncker was the first European to solve Pell's equation. The name of Pell's equation arose from
Leonhard Euler
Leonhard Euler ( , ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who founded the studies of graph theory and topology and made pioneering and influential discoveries ...
mistakenly attributing Brouncker's solution of the equation to
John Pell.
[In Euler's (pp. 227ff), he presents a solution to Pell's equation which was taken from John Wallis' , specifically, Letter 17 () and Letter 19 () of:
* The letters are in Latin. Letter 17 appears on pp. 56–72. Letter 19 appears on pp. 81–91.
* French translations of Wallis' letters: Letter 17 appears on pp. 457–480. Letter 19 appears on pp. 490–503.
Wallis' letters showing a solution to the Pell's equation also appear in volume 2 of Wallis' (1693), which includes articles by John Pell:
* Letter 17 is on pp. 789–798; letter 19 is on pp. 802–806. See also Pell's articles, where Wallis mentions (pp. 235, 236, 244) that Pell's methods are applicable to the solution of Diophantine equations:
:* (On Algebra by Dr. John Pell and especially on an incompletely determined problem), pp. 234–236.
:* (Example of Pell's method), pp. 238–244.
:* (Another example of Pell's method), pp. 244–246.
See also:
* Whitford, Edward Everett (1912) "The Pell equation", doctoral thesis, Columbia University (New York, New York, USA)]
p. 52
*
History
As early as 400 BC in
India
India, officially the Republic of India (Hindi: ), is a country in South Asia. It is the List of countries and dependencies by area, seventh-largest country by area, the List of countries and dependencies by population, second-most populous ...
and
Greece
Greece,, or , romanized: ', officially the Hellenic Republic, is a country in Southeast Europe. It is situated on the southern tip of the Balkans, and is located at the crossroads of Europe, Asia, and Africa. Greece shares land borders wi ...
, mathematicians studied the numbers arising from the ''n'' = 2 case of Pell's equation,
:
and from the closely related equation
:
because of the connection of these equations to the
square root of 2
The square root of 2 (approximately 1.4142) is a positive real number that, when multiplied by itself, equals the number 2. It may be written in mathematics as \sqrt or 2^, and is an algebraic number. Technically, it should be called the princi ...
.
Indeed, if ''x'' and ''y'' are
positive integers
In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country").
Numbers used for counting are called '' cardinal ...
satisfying this equation, then ''x''/''y'' is an approximation of . The numbers ''x'' and ''y'' appearing in these approximations, called
side and diameter numbers, were known to the
Pythagoreans
Pythagoreanism originated in the 6th century BC, based on and around the teachings and beliefs held by Pythagoras and his followers, the Pythagoreans. Pythagoras established the first Pythagorean community in the ancient Greek colony of Kroton, ...
, and
Proclus
Proclus Lycius (; 8 February 412 – 17 April 485), called Proclus the Successor ( grc-gre, Πρόκλος ὁ Διάδοχος, ''Próklos ho Diádokhos''), was a Greek Neoplatonist philosopher, one of the last major classical philosophe ...
observed that in the opposite direction these numbers obeyed one of these two equations.
Similarly,
Baudhayana discovered that ''x'' = 17, ''y'' = 12 and ''x'' = 577, ''y'' = 408 are two solutions to the Pell equation, and that 17/12 and 577/408 are very close approximations to the square root of 2.
Later,
Archimedes
Archimedes of Syracuse (;; ) was a Greek mathematician, physicist, engineer, astronomer, and inventor from the ancient city of Syracuse in Sicily. Although few details of his life are known, he is regarded as one of the leading scientis ...
approximated the
square root of 3
The square root of 3 is the positive real number that, when multiplied by itself, gives the number 3. It is denoted mathematically as \sqrt or 3^. It is more precisely called the principal square root of 3 to distinguish it from the negative nu ...
by the rational number 1351/780. Although he did not explain his methods, this approximation may be obtained in the same way, as a solution to Pell's equation.
[.]
Likewise,
Archimedes's cattle problem
Archimedes's cattle problem (or the or ) is a problem in Diophantine analysis, the study of polynomial equations with integer solutions. Attributed to Archimedes, the problem involves computing the number of cattle in a herd of the sun god from ...
— an ancient
word problem about finding the number of cattle belonging to the sun god
Helios
In ancient Greek religion and mythology, Helios (; grc, , , Sun; Homeric Greek: ) is the god and personification of the Sun (Solar deity). His name is also Latinized as Helius, and he is often given the epithets Hyperion ("the one above") an ...
— can be solved by reformulating it as a Pell's equation. The manuscript containing the problem states that it was devised by Archimedes and recorded in a letter to
Eratosthenes
Eratosthenes of Cyrene (; grc-gre, Ἐρατοσθένης ; – ) was a Greek polymath: a mathematician, geographer, poet, astronomer, and music theorist. He was a man of learning, becoming the chief librarian at the Library of Alexandr ...
, and the attribution to Archimedes is generally accepted today.
Around AD 250,
Diophantus
Diophantus of Alexandria ( grc, Διόφαντος ὁ Ἀλεξανδρεύς; born probably sometime between AD 200 and 214; died around the age of 84, probably sometime between AD 284 and 298) was an Alexandrian mathematician, who was the aut ...
considered the equation
:
where ''a'' and ''c'' are fixed numbers, and ''x'' and ''y'' are the variables to be solved for.
This equation is different in form from Pell's equation but equivalent to it.
Diophantus solved the equation for (''a'', ''c'') equal to (1, 1), (1, −1), (1, 12), and (3, 9).
Al-Karaji
( fa, ابو بکر محمد بن الحسن الکرجی; c. 953 – c. 1029) was a 10th-century Persian mathematician and engineer who flourished at Baghdad. He was born in Karaj, a city near Tehran. His three principal surviving works a ...
, a 10th-century Persian mathematician, worked on similar problems to Diophantus.
In Indian mathematics,
Brahmagupta
Brahmagupta ( – ) was an Indian mathematician and astronomer. He is the author of two early works on mathematics and astronomy: the '' Brāhmasphuṭasiddhānta'' (BSS, "correctly established doctrine of Brahma", dated 628), a theoretical tr ...
discovered that
:
a form of what is now known as
Brahmagupta's identity. Using this, he was able to "compose" triples
and
that were solutions of
, to generate the new triples
:
and
Not only did this give a way to generate infinitely many solutions to
starting with one solution, but also, by dividing such a composition by
, integer or "nearly integer" solutions could often be obtained. For instance, for
, Brahmagupta composed the triple (10, 1, 8) (since
) with itself to get the new triple (192, 20, 64). Dividing throughout by 64 ("8" for
and
) gave the triple (24, 5/2, 1), which when composed with itself gave the desired integer solution (1151, 120, 1). Brahmagupta solved many Pell's equations with this method, proving that it gives solutions starting from an integer solution of
for ''k'' = ±1, ±2, or ±4.
[.]
The first general method for solving the Pell's equation (for all ''N'') was given by
Bhāskara II in 1150, extending the methods of Brahmagupta. Called the
chakravala (cyclic) method, it starts by choosing two relatively prime integers
and
, then composing the triple
(that is, one which satisfies
) with the trivial triple
to get the triple
, which can be scaled down to
:
When
is chosen so that
is an integer, so are the other two numbers in the triple. Among such
, the method chooses one that minimizes
and repeats the process. This method always terminates with a solution (proved by
Joseph-Louis Lagrange
Joseph-Louis Lagrange (born Giuseppe Luigi Lagrangia[Pierre de Fermat
Pierre de Fermat (; between 31 October and 6 December 1607 – 12 January 1665) was a French mathematician who is given credit for early developments that led to infinitesimal calculus, including his technique of adequality. In particular, he ...](_blank)
found how to solve the equation and in a 1657 letter issued it as a challenge to English mathematicians. In a letter to
Kenelm Digby,
Bernard Frénicle de Bessy said that Fermat found the smallest solution for ''N'' up to 150 and challenged
John Wallis
John Wallis (; la, Wallisius; ) was an English clergyman and mathematician who is given partial credit for the development of infinitesimal calculus. Between 1643 and 1689 he served as chief cryptographer for Parliament and, later, the royal ...
to solve the cases ''N'' = 151 or 313. Both Wallis and
William Brouncker gave solutions to these problems, though Wallis suggests in a letter that the solution was due to Brouncker.
John Pell's connection with the equation is that he revised
Thomas Branker's translation of
Johann Rahn
Johann Rahn (Latinised form Rhonius) (10 March 1622 – 25 May 1676) was a Swiss mathematician who is credited with the first use of the division sign, ÷ (a repurposed obelus variant) and the therefore sign, ∴. The symbols were used in '' ...
's 1659 book ''Teutsche Algebra''
['' Teutsch'' is an obsolete form of ''Deutsch'', meaning "German". Free E-book]
''Teutsche Algebra''
at Google Books. into English, with a discussion of Brouncker's solution of the equation.
Leonhard Euler
Leonhard Euler ( , ; 15 April 170718 September 1783) was a Swiss mathematician, physicist, astronomer, geographer, logician and engineer who founded the studies of graph theory and topology and made pioneering and influential discoveries ...
mistakenly thought that this solution was due to Pell, as a result of which he named the equation after Pell.
The general theory of Pell's equation, based on
continued fraction
In mathematics, a continued fraction is an expression obtained through an iterative process of representing a number as the sum of its integer part and the reciprocal of another number, then writing this other number as the sum of its integer ...
s and algebraic manipulations with numbers of the form
was developed by Lagrange in 1766–1769.
Solutions
Fundamental solution via continued fractions
Let
denote the sequence of
convergents to the
regular continued fraction for
. This sequence is unique. Then the pair
solving Pell's equation and minimizing ''x'' satisfies ''x''
1 = ''h
i'' and ''y''
1 = ''k
i'' for some ''i''. This pair is called the ''fundamental solution''. Thus, the fundamental solution may be found by performing the continued fraction expansion and testing each successive convergent until a solution to Pell's equation is found.
The time for finding the fundamental solution using the continued fraction method, with the aid of the
Schönhage–Strassen algorithm
The Schönhage–Strassen algorithm is an asymptotically fast multiplication algorithm for large integers. It was developed by Arnold Schönhage and Volker Strassen in 1971.A. Schönhage and V. Strassen,Schnelle Multiplikation großer Zahlen, ...
for fast integer multiplication, is within a logarithmic factor of the solution size, the number of digits in the pair
. However, this is not a
polynomial-time algorithm because the number of digits in the solution may be as large as , far larger than a polynomial in the number of digits in the input value ''n''.
[.]
Additional solutions from the fundamental solution
Once the fundamental solution is found, all remaining solutions may be calculated algebraically from
:
expanding the right side,
equating coefficients of
on both sides, and equating the other terms on both sides. This yields the
recurrence relation
In mathematics, a recurrence relation is an equation according to which the nth term of a sequence of numbers is equal to some combination of the previous terms. Often, only k previous terms of the sequence appear in the equation, for a parameter ...
s
:
:
Concise representation and faster algorithms
Although writing out the fundamental solution (''x''
1, ''y''
1) as a pair of binary numbers may require a large number of bits, it may in many cases be represented more compactly in the form
:
using much smaller integers ''a''
''i'', ''b''
''i'', and ''c''
''i''.
For instance,
Archimedes' cattle problem
Archimedes's cattle problem (or the or ) is a problem in Diophantine analysis, the study of polynomial equations with integer solutions. Attributed to Archimedes, the problem involves computing the number of cattle in a herd of the sun god fro ...
is equivalent to the Pell equation
, the fundamental solution of which has digits if written out explicitly. However, the solution is also equal to
:
where
:
and
and
only have 45 and 41 decimal digits respectively.
Methods related to the
quadratic sieve The quadratic sieve algorithm (QS) is an integer factorization algorithm and, in practice, the second fastest method known (after the general number field sieve). It is still the fastest for integers under 100 decimal digits or so, and is consider ...
approach for
integer factorization
In number theory, integer factorization is the decomposition of a composite number into a product of smaller integers. If these factors are further restricted to prime numbers, the process is called prime factorization.
When the numbers are s ...
may be used to collect relations between prime numbers in the number field generated by and to combine these relations to find a product representation of this type. The resulting algorithm for solving Pell's equation is more efficient than the continued fraction method, though it still takes more than polynomial time. Under the assumption of the
generalized Riemann hypothesis
The Riemann hypothesis is one of the most important conjectures in mathematics. It is a statement about the zeros of the Riemann zeta function. Various geometrical and arithmetical objects can be described by so-called global ''L''-functions, whic ...
, it can be shown to take time
:
where ''N'' = log ''n'' is the input size, similarly to the quadratic sieve.
Quantum algorithms
Hallgren showed that a
quantum computer
Quantum computing is a type of computation whose operations can harness the phenomena of quantum mechanics, such as superposition, interference, and entanglement. Devices that perform quantum computations are known as quantum computers. Thoug ...
can find a product representation, as described above, for the solution to Pell's equation in polynomial time. Hallgren's algorithm, which can be interpreted as an algorithm for finding the group of units of a real
quadratic number field, was extended to more general fields by Schmidt and Völlmer.
Example
As an example, consider the instance of Pell's equation for ''n'' = 7; that is,
:
The sequence of convergents for the square root of seven are
:
Therefore, the fundamental solution is formed by the pair (8, 3). Applying the recurrence formula to this solution generates the infinite sequence of solutions
:(1, 0); (8, 3); (127, 48); (2024, 765); (32257, 12192); (514088, 194307); (8193151, 3096720); (130576328, 49353213); ... (sequence (''x'') and (''y'') in
OEIS
The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It was created and maintained by Neil Sloane while researching at AT&T Labs. He transferred the intellectual property and hosting of the OEIS to the ...
)
The smallest solution can be very large. For example, the smallest solution to
is (, ), and this is the equation which Frenicle challenged Wallis to solve. Values of ''n'' such that the smallest solution of
is greater than the smallest solution for any smaller value of ''n'' are
: 1, 2, 5, 10, 13, 29, 46, 53, 61, 109, 181, 277, 397, 409, 421, 541, 661, 1021, 1069, 1381, 1549, 1621, 2389, 3061, 3469, 4621, 4789, 4909, 5581, 6301, 6829, 8269, 8941, 9949, ... .
(For these records, see for ''x'' and for ''y''.)
List of fundamental solutions of Pell's equations
The following is a list of the fundamental solution to
with ''n'' ≤ 128. For square ''n'', there is no solution except (1, 0). The values of ''x'' are sequence and those of ''y'' are sequence in
OEIS
The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences. It was created and maintained by Neil Sloane while researching at AT&T Labs. He transferred the intellectual property and hosting of the OEIS to the ...
.
Connections
Pell's equation has connections to several other important subjects in mathematics.
Algebraic number theory
Pell's equation is closely related to the theory of
algebraic number
An algebraic number is a number that is a root of a non-zero polynomial in one variable with integer (or, equivalently, rational) coefficients. For example, the golden ratio, (1 + \sqrt)/2, is an algebraic number, because it is a root of th ...
s, as the formula
:
is the
norm for the
ring