Pell's equation is the equation
where is a nonsquare positive integer and are integers. It can be shown that there are infinitely many solutions to the equation, and the solutions are easy to generate recursively from a single fundamental solution, namely the solution with positive integers of smallest possible size.
The solutions to Pell's equation have long been of interest to mathematicians, not least because of their value as approximations for : if then the fraction is a good approximation for
Even small values of can lead to fundamental solutions which are quite large. For example, for the solution with smallest positive is
The theory of solutions to the equation is connected with continued fractions, and gives an accessible introduction to some ideas from algebraic number theory.
A very useful way to combine solutions of the equation into new solutions is furnished by Brahmagupta's identity
Brahmagupta was an Indian mathematician in the century AD who was one of the first to study Pell's equation in general. (The famous Swiss mathematician Leonhard Euler named the equation after the century British mathematician John Pell, to whom he mistakenly attributed a solution method discovered by Pell's contemporary Lord Brouncker; this name has unfortunately persisted despite evidence of work on the equation from more than a millennium earlier by Brahmagupta and others.)
Brahmagupta used this identity to combine two solutions and to Pell's equation into a third solution . This solution is sometimes called the composition of and . In addition, "near-solutions" can often be composed to produce solutions.
Find a solution to .
Note that . Applying Brahmagupta's identity with gives
So , and dividing by gives .
The numbers and in Brahmagupta's identity seem to come from out of nowhere, but in fact they appear quite naturally when the identity is expressed in terms of products of numbers of the form . This is most naturally expressed via a concept from basic algebraic number theory.
Suppose is a root of an irreducible polynomial with rational coefficients. Then the norm of , denoted , is the product of the roots of . This is times the constant term of , where is the degree of
If , then , so is a root of the polynomial . If is not a square, this is irreducible, and
Now let . Then . Notice that the coefficients of are the expressions in Brahmagupta's identity; that is, the composition of solutions and corresponds to the product of the associated expressions and . Then
So Brahmagupta's identity says that the norm of is multiplicative. In fact, this is true in general, although the proof requires some advanced machinery.
Suppose . Applying Brahmagupta's identity repeatedly gives an infinite sequence of solutions to the equation , where
These solutions are said to be generated by .
Note that if , then , , and so on. The solutions correspond to .
Suppose Pell's equation has a nontrivial solution for . Let be the fundamental solution, i.e. the solution with the smallest possible positive values of and . Then every solution to Pell's equation in positive integers is generated by .
Note that the real number is the smallest number greater than of this form whose norm is . Suppose is another solution to Pell's equation with , and let . Then for some ,
Then can be expanded out to give for some . Note that are nonnegative since . Since was minimal, the only possibility is that and . So is generated by .
To see the ideas of the proof in action, suppose . It's clear by inspection that the fundamental solution is . So any other solution in positive integers satisfies for some . Any larger solution can be repeatedly divided by to produce a smaller one. For instance, note that . So
so If repeated division by did not eventually produce , it would produce a smaller solution, which would violate the minimality of .
What are the first 3 triangular numbers that are also perfect squares?
Recall that the triangle number is = . Set this equal to . Now multiply both sides by 8 and expand:
Now set to get . As seen above, the solutions are generated by , and the first three are so .
, , and are all squares, as expected.
Suppose that is not a square. The irrational number has a simple continued fraction expansion. For shorthand, write
To derive the continued fraction expansion of , subtract the floor, invert what is left, and repeat:
and the process will repeat to give
The bar indicates that repeat indefinitely, similar to a bar over repeating decimal digits.
Here are some facts about the continued fraction expansion of , presented without proof.
(1) The continued fraction expansion is of the form for some integers .
(2) , and .
(3) is a palindrome, i.e. , , etc.
(4) Pell's equation always has nontrivial solutions. The fundamental solution is (5) The equation has solutions if and only if is odd; in this case, the minimal solution is .
In particular, fact (4) gives an algorithm to find the fundamental solution to Pell's equation for any .
The continued fraction expansion of is . Since , the fundamental solution to Pell's equation is the numerator and denominator of
On the other hand, the continued fraction expansion of is , with , so the fundamental solution is the numerator and denominator of
And gives a solution to .