# Pell-type Equations

A Pell-type equation in general may not have integer solutions
(for example, the equation \( x^2-3y^2=2 \)). When it does, it is
possible to describe the general solution.

** Theorem 4 **

The equation \( x^2-dy^2=-1 \) has an integral solution if and
only if there exists \( z_1\in\mathbb{Z}[\sqrt d] \) with \( z_1^2=z_0 \).

The ``if’’ part is trivial. For the other
direction we consider the smallest solution \( z=z_1\in\mathbb{Z}
[\sqrt d] \) of the equation \( N(z)=-1 \) satisfying \( z> 1 \) and, like in
Theorem 2, deduce that \( 1\leq z_1< z_0 \). Since \( z=z_1^2< z_0^2 \) is
a solution of \( N(z)=1 \), we must have \( z_1^2=z_0 \).

Consider the general equation \( N(z)=a \). Like in
Theorem 1,
one can show
that all its solutions can be obtained from the solutions \( z \) with
\( 1\leq z\leq z_0 \), where \( z_0 \) is the smallest non-trivial
solution of Pell’s equation \( N(z)=1 \). Thus it is always sufficient
to check finitely many values of \( x \). Moreover, there is a simple
upper bound for those \( x \).

** Theorem 5 **

If \( a \) is an integer such that the equation \( N(z)=x^2-
dy^2=a \) has an integer solution, then there is a solution with
\( \displaystyle |x|\leq\frac{z_0+1}{2\sqrt{z_0}}\sqrt{|a|} \) and the
corresponding upper bound for \( y=\sqrt{\frac{x^2-a}d} \).

If \( z_1 \) is a solution of the equation
\( N(z)=a \), then there is \( m\in\mathbb{Z} \) for which \( a/\sqrt{z_0}
\leq z_0^mz_1< a\sqrt{z_0} \). Then \( z_2=z_0^mz_1=x+y\sqrt d \) is a
solution of the equation \( N(z)=1 \) and satisfies
\[ 2|x|=\left|\displaystyle z_2+\frac a{z_2}\right|
\leq\max_{[a/{\sqrt{z_0}},a\sqrt{z_0})}\left|t+\frac at\right|=
\frac{z_0+1}{\sqrt{z_0}}\sqrt{|a|}.\]

** Example **

Find all integer solutions of \( x^2-7y^2=2 \).

The mimimal solution of the corresponding Pell’s
equation is \( z_0=8+3\sqrt7 \). We must find the solutions
\( z=x+y\sqrt7 \) of \( N(z)=2 \) satisfying \( x\leq\frac{z_0+1}
{2\sqrt{z_0}}\sqrt{a}=3 \) and \( y=\sqrt{\frac{x^2-2}7}\leq1 \). The
only such solution is \( z=3+\sqrt7 \). It follows that all solutions
\( (x,y) \) of the given equation are given by
\[ x+y\sqrt7=\pm(3+\sqrt7)(8+3\sqrt7)^n,\quad n\in\mathbb{N}. \]