2
Olympiad Training Materials, www.imomath.com
Since
z
is a solution to a Pelltype equation if and only if so is
−
z
, we always assume w.l.o.g.that
z
>
0.Solutions of a Pell’s EquationA Pell’s equation has one trivial solution,
(
x
,
y
) = (
1
,
0
)
, correspondingto solution
z
=
1 of equation
N
(
z
) =
1. But if we know the smallest
nontrivial
solution, then we can deriveall the solutions. Thisis what the following statement claims.
Theorem 2.
If z
0
is the minimal element of
Z
[
√
d
]
with z
0
>
1
and N
(
z
0
) =
1
, then all the elements z
∈
Z
[
√
d
]
with Nz
=
1
are given by z
=
±
z
n
0
, n
∈
Z
.
Proof.
Suppose that
N
(
z
) =
1 for some
z
>
0. There is a unique integer
k
for which
z
k
0
≤
z
<
z
k
+
10
.Then the number
z
1
=
zz
−
k
0
=
zz
0
k
satisﬁes 1
≤
z
1
<
z
0
and
N
(
z
1
) =
N
(
z
)
N
(
z
0
)
−
k
=
N
(
z
) =
1. Itfollows from the minimality of
z
0
that
z
1
=
1 and hence
z
=
z
k
0
.
Corrolary.
If
(
x
0
,
y
0
)
is the smallest solution of the Pell’s equation with
d
given, then all naturalsolutions
(
x
,
y
)
of the equation are given by
x
+
y
√
d
=
±
(
x
0
+
y
0
√
d
)
n
,
n
∈
N
.Note that
z
=
x
+
y
√
d
determines
x
and
y
by the formulas
x
=
z
+
z
2
and
y
=
z
−
z
2
√
d
. Thus all thesolutions of the Pell’s equation are given by the formulas
x
=
z
n
0
+
z
0
n
2i
y
=
z
n
0
−
z
0
n
2
√
d
.
Example1.
The smallest nontrivialsolution of the equationx
2
−
2
y
2
=
1
is
(
x
,
y
) = (
3
,
2
)
. Therefore for every solution
(
x
,
y
)
there is an integer n such that x
+
y
√
d
=
±
(
3
+
2
√
2
)
n
. Thus x
=(
3
+
2
√
2
)
n
+(
3
−
2
√
2
)
n
2
,
y
=(
3
+
2
√
2
)
n
−
(
3
−
2
√
2
)
n
2
√
2
.
Now we will show that every Pell’s equation indeed has a nontrivial solution.
Lemma 1 (Dirichlet’s theorem).
Let
α
be an irrational number and n be a positive integer. Thereexist p
∈
Z
and q
∈{
1
,
2
,...,
n
}
such that
α
−
pq
<
1
(
n
+
1
)
q
.
Proof.
The stated inequality is equivalent to

q
α
−
p

<
1
n
+
1
.Let, as usual,
{
x
}
denote the fractional part of real
x
. Among the
n
+
2 numbers 0,
{
α
}
,
{
2
α
}
,
...
,
{
n
α
}
, 1 in the segment
[
0
,
1
]
, some two will differ by less than
1
n
+
1
. If such are the numbers
{
k
α
}
and
{
l
α
}
, it is enough to set
q
=

k
−
l

; and if such are
{
k
α
}
and 0 or 1, it is enough to set
q
=
k
. In either case,
p
is the integer closest to
k
α
.
Lemma 2.
If
α
is an arbitrary real number, then there exist inﬁnitely many pairs of positive integers
(
p
,
q
)
satisfying
α
−
pq
<
1
q
2
.
Proof
immediately follows from Dirichlet’s theorem.
Theorem 3.
A Pell’s equation has a solution in the set of positive integers.
Proof.
Applying L.2 to
α
=
√
d
, we see that there exists an integer
n
with

n

<
2
√
d
+
1 suchthat the equation
x
2
−
dy
2
=
n
has inﬁnitely many positive integral solutions
(
x
,
y
)
. It follows thatthere are two different ones, say
(
x
1
,
y
1
)
i
(
x
2
,
y
2
)
, that satisfy
x
1
≡
x
2
and
y
1
≡
y
2
(mod
n
). Denote
z
1
=
x
1
+
y
1
√
d
and
z
2
=
x
2
+
y
2
√
d
and assume
z
1
>
z
2
. Then
z
0
=
z
1
/
z
2
>
1 is an element of
Z
[
√
d
]
of norm 1 and corresponds to a nontrivial solution
(
x
0
,
y
0
)
of the Pell’s equation.