# c 2007 The Author(s) and The IMO Compendium Group

Pell’s Equation
Duˇ san Djuki´ c
Contents
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Pell-type Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Problems with Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1 Introduction
Deﬁnition 1. Pell’s equation is a diophantine equation of the form x
2
−dy
2
= 1, x, y ∈ Z, where d
is a given natural number which is not a square.
An equation of the form x
2
−dy
2
=a for an integer a is usually referred to as a Pell-type equation.
An arbitrary quadratic diophantine equation with two unknowns can be reduced to a Pell-type
equation. How can such equations be solved? Recall that the general solution of a linear diophantine
equation is a linear function of some parameters. This does not happen with general quadratic dio-
phantine equations. However, as we will see later, in the case of such equations with two unknowns
there still is a relatively simple formula describing the general solution.
Why does the deﬁnition of Pell’s equations assume d is not a square? Well, for d = c
2
, c ∈ Z,
the equation x
2
−dy
2
= a can be factored as (x −cy)(x +cy) = a and therefore solved without using
any further theory. So, unless noted otherwise, d will always be assumed not to be a square.
The equation x
2
−dy
2
= a can still be factored as
(x +y

d)(x −y

d) = a.
In order to be able to make use of this factorization, we must deal with numbers of the form x+y

d,
where x, y are integers. This set is denoted by Z[

d]. An important property of this set is that the
sum and product of two of its elements remain in the set (i.e. this set is really a ring).
Deﬁnition 2. The conjugate of number z = x +y

d is deﬁned as z = x −y

d, and its norm as
N(z) = zz = x
2
−dy
2
∈ Z.
Theorem 1. The norm and the conjugate are multiplicative in z: N(z
1
z
2
) = N(z
1
)N(z
2
) and z
1
z
2
=
z
1
· z
2
.
Proof is straightforward.
In terms of these concepts, equation x
2
−dy
2
= a can be rewritten as
N(z) = a, where z = x −y

d ∈ Z[

d].
In particular, the Pell’s equation becomes N(z) = 1, z ∈ Z[

d]. We continue using these notation
regularly.
Since z is a solution to a Pell-type equation if and only if so is −z, we always assume w.l.o.g.
that z > 0.
Solutions of a 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 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+1
0
.
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. It
follows 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 natural
solutions (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 the
solutions of the Pell’s equation are given by the formulas
x =
z
n
0
+z
0
n
2
i y =
z
n
0
−z
0
n
2

d
.
Example 1. 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

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 non-trivial solution.
Lemma 1 (Dirichlet’s theorem). Let α be an irrational number and n be a positive integer. There
exist p ∈ Z and q ∈ {1, 2, . . . , n} such that
¸
¸
¸α −
p
q
¸
¸
¸ <
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
¸
¸
¸α −
p
q
¸
¸
¸ <
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 such
that the equation x
2
−dy
2
= n has inﬁnitely many positive integral solutions (x, y). It follows that
there 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 non-trivial solution (x
0
, y
0
) of the Pell’s equation.
Duˇ san Djuki´ c: Pell’s Equation 3
2 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. Equation x
2
−dy
2
=−1 has an integral solution if and only if there exists z
1
∈ Z[

d]
with z
2
1
= z
0
.
Proof. The ”if” part is trivial. For the other direction we consider the smallest solution z = z
1

Z[

d] of the equation N(z) = −1 satisfying z > 1 and, like in theorem 2, deduce that 1 ≤ z
1
< z
0
.
Since z = z
2
1
< z
2
0
is a solution of N(z) = 1, we must have z
2
1
= z
0
.
Consider the general equation N(z) = a. Like in the theorem1, one can showthat all its solutions
can be obtained from the solutions z with 1 ≤z ≤z
0
, where z
0
is the smallest non-trivial solution of
Pell’s equation N(z) = 1. Thus it is always sufﬁcient to check ﬁnitely 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 |x| ≤
z
0
+1
2

z
0
_
|a| and the corresponding upper bound for y =
_
x
2
−a
d
.
Proof. If z
1
is a solution of the equation N(z) = a, then there is m ∈ Z for which a/

z
0
≤ z
m
0
z
1
<
a

z
0
. Then z
2
= z
m
0
z
1
= x +y

d is a solution of the equation N(z) = 1 and satisﬁes
2|x| =
¸
¸
¸
¸
z
2
+
a
z
2
¸
¸
¸
¸
≤ max
[a/

z
0
,a

z
0
)
¸
¸
¸t +
a
t
¸
¸
¸ =
z
0
+1

z
0
_
|a|.
Example 2. Find all integer solutions of x
2
−7y
2
= 2.
Solution. The mimimal solution of the corresponding Pell’s equation is z
0
=8+3

7. We must ﬁnd
the solutions z = x +y

7 of N(z) = 2 satisfying x ≤
z
0
+1
2

z
0

a = 3 and y =
_
x
2
−2
7
≤ 1. The only
such solution is z = 3 +

7. It follows that all solutions (x, y) of the given equation are given by
x +y

7 =±(3 +

7)(8 +3

7)
n
, n ∈ N. △
3 Problems with Solutions
1. Solve in integers the equation x
2
+y
2
−1 = 4xy.
Solution. Substituting u = y−2x reduces the equation to u
2
=3x
2
+1 whose general solution
is given by x +u

3 = (2 +

3)
n
.
2. For a given integer d, solve x
2
−dy
2
= 1 u skupu racionalnih brojeva.
Solution. No knowledge of Pell’s equation is required here. For x =1 we have d
_
y
x−1
_
=
x+1
y
.
Setting
y
x−1
= t ∈ Q we easily obtain x =
dt
2
+1
dt
2
−1
i y =
2t
dt
2
−1
.
3. Let (x, y) = (a, b), a, b ∈ N be the smallest integer solution of x
2
−dy
2
= 1. Consider the
sequence deﬁned by y
0
= 0, y
1
= b, y
n+1
= 2ay
n
−y
n−1
for n ≥ 1. Show that ay
2
n
+1 is a
square for each n. Show that if ay
2
+1 is a square for some y ∈ N, then y = y
n
for some n.
Solution. Let x
n
+y

n
=
_
a +b

d
_
n
. All solutions (x, y) of x
2
= ay
2
+1 are given by (x, y) =
(x
n
, y

n
) for some n. We have
y

n
=
1
2

d
__
a +b

d
_
n

_
a −b

d
_
n
_
. (1)
Since a±b

d are the solutions of the quadratic equation x
2
−2ax +1 = 0, relation (1) easily
implies that y

n+2
−2ay

n+1
+y
n
= 0. Therefore the sequences (y
n
) and (y

n
) satisfy the same
initial conditions and recurrent relation and must be equal. The statement of the problem
follows immediately.
4. Prove that 5x
2
+4 or 5x
2
−4 is a perfect square if and only if x is a term in the Fibonacci
sequence.
5. Find all n ∈ N such that
_
n
k −1
_
= 2
_
n
k
_
+
_
n
k +1
_
for some natural number k < n.
Solution. Multiplication by
(k+1)!(n−k+1)!
n!
transforms the equation into k(k+1) =2(k+1)(n−
k +1) +(n −k)(n −k +1), which is simpliﬁed as n
2
+3n +2 = 2k
2
+2k, i.e.
(2n +3)
2
+1 = 2(2k +1)
2
.
The smallest solution of equation x
2
−2y
2
=−1 is (1, 1), and therefore all its solutions (x
i
, y
i
)
are given by x
i
+y
i

2 = (1 +

2)
2i+1
. Note that x
i
and y
i
are always odd, so n =
x
i
−3
2
is an
integer and a solution to the problem. Clearly, there are no other solutions.
6. Let a ∈ N and d = a
2
−1. If x, y are integers and the absolute value of m = x
2
−dy
2
is less
than 2a +2, prove that |m| is a perfect square.
Solution. The smallest solution of N(z) = 1 is z
0
= a +

d. If N(z) = m has a solution, then
by the theorem 5 it also has a solution z = x +y

d in which x ≤
z
0
+1
2

z
0
_
|m| =
_
a+1
2
|m|. For
|m| <2a+2 this inequality becomes x < a+1, and thus (x, y) = (a, 1) and m =1 or y =0 and
m = x
2
.
7. Prove that if m = 2 +2

28n
2
+1 is an integer for some n ∈ N, then m is a perfect square.
Solution. We start by ﬁnding those n for which m is an integer. The pair (
m
2
−1, n) must be a
solution of Pell’s equation x
2
−28y
2
=1 whose smallest solution is (x
0
, y
0
) = (127, 24); hence
m
2
−1 +n

28 = (127 +24

28)
k
for some k ∈ N. Now we have
m = 2 +(127 +24

28)
k
+(127 −24

28)
k
= A
2
,
where A = (8 +3

7)
k
+(8 −3

7)
k
is an integer.
8. Prove that if the difference of two consecutive cubes is n
2
, n ∈ N, then 2n −1 is a square.
Solution. Let (m+1)
3
−m
3
=3m
2
+3m+1 = n
2
. Then (2n)
2
=3(2m+1)
2
+1, so (2n, 2m+
1) is a solution of Pell’s equation x
2
−3y
2
= 1. As shown already, we obtain 2n + (2m +
1)

3 = (2 +

3)
l
. In order for n to be integral, l must be odd. It follows that 4n = (2 +

3)
2k+1
+(2 −

3)
2k+1
. Finally,
2n −1 =
(1 +

3)
2
(2 +

3)
2k
+(1 −

3)
2
(2 −

3)
2k
−8
4
= N
2
,
whereby N is an integer: N =
1
2
_
(1 +

3)(2 +

3)
k
+(1 −

3)(2 −

3)
k
_
.
9. If n is an integer such that 3n+1 and 4n+1 are both squares, prove that n is a multiple of 56.
Solution. Let us ﬁnd all such n. Denoting 3n+1 = a
2
and 4n+1 = b
2
we have (2a)
2
−3b
2
=
1.
We shall ﬁnd all solutions of x
2
−3b
2
= 1 with an even x = 2a. The solutions of the Pell’s
equation u
2
−3v
2
=1 are given by (u, v) = (u
k
, v
k
), where u
k
+v
k

3 = (2+

3)
k
. One easily
sees that u
k
is even if and only if k is odd. Thus (x, b) = (u
2k+1
, v
2k+1
), where we also have
2u
2k+1
= (2 +

3)
2k+1
+(2 −

3)
2k+1
.
Duˇ san Djuki´ c: Pell’s Equation 5
It follows that (a, b) = (
1
2
u
2k+1
, v
2k+1
) and n =
1
3
(a
2
−1) =
1
12
(u
2
2k+1
−4), which yields
48n = (7 +4

3)
2k+1
+(7 −4

3)
2k+1
−14
= 2
_
7
2k+1
−7 +48
_
2k +1
2
_
7
2k−1
+48
2
_
2k +1
2
_
7
2k−3
+· · ·
_
.
We thus obtain a simpler expression for n, making the divisibility by 56 obvious:
n =
7
2k+1
−7
24
+2
_
2k +1
2
_
7
2k−1
+2 · 48
_
2k +1
2
_
7
2k−3
+· · ·
10. Prove that the equation x
2
−dy
2
=−1 is solvable in integers if and only if so is x
2
−dy
2
=−4.
11. Let p be a prime. Prove that the equation x
2
− py
2
= −1 has integral solutions if and only if
p = 2 or p ≡1 (mod 4).
Solution. If the considered equation has a solution (x, y), then p | x
2
+1; hence either p = 2
or p ≡1 (mod 4).
For p = 2, x = y = 1 is a solution. We shall show that there is a solution for each prime
p = 4t +1. A natural starting point (and the only one we see!) is the existence of an integral
solution (x
0
, y
0
) with x
0
, y
0
∈Nto the corresponding Pell’s equation: x
2
0
−py
2
0
=1. We observe
that x
0
is odd: otherwise y
2
0
≡ py
2
0
≡3 (mod 4). Thus in the relation x
2
0
−1 = (x
0
−1)(x
0
+1) =
py
2
0
, factors x
0
+1 and x
0
−1 have the greatest common divisor 2, and consequently one of
them is a doubled square (to be denoted by 2x
2
) and the other one 2p times a square (to be
denoted by 2py
2
). The case x
0
+1 = 2x
2
, x
0
−1 = 2py
2
is impossible because it leads to a
smaller solution of Pell’s equation: x
2
−py
2
= 1. It follows that x
0
−1 = 2x
2
, x
0
+1 = 2py
2
and therefore x
2
−py
2
=−1.
12. If p is a prime of the form 4k +3, show that exactly one of the equations x
2
− py
2
= ±2 has
an integral solution.
Solution. This is very similar to the previous problem. At most one has a solution. Now if
(x
0
, y
0
) is the smallest solution of the corresponding Pell’s equation, if x
0
±1 are not coprime,
the equality (x
0
−1)(x
0
+1) = py
2
0
gives us x
0
±1 =2x
2
and x
0
∓1 =2py
2
, i.e. x
2
−py
2
=±1,
which is impossible in either case. Therefore x
0
±1 are coprime, which implies x
0
±1 = x
2
,
x
0
∓1 = py
2
and x
2
−py
2
=±2.
13. Prove that 3
n
−2 is a square only for n = 1 and n = 3.
14. Prove that if
x
2
+1
y
2
+4 is a perfect square, then this square equals 9.

then there exist inﬁnitely many pairs of positive integers p 1 (p. Suppose that N(z) = 1 for some z > 0. 2 √ √ (3 + 2 2)n − (3 − 2 2)n √ . Then z0 = z1 /z2 > 1 is an element of Z[ d] of norm 1 and corresponds to a non-trivial solution (x0 . p is the integer closest to kα . then all natural √ √ solutions (x. 2 d Example 1. n} such that α − q < (n+1)q . . q) satisfying α − q < q2 . 0 Proof. If α is an arbitrary real number. But if we know the smallest non-trivial solution. The smallest non-trivial solution of the equation x2 −2y2 = 1 is (x.l. Solutions of a Pell’s Equation A Pell’s equation has one trivial solution. corresponding to solution z = 1 of equation N(z) = 1.g. Thus √ √ (3 + 2 2)n + (3 − 2 2)n x= . Therefore √ √ for every solution (x. {α }. Lemma 1 (Dirichlet’s theorem). y) = (1. it is enough to set q = |k − l|. It follows that there are two different ones. 0 Corrolary. y) of the equation are given by x + y d = ±(x0 + y0 d)n . y= 2 2 Now we will show that every Pell’s equation indeed has a non-trivial solution. www. y). 0 0 Then the number z1 = zz−k = zz0 k satisﬁes 1 ≤ z1 < z0 and N(z1 ) = N(z)N(z0 )−k = N(z) = 1. √ z−z Note that z = x + y d determines x and y by the formulas x = z+z and y = 2√d . as usual. y1 ) i (x2 . {2α }. y) there is an integer n such that x + y d = ±(3 + 2 2)n . {x} denote the fractional part of real x. Let. that satisfy x1 ≡ x2 and y1 ≡ y2 (mod n).com Since z is a solution to a Pell-type equation if and only if so is −z.o. we see that there exists an integer n with |n| < 2 d + 1 such that the equation x2 − dy2 = n has inﬁnitely many positive integral solutions (x. {nα }. 1 . There p 1 exist p ∈ Z and q ∈ {1. say√ 1 . Thus all the 2 solutions of the Pell’s equation are given by the formulas x= zn + z0 n 0 2 i y= zn − z0 n 0 √ . (x. we always assume w. 2). Denote (x √ √ z1 = x1 + y1 d and z2 = x2 + y2 d and assume z1 > z2 . y0 ) is the smallest solution of the Pell’s equation with d given. Applying L. then all the elements √ z ∈ Z[ d] with Nz = 1 are given by z = ±zn . √ Theorem 2. y2 ). then we can derive all the solutions. Among the n + 2 numbers 0. 1 Proof. . n ∈ N. 2. and if such are {kα } and 0 or 1. √ √ Proof. 0). There is a unique integer k for which zk ≤ z < zk+1 . Let α be an irrational number and n be a positive integer. If (x0 . A Pell’s equation has a solution in the set of positive integers. y) = (3. Theorem 3. . some two will differ by less than n+1 . . The stated inequality is equivalent to |qα − p| < n+1 . . If such are the numbers {kα } and {l α }.2 Olympiad Training Materials. This is what the following statement claims.imomath. If z0 is the minimal element of Z[ d] with z0 > 1 and N(z0 ) = 1. . In either case. that z > 0. 1]. Proof immediately follows from Dirichlet’s theorem..2 to α = d. y0 ) of the Pell’s equation. n ∈ Z. . It 0 follows from the minimality of z0 that z1 = 1 and hence z = zk . it is enough to set q = k. 1 in the segment [0. Lemma 2.

then there is a solution with |x| ≤ √ 2 z0 √ Proof. Equation x2 − dy2 = −1 has an integral solution if and only if there exists z1 ∈ Z[ d] with z2 = z0 . √ n Solution. Let (x. y) of x2 = ay2 + 1 are given by (x. y1 = b. √ Theorem 4. solve x2 − dy2 = 1 u skupu racionalnih brojeva. For x = 1 we have d = t ∈ Q we easily obtain x = dt 2 +1 dt 2 −1 = x+1 y . y′ ) for some n. 1 Proof. The only z0 √ such solution is z = 3 + 7. deduce that 1 ≤ z1 < z0 . Substituting u = y√ 2x reduces the equation to u2 = 3x2 + 1 whose general solution − √ is given by x + u 3 = (2 + 3)n . Thus it is always sufﬁcient to check ﬁnitely many values of x. then there is m ∈ Z for which a/ z0 ≤ zm z1 < 0 √ √ a z0 . Moreover. we must have z2 = z0 . No knowledge of Pell’s equation is required here. dt 2 −1 3. Then z2 = zm z1 = x + y d is a solution of the equation N(z) = 1 and satisﬁes 0 2|x| = z2 + z0 + 1 a a ≤ √ √ t+ = √ max z2 t z0 [a/ z0 . Solve in integers the equation x2 + y2 − 1 = 4xy. b ∈ N be the smallest integer solution of x2 − dy2 = 1. iy= 2t . Theorem 5. a. it is possible to describe the general solution. Let xn + y′ = a + b d . The mimimal solution of the corresponding Pell’s equation is z0 = 8 + 3 7. We must ﬁnd √ 2 −2 z√ √ the solutions z = x + y 7 of N(z) = 2 satisfying x ≤ 20 +1 a = 3 and y = x 7 ≤ 1. Solution. one can show that all its solutions can be obtained from the solutions z with 1 ≤ z ≤ z0 . Show that if ay2 + 1 is a square for some y ∈ N. n ∈ N. there is a simple upper bound for those x.a z0 ) |a|. For a given integer d. △ 3 Problems with Solutions 1. then y = yn for some n. √ Solution. y) = n (xn . where z0 is the smallest non-trivial solution of Pell’s equation N(z) = 1. b). y x−1 2. When it does. For the other direction we consider the smallest solution z = z1 ∈ √ Z[ d] of the equation N(z) = −1 satisfying z > 1 and. y) = (a. (1) . If z1 is a solution of the equation N(z) = a. like in theorem 2. Find all integer solutions of x2 − 7y2 = 2. z0 + 1 2 −a |a| and the corresponding upper bound for y = x d . We have n 1 y′ = √ n 2 d √ a+b d n √ − a−b d n . Example 2. If a is an integer such that the equation N(z) = x2 − dy2 = a has an integer solution. 1 0 1 Consider the general equation N(z) = a. The ”if” part is trivial. Show that ay2 + 1 is a n square for each n. y) of the given equation are given by √ √ √ x + y 7 = ±(3 + 7)(8 + 3 7)n . Since z = z2 < z2 is a solution of N(z) = 1. It follows that all solutions (x. yn+1 = 2ayn − yn−1 for n ≥ 1. All solutions (x.Duˇan Djuki´ : Pell’s Equation s c 3 2 Pell-type Equations A Pell-type equation in general may not have integer solutions (for example. Consider the sequence deﬁned by y0 = 0. Setting y x−1 Solution. Like in the theorem 1. the equation x2 − 3y2 = 2).

The smallest solution of N(z) = 1 is z0 = a + d. (2n + 3)2 + 1 = 2(2k + 1)2. yi ) √ √ are given by xi + yi 2 = (1 + 2)2i+1 . www. In order for n to be integral. Find all n ∈ N such that n n n =2 + for some natural number k < n. The statement of the problem follows immediately. If n is an integer such that 3n + 1 and 4n + 1 are both squares. Let a ∈ N and d = a2 − 1. l must be odd. then m is a perfect square. Denoting 3n + 1 = a2 and 4n + 1 = b2 we have (2a)2 − 3b2 = 1. n ∈ N. Prove that if m = 2 + 2 28n2 + 1 is an integer for some n ∈ N. prove that |m| is a perfect square. Now we have √ √ m = 2 + (127 + 24 28)k + (127 − 24 28)k = A2 .√ The solutions of the Pell’s √ equation u2 − 3v2 = 1 are given by (u. The pair ( m − 1. Let us ﬁnd all such n. so (2n. If N(z) = m has a solution. As shown already. Prove that if the difference of two consecutive cubes is n2 . relation (1) easily implies that y′ − 2ay′ + yn = 0. Finally. y0 ) = (127. v) = (uk . √ √ where A = (8 + 3 7)k + (8 − 3 7)k is an integer. prove that n is a multiple of 56. Then (2n)2 = 3(2m + 1)2 + 1. √ √ √ √ (1 + 3)2 (2 + 3)2k + (1 − 3)2 (2 − 3)2k − 8 = N2. k−1 k k+1 Solution. there are no other solutions. 8. and thus (x. If x. v2k+1 ). n) must be a 2 2 solution of Pell’s equation x√− 28y2 = 1 whose smallest solution is (x0 . y are integers and the absolute value of m = x2 − dy2 is less than 2a + 2. y) = (a. Solution. then 2n − 1 is a square. b) = (u2k+1 . where we also have √ √ 2u2k+1 = (2 + 3)2k+1 + (2 − 3)2k+1 . 2n − 1 = 4 √ √ √ √ 1 whereby N is an integer: N = (1 + 3)(2 + 3)k + (1 − 3)(2 − 3)k . i. and therefore all its solutions (xi . Solution. We start by ﬁnding those n for which m is an integer. hence √ m k 2 − 1 + n 28 = (127 + 24 28) for some k ∈ N. Prove that 5x2 + 4 or 5x2 − 4 is a perfect square if and only if x is a term in the Fibonacci sequence.e. 1).4 Olympiad Training Materials. . 24). We shall ﬁnd all solutions of x2 − 3b2 = 1 with an even x = 2a. 2m + 1)√ a solution of Pell’s equation x2 − 3y2 = 1. For z0 2 |m| < 2a + 2 this inequality becomes x < a + 1.com √ Since a ± b d are the solutions of the quadratic equation x2 − 2ax + 1 = 0. which is simpliﬁed as n2 + 3n + 2 = 2k2 + 2k. Therefore the sequences (yn ) and (y′ ) satisfy the same n n+2 n+1 initial conditions and recurrent relation and must be equal. where uk + vk 3 = (2 + 3)k . we obtain 2n + (2m + is √ 1) 3 = (2 + 3)l . 4. Let (m + 1)3 − m3 = 3m2 + 3m + 1 = n2 . vk ). 2 9. Solution. so n = xi −3 is an 2 integer and a solution to the problem. Note that xi and yi are always odd. √ Solution. 5. One easily sees that uk is even if and only if k is odd.imomath. Thus (x. then √ z√ by the theorem 5 it also has a solution z = x + y d in which x ≤ 20 +1 |m| = a+1 |m|. 1) and m = 1 or y = 0 and m = x2 . The smallest solution of equation x2 − 2y2 = −1 is (1. It follows that 4n = (2 + √ 2k+1 √ 3) + (2 − 3)2k+1 . Multiplication by (k+1)!(n−k+1)! transforms the equation into k(k + 1) = 2(k + 1)(n − n! k + 1) + (n − k)(n − k + 1). 6. √ 7. Clearly.

Duˇan Djuki´ : Pell’s Equation s c 1 It follows that (a. It follows that x0 − 1 = 2x2 . At most one has a solution. For p = 2. Prove that the equation x2 − dy2 = −1 is solvable in integers if and only if so is x2 − dy2 = −4. x0 ∓ 1 = py2 and x2 − py2 = ±2. x2 − py2 = ±1. x0 − 1 = 2py2 is impossible because it leads to a smaller solution of Pell’s equation: x2 − py2 = 1. y0 ) is the smallest solution of the corresponding Pell’s equation. We shall show that there is a solution for each prime p = 4t + 1. which implies x0 ± 1 = x2 . We observe 0 0 that x0 is odd: otherwise y2 ≡ py2 ≡ 3 (mod 4). b) = ( 1 u2k+1 . If the considered equation has a solution (x. x = y = 1 is a solution. 12. v2k+1 ) and n = 3 (a2 − 1) = 2 1 2 12 (u2k+1 − 4). Prove that if x2 + 1 + 4 is a perfect square. Let p be a prime. i. 0 which is impossible in either case. 13. y). Now if (x0 . if x0 ± 1 are not coprime. The case x0 + 1 = 2x2 . Therefore x0 ± 1 are coprime. Solution.e. the equality (x0 − 1)(x0 + 1) = py2 gives us x0 ± 1 = 2x2 and x0 ∓ 1 = 2py2 . A natural starting point (and the only one we see!) is the existence of an integral solution (x0 . Prove that 3n − 2 is a square only for n = 1 and n = 3. Thus in the relation x2 − 1 = (x0 − 1)(x0 + 1) = 0 0 0 py2 . x0 + 1 = 2py2 and therefore x2 − py2 = −1. 11. Prove that the equation x2 − py2 = −1 has integral solutions if and only if p = 2 or p ≡ 1 (mod 4). 14. then p | x2 + 1. This is very similar to the previous problem. factors x0 + 1 and x0 − 1 have the greatest common divisor 2. and consequently one of 0 them is a doubled square (to be denoted by 2x2 ) and the other one 2p times a square (to be denoted by 2py2 ). then this square equals 9. Solution. y0 ) with x0 . show that exactly one of the equations x2 − py2 = ±2 has an integral solution. 7 + 482 2 2 We thus obtain a simpler expression for n. 5 which yields 48n = = √ √ (7 + 4 3)2k+1 + (7 − 4 3)2k+1 − 14 2k + 1 2k−3 2k + 1 2k−1 2 72k+1 − 7 + 48 7 + ··· . y0 ∈ N to the corresponding Pell’s equation: x2 − py2 = 1. If p is a prime of the form 4k + 3. y2 . making the divisibility by 56 obvious: n= 2k + 1 2k−1 2k + 1 2k−3 72k+1 − 7 +2 7 + 2 · 48 7 + ··· 2 24 2 10. hence either p = 2 or p ≡ 1 (mod 4).