Pell's Equation

Pell's equation is the deceptively simple Diophantine equation

x^2 - D\,y^2 = 1,

for a non-square positive integer D, sought in whole numbers x, y. It looks like it might have a handful of small solutions — but it has infinitely many, and some are shockingly large. It is one of the oldest equations in mathematics, studied by Brahmagupta and Fermat long before John Pell (who, by a historical mislabelling, lent it his name).

One solution gives them all

There is always a smallest nontrivial solution, the fundamental solution (x_1, y_1). From it, every other solution is generated by taking powers in the ring \mathbb{Z}[\sqrt D]:

x_k + y_k\sqrt{D} = \left(x_1 + y_1\sqrt{D}\right)^{k}.

For D = 2, the fundamental solution is (3, 2) (since 3^2 - 2\cdot 2^2 = 1); squaring 3 + 2\sqrt 2 gives the next solution (17, 12), and so on forever.

Finding the first solution

How do you find (x_1, y_1)? Through the periodic continued fraction of \sqrt{D} — its convergents deliver the fundamental solution directly. This is essential because brute force is hopeless: for D = 61 the smallest solution is already

x_1 = 1{,}766{,}319{,}049, \qquad y_1 = 226{,}153{,}980.

Fermat posed exactly this case as a challenge — knowing full well no one would stumble on it by searching.

Why it matters

Pell's equation is the prototype for understanding units in rings of algebraic integers: its solutions are the units of \mathbb{Z}[\sqrt D], and the fact that they form an infinite cyclic family is a special case of Dirichlet's deep unit theorem. A toy equation that opens onto the structure of number fields.