Pell Equation
Summary: The Pell equation (or equivalently ) is a Diophantine equation whose integer solutions are the key ingredient in generating infinite families of integer solutions to ; Euler describes Pell’s iterative descent method for finding the minimal positive solution.
Sources: chapter-2.0.6, chapter-2.0.7, chapter-2.0.11, chapter-2.0.12, chapter-2.0.13, additions-2, additions-7, additions-8
Last updated: 2026-05-10
Definition
For a given integer that is positive and not a perfect square, the Pell equation is:
The trivial solution , always exists. The problem is to find the minimal positive solution with .
Why It Matters
The Pell equation is the engine of ch2.0.6-integer-solutions-quadratic-squares: if is any integer solution to , and is any solution to , then
is also an integer solution to . Iterating this map from a single seed produces an infinite sequence of solutions. (source: chapter-2.0.6, §82–86)
Exclusion Conditions (§97)
The equation has no positive integer solution when:
- : The right side would grow too fast for fixed .
- is a perfect square: is then a perfect square, and no perfect square can be increased by 1 to yield another perfect square in integers. (If then is between two consecutive squares and for .)
For all other positive integers , a solution always exists.
Pell’s Method (§98–104)
Attribute: Euler credits this to John Pell (1611–1685), an English mathematician. The name has stuck, although the equation predates Pell.
Algorithm (for a given positive non-square ):
- Let . The root satisfies for .
- Write or depending on whether or .
- Square, simplify; express in terms of and .
- Bound relative to to pick the next substitution (for appropriate integer ).
- Repeat until a radical appears — the same structure as the original problem.
- Set , recover the base values, and trace back through the chain.
The method always terminates because the sequence of “active variables” is strictly decreasing at each step (§104).
Closed-Form Solutions Near Perfect Squares (§107–111)
| Identity used | |||
|---|---|---|---|
Recurrence from the Minimal Solution (§95)
Once the minimal Pell pair is known, the sequence of -values satisfying obeys the linear recurrence
and the same recurrence holds for the -values independently. This means only the first two terms (the seed and the first new value ) are needed to extend the sequence indefinitely.
Selected Minimal Solutions
| 2 | 2 | 3 |
| 3 | 1 | 2 |
| 5 | 4 | 9 |
| 7 | 3 | 8 |
| 13 | 180 | 649 |
| 29 | 1820 | 9801 |
| 61 | 226153980 | 1766319049 |
The extreme case is famous: its minimal solution has .
Lagrange’s Existence Proof (Add. II, Art. 37)
Euler’s iterative method finds the minimal Pell solution but assumes one exists. The first rigorous proof of existence is Lagrange’s, in Additions Chapter II:
Theorem: For every positive non-square integer , the equation has a positive integer solution.
Proof: Apply the binary-quadratic-form algorithm of Add. II, Art. 33 (see binary-quadratic-forms) to , generating the auxiliary sequences , The fundamental identity together with the alternating-sign argument (Add. II, Art. 34) bounds and . Pigeonhole on the finite integer lattice forces to recur; the period closes with , giving
This is the desired Pell solution. ∎
See periodicity-quadratic-irrationals for the underlying periodicity theorem.
Convergent Characterization (Add. II, Art. 38)
Theorem: If with has a positive integer solution, then must be a principal convergent of .
Proof sketch: From , factor as . Then
(using and ). This is the Hurwitz-style criterion: any rational with is necessarily a principal convergent of . ∎
Consequence: To search for solutions of with small, one only needs to scan the CF expansion of and check each convergent — a far more efficient search than brute force. The full table of CFs for () is in square-root-continued-fractions.
Composition Law (Brahmagupta’s Bhāvanā)
The set of solutions to is multiplicatively closed under the composition law from the brahmagupta-fibonacci-identity (with ):
So if and both satisfy the Pell equation, then does too. Iterating from the minimal solution generates all solutions — the standard modern approach. Euler hints at this in ch2.0.11-quadratic-form-factorization §176.
This composition also explains the surprise of ch2.0.13-impossibility-biquadrate-sums §211: has infinitely many solutions because (a Pell-type auxiliary) has infinitely many.
Closed Form via Powers (Add. VII, Art. 75)
Let be the least positive solution of . Then all integer solutions are or, separating rational and irrational parts, Lagrange proves this exhausts all solutions: any putative intermediate between consecutive powers and would yield a , contradicting minimality.
The binomial expansion gives which is the same as the ch2.0.12-quadratic-form-as-power machinery applied to the form at the value . (source: additions-7, Art. 75)
Historical Attribution (Add. VIII, Art. 85)
Lagrange traces the method:
- Fermat posed the problem as a challenge to English mathematicians.
- Brouncker found the iterative solution algorithm.
- Wallis published it in his Algebra (1685, Ch. 98).
- Euler rediscovered and extended it; the misnomer “Pell’s equation” comes from Euler.
- Lagrange gave the first rigorous existence proof (Mélanges de Turin vol. IV; cleaner version in Add. II, Art. 37).
Lagrange also exhibits a counterexample in add8-pell-method-critique showing that the freedom of approximation direction (claimed by Wallis and Euler) can prevent the algorithm from terminating: for , taking the first limit “in minus” and all subsequent limits “in plus” produces a sequence whose leading coefficient never reaches . See wallis-brouncker-method.
Related pages
- ch2.0.7-pell-equation-method
- ch2.0.6-integer-solutions-quadratic-squares
- ch2.0.11-quadratic-form-factorization
- ch2.0.12-quadratic-form-as-power
- ch2.0.13-impossibility-biquadrate-sums
- brahmagupta-fibonacci-identity
- quadratic-residues
- indeterminate-analysis
- linear-diophantine-equations
- add2-arithmetic-problems
- binary-quadratic-forms
- periodicity-quadratic-irrationals
- square-root-continued-fractions
- continued-fractions
- convergents
- add5-rational-quadratic-surds
- add7-integer-quadratic-method
- add8-pell-method-critique
- wallis-brouncker-method
- lagrange-reduction-algorithm
- norm-forms
- composition-of-forms