Pell's equation (Table of contents)

Solutions to Pell’s Equation

A Pell’s equation has one trivial solution, \((x,y)=(1,0)\), corresponding to solution \(z=1\) of equation \(N(z)=1\). But if we know the smallest non-trivial solution, then we can derive all the solutions. This is what the following statement claims.

Theorem 2 If \(z_0\) is the minimal element of \(\mathbb{Z} [\sqrt{d}]\) with \(z_0 > 1\) and \(N(z_0)=1\), then all the elements \(z\in\mathbb{Z}[\sqrt{d}]\) with \(Nz=1\) are given by \(z=\pm z_0^n\), \(n\in\mathbb{Z}\).

Corollary If \((x_0,y_0)\) is the smallest solution of the Pell’s equation with \(d\) given, then all natural solutions \((x,y)\) of the equation are given by \(x+y\sqrt{d}=\pm(x_0+y_0\sqrt{d})^n\), \(n\in\mathbb{N}\).

Note that \(z=x+y\sqrt d\) determines \(x\) and \(y\) by the formulas \(x=\frac{z+\overline{z}}2\) and \(y=\frac{z-\overline{z}}{2\sqrt d}\). Thus all the solutions of the Pell’s equation are given by the formulas \[x=\frac{z_0^n+\overline{z_0}^n}2\quad\mbox{i}\quad y=\frac{z_0^n-\overline{z_0}^n}{2\sqrt d}.\]

Example The smallest non-trivial solution of the equation \(x^2-2y^2=1\) is \((x,y)=(3,2)\). Therefore for every solution \((x,y)\) there is an integer \(n\) such that \(x+y\sqrt d=\pm(3+ 2\sqrt2)^n\). Thus \[x=\frac{(3+2\sqrt2)^n+(3-2\sqrt2)^n}2,\quad y=\frac{(3+2\sqrt2)^n-(3-2\sqrt2)^n}{2\sqrt2}.\]

Now we will show that every Pell’s equation indeed has a non-trivial solution.

Lemma 1 (Dirichlet’s theorem) Let \(\alpha\) be an irrational number and \(n\) be a positive integer. There exist \(p\in\mathbb{Z}\) and \(q\in\{1,2,\dots,n\}\) such that \(\left|\alpha-\frac pq\right| < \frac1{(n+1)q}\).

Lemma 2 If \(\alpha\) is an arbitrary real number, then there exist infinitely many pairs of positive integers \((p,q)\) satisfying \(\left|\alpha-\frac pq\right| < \frac1{q^2}\).

Theorem 3 A Pell’s equation has a solution in the set of positive integers.