Pell's Equation and Sums of Squares
9.1 Pell’s Equation
Section titled “9.1 Pell’s Equation”Definition. For a nonsquare positive integer , Pell’s equation is
The trivial solutions always exist; the equation is interesting because whenever one non-trivial solution exists, infinitely many do; all generated by powers of the fundamental solution in the ring :
(the algebra works because ; Brahmagupta’s identity).
Example. : fundamental solution , and successive solutions ; the -values grow like , exponentially.
Example (the cattle problem of Archimedes, simplified). has fundamental solution , ; a famously enormous answer discovered via continued fractions, illustrating why the equation resisted solution for centuries.
9.2 Solving Pell via Continued Fractions
Section titled “9.2 Solving Pell via Continued Fractions”The continued fraction expansion of is periodic for every nonsquare :
The solutions of Pell’s equation come from the convergents :
- If the period length is even, is the fundamental solution of .
- If is odd, solves , and solves the negative Pell equation .
Worked example. (, even). Convergents: , , , ; check : fundamental solution , and the next is .
9.3 Sums of Two Squares
Section titled “9.3 Sums of Two Squares”Theorem (Fermat, two squares). An odd prime satisfies iff ; and a general integer is a sum of two squares iff every prime divides to an even power.
Proof idea of the prime case. For , is a QR (Euler’s criterion), so has a solution; means with , so by descent (repeatedly halving via a multiple of ) a genuine representation is produced.
Examples: , , , (); while are never sums of two squares. has 3 to an odd power → not a sum of two squares. → ✓ (3 appears to an even power).
9.4 Four Squares and Beyond
Section titled “9.4 Four Squares and Beyond”Lagrange’s four-square theorem: every is a sum of four squares (proven by Euler’s identity plus descent). Waring’s theorem generalises: every is a sum of at most -th powers; the conjectured values , , are known.
Two squares → at most four squares → the pattern of which numbers need how many squares is governed by Legendre’s three-square theorem: is a sum of three squares iff is not of the form .
9.5 Common Pitfalls
Section titled “9.5 Common Pitfalls”- Pell has no solutions when is a perfect square ( factors over , forcing ).
- The fundamental solution can be astronomically large ( case); never guess it; use the continued fraction of .
- The two-squares criterion fails on the power of a prime: is not a sum of two squares (odd power test), but is.
- Products of sums of two squares are again sums of two squares (Brahmagupta); quotable in constructions.
See Also
Section titled “See Also”Generate Pell solutions by repeated multiplication in : for , , so the next solution is . Quote Brahmagupta’s identity as the reason powers of one solution are again solutions. Check every Pell solution by substitution before quoting it: must equal exactly 1, and one arithmetic slip in a large multiplication invalidates the whole sequence.
9.x A Second Pell Cascade
Section titled “9.x A Second Pell Cascade”For : , period 1 (odd), so solves from the convergent , and solves .