Paul Yiu 4
Paul Yiu 4
Paul Yiu
Department of Mathematics
Florida Atlantic University
Spring 2007
Contents
1 Preliminaries 101
1.1 Innitude of prime numbers . . . . . . . . . . . . . . . 101
1.2 Euclidean algorithm and linear Diophantine equations . 101
1.2.1 Euclidean Algorithm . . . . . . . . . . . . . . . 101
1.3 The greatest common divisor . . . . . . . . . . . . . . 102
1.3.1 gcd(a, b) as an integer combination of a and b. . 103
1.3.2 Linear Diophantine equations . . . . . . . . . . 103
1.4 Chinese remainder theorem . . . . . . . . . . . . . . . 104
1.5 Fermats little theorem and the Euler -function . . . . 104
1.6 Some number theoretic functions . . . . . . . . . . . . 105
2 Pythagorean triangles 201
2.1 Construction of Pythagorean triangles . . . . . . . . . . 201
2.2 Primitive Pythagorean triangles with consecutive legs . 202
2.3 Fermat Last Theorem for n = 4 . . . . . . . . . . . . . 204
2.4 Nonexistence of a pair of Pythagorean triangles with
legs a, b, and a, 2b . . . . . . . . . . . . . . . . . . . . 206
2.5 Impossibility of 4 squares in arithmetic progression . . 207
3 Homogeneous quadratic equations in 3 variables 213
3.1 Pythagorean triangles revisited . . . . . . . . . . . . . 213
3.2 Rational points on a conic . . . . . . . . . . . . . . . . 214
4 Integer triangles with a 60
or 120
angle 215
4.1 Integer triangles with a 60
angle . . . . . . . . . . . . 215
4.2 Integer triangles with a 120
angle . . . . . . . . . . . 217
4.3 A pair of discordant forms: x
2
xy +y
2
. . . . . . . . 219
iv CONTENTS
5 Heron triangles 221
5.1 The Heron formula . . . . . . . . . . . . . . . . . . . 221
5.2 Heron triangles . . . . . . . . . . . . . . . . . . . . . . 222
5.3 Construction of Heron triangles . . . . . . . . . . . . . 223
5.4 Heron triangles with sides in arithmetic progression . . 224
5.5 Heron triangles with integer inradii . . . . . . . . . . . 225
5.6 Impossibility of a Heron triangle with one side twice
another . . . . . . . . . . . . . . . . . . . . . . . . . . 226
6 Sums of two and four squares 301
6.1 Eulers proof of Fermats two-square theorem . . . . . 301
6.2 Representation of integers as sums of two squares . . . 302
6.3 Lagranges proof of the four-square theorem . . . . . . 303
6.3.1 Descent . . . . . . . . . . . . . . . . . . . . . . 303
7 Finite continued fractions 305
7.1 Eulers function for the convergents of a continued frac-
tion . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
7.2 Cornacchia algorithmfor a prime as a sumof two squares307
8 Quadratic Residues 401
8.1 The Legendre symbol . . . . . . . . . . . . . . . . . . 403
8.2 The law of quadratic reciprocity . . . . . . . . . . . . . 406
8.3 Calculation of square roots modulo p . . . . . . . . . . 409
8.4 Square roots modulo an odd prime power . . . . . . . . 411
8.5 Square modulo 2
k
. . . . . . . . . . . . . . . . . . . . 412
9 The ring of Gaussian integers 501
9.1 The ring Z[i] . . . . . . . . . . . . . . . . . . . . . . . 501
9.1.1 Norm and units . . . . . . . . . . . . . . . . . . 501
9.1.2 Gaussian primes . . . . . . . . . . . . . . . . . 501
9.2 An alternative proof of Fermats two-square theorem . . 503
10 Construction of indecomposable Heron triangles 505
10.1 Primitive Heron triangles . . . . . . . . . . . . . . . . 505
10.1.1 Rational triangles . . . . . . . . . . . . . . . . 505
10.1.2 Triple of simplifying factors . . . . . . . . . . . 506
10.1.3 Decomposition of Heron triangles . . . . . . . . 507
10.2 Gaussian integers . . . . . . . . . . . . . . . . . . . . 508
10.2.1 Heron triangles and Gaussian integers . . . . . . 509
CONTENTS v
10.3 Orthocentric Quadrangles . . . . . . . . . . . . . . . . 511
10.4 Indecomposable primitive Heron triangles . . . . . . . 512
10.4.1 Construction of Heron triangles with given sim-
plifying factors . . . . . . . . . . . . . . . . . . 513
11 Innite continued fractions 601
11.1 Lagranges Theorem . . . . . . . . . . . . . . . . . . . 604
11.1.1 Purely periodic continued fractions. . . . . . . . 604
11.1.2 Eventually periodic continued fractions . . . . . 604
11.1.3 Reduced quadratic irrationalities . . . . . . . . . 605
11.1.4 Proof of Lagranges theorem . . . . . . . . . . . 606
12 The Pell Equation 609
12.1 The equation x
2
dy
2
= 1 . . . . . . . . . . . . . . . 609
12.1.1 . . . . . . . . . . . . . . . . . . . . . . . . . . 611
12.2 The equation x
2
dy
2
= 1 . . . . . . . . . . . . . . 612
12.3 The equation x
2
dy
2
= c . . . . . . . . . . . . . . . 612
12.4 Applications . . . . . . . . . . . . . . . . . . . . . . . 614
13 Elliptic Curves 701
13.1 Group law on y
2
= x
3
+ax
2
+bx +c . . . . . . . . . 701
13.2 The discriminant . . . . . . . . . . . . . . . . . . . . . 702
14 Heron triangles and Elliptic Curves 705
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
. . . . . . . . 705
14.1.1 Proof of Theorem 14.1 . . . . . . . . . . . . . . 708
14.1.2 Theorem 11.4 . . . . . . . . . . . . . . . . . . . 904
Chapter 1
Preliminaries
1.1 Innitude of prime numbers
You certainly know that there are innitely many primes. You should
know how to explain this; I mean Euclids beautiful proof. There are
indeed many other proofs. Here is one which appeared most recently
([16]).
Let n be an arbitrary positive integer > 1. Since n and n +
1 are consecutive integers, they are relatively prime. Hence,
the number N
2
:= n(n + 1) must have two different prime
divisors. Similarly, since N
2
and N
2
+ 1 are consecutive, and
therefore relatively prime, the number N
3
:= N
2
(N
2
+1) must
have at least three distinct prime divisors. If we continue by
setting
N
k+1
= N
k
(N
k
+ 1), N
1
= n,
then by induction, N
k
has at least k distinct prime divisors. It
follows that the number of primes exceeds any nite integer.
1.2 Euclidean algorithm and linear Diophantine equa-
tions
1.2.1 Euclidean Algorithm
The euclidean algorithm afrms that in every division of integers, there
is a unique quotient and a unique remainder, under the stipulation that
the remainder must be smaller than the divisor.
102 Preliminaries
Theorem 1.1. Given integers a and b ,= 0, there are unique integers q
and r satisfying
a = bq +r, 0 r < [b[. (1.1)
If r = 0, we say that a is divisible by b, or simply that b divides a,
and write b[a.
1.3 The greatest common divisor
Suppose a = bq +c for integers a, b, c, and q. It is easy to see that every
common divisor of a and b is a common divisor of b and c, and con-
versely. We dene the greatest common divisor of two positive integers
a and b to be the greatest element of the (nonempty) set of common divi-
sors of a and b, denoted by gcd(a, b). Clearly, if b[a, then gcd(a, b) = b.
In general, from (1.1), we have gcd(a, b) = gcd(b, r). These observa-
tions lead to a straightforward calculation of the gcd of two numbers. To
be systematic, we write a = r
1
and b = r
0
(assumed positive).
r
1
=r
0
q
0
+r
1
, 0 r
1
< r
0
,
r
0
=r
1
q
1
+r
2
, 0 r
2
< r
1
,
r
1
=r
2
q
2
+r
3
, 0 r
3
< r
2
,
r
2
=r
3
q
3
+r
4
, 0 r
4
< r
3
,
.
.
.
This division process eventually terminates since the remainders get smaller
and smaller
r
1
> r
0
> r
1
> r
2
>
and yet remain nonnegative. In other words, some r
n
divides the pre-
ceding r
n1
(and leaves a remainder r
n+1
= 0).
.
.
.
r
n2
=r
n1
q
n1
+r
n
, 0 r
n
< r
n1
,
r
n1
=r
n
q
n
.
From these,
r
n
= gcd(r
n1
, r
n
) = gcd(r
n2
, r
n1
) = = gcd(r
1
, r
0
) = gcd(a, b).
1.3 The greatest common divisor 103
1.3.1 gcd(a, b) as an integer combination of a and b.
The above calculation of gcd(a, b) can be retraced to give gcd(a, b) as
an integer combination of a and b. We augment the table of calculations
with two extra rows of integers x
k
and y
k
obtained fromq
k1
in the same
way as r
k
, beginning with (x
1
, x
0
) = (1, 0) and (y
1
, y
0
) = (0, 1):
x
k
=x
k2
q
k1
x
k1
, x
1
= 1, x
0
= 0;
y
k
=y
k2
q
k1
y
k1
, y
1
= 0, y
0
= 1.
The calculation of gcd(a, b), and its expression in terms of a and b,
can be efciently performed by completing the following table.
k 1 0 1 2 . . . n 1 n
r
k
a b r
1
= a bq
0
r
2
= b r
1
q
1
. . . r
n1
r
n
= gcd
q
k
q
0
q
1
q
2
. . . q
n1
q
n
exactly divides
x
k
1 0
y
k
0 1
In each of these steps, r
k
= ax
k
+by
k
. In particular,
gcd(a, b) = r
n
= ax
n
+by
n
.
It can be proved that [x
n
[ < b and [y
n
[ < a.
1.3.2 Linear Diophantine equations
Theorem 1.2. Let a, b, c be integers, a and b nonzero. Consider the
linear Diophantine equation
ax +by = c. (1.2)
1. The equation (1.2) is solvable in integers if and only if d := gcd(a, b)
divides c.
2. If (x, y) = (x
0
, y
0
) is a particular solution of (1.2), then every
integer solution is of the form
x = x
0
+
b
d
t, y = y
0
a
d
t,
where t is an integer.
3. For c = gcd(a, b), a particular solution (x, y) = (x
0
, y
0
) of (1.2)
can be found such that [x
0
[ < [b[ and [y
0
[ < [a[.
104 Preliminaries
1.4 Chinese remainder theorem
You should know the Chinese remainder theorem as an explicit method
of calculation.
Theorem 1.3 (Chinese remainder theorem). If m
1
, m
2
, . . . , m
k
are
pairwise relatively prime integers, then the simultaneous congruences
x a
1
(mod m
1
)
x a
2
(mod m
2
)
.
.
.
x a
k
(mod m
k
)
has a unique solution x mod m, where m = m
1
m
2
m
k
.
This solution x is found by solving k similar but simpler problems,
each times replacing a
1
, . . . , a
k
by one 1 and all others 0. For j =
1, 2, . . . , k, nd a number b
j
satisfying
b
j
_
1 (mod m
i
), i = j,
0 (mod m
i
), i ,= j.
Such a number must be a multiple of m
1
m
j
m
k
. With such num-
bers b
1
, . . . , b
k
, the solution to the system of simultaneous congruences
above is then given by
x a
1
b
1
+a
2
b
2
+ +a
k
b
k
(mod m).
1.5 Fermats little theorem and the Euler -function
Theorem 1.4 (Fermats little theorem). If p is a prime number and
p ,[a, then a
p1
1 (mod p).
There is a very important generalization involving the Euler -function
(n) := [k Z : 1 k n and gcd(k, n) = 1[ .
1.6 Some number theoretic functions 105
Theorem 1.5. If gcd(a, n) = 1, then a
(n)
1 (mod n).
Proof. Let m = (n) and
a
1
, a
2
, . . . , a
m
be the mintegers in the range [1, n] relatively prime to n. If gcd(a, n) =
1, then
a a
1
, a a
2
, . . . , a a
m
represent exactly the same m congruence classes mod n. Therefore,
a
m
k
i=1
a
i
=
k
i=1
(a a
i
)
k
i=1
a
i
(mod n).
Cancelling the common invertible congruence class
k
i=1
a
i
, we have
a
m
1 (mod n).
1.6 Some number theoretic functions
Theorem 1.6 (Unique factorization). Every positive integer > 1 is
uniquely the product of distinct prime powers:
n =
k
i=1
p
a
i
i
.
Here are three important number theoretic functions.
1. The number of divisors function: d(n) := [d N : d[n[ .
2. The sum of divisors function: (n) :=
d|n
d.
3. Euler -function: (n) := [k Z : 1 k n and gcd(k, n) = 1[ .
Each of these functions is multiplicative, i.e., f(mn) = f(m)f(n)
if gcd(m, n) = 1. They are therefore determined by their values at the
prime powers.
1. d(p
a
) = 1 +a;
2. (p
a
) = 1 +p + +p
a
=
p
a+1
1
p1
;
3. (p
a
) = p
a
p
a1
= p
a
_
1
1
p
_
.
106 Preliminaries
Appendix: Perfect numbers
A perfect number is an integer equal to the sum of all of its divisors, in-
cluding 1 but excluding the number itself. Euclid had given the following
rule of construction of even perfect numbers. If M
k
:= 1 + 2 + +
2
k1
= 2
k
1 is a prime number,
1
then the number N
k
:= 2
k1
M
k
is perfect. Now, in terms of the function , an integer n is perfect if
(n) = 2n. Here is an easy proof of Euclids construction:
(N
k
) =(2
k1
M
k
) = (2
k1
)(M
k
) = (2
k
1)(1 +M
k
)
=M
k
2
k
= 2 2
k1
M
k
= 2N
k
.
Therefore, N
k
is an even perfect number perfect.
Euler has subsequently shown that every even perfect number must
be for this form.
2
Let N be an even perfect number, factored into the formN = 2
k1
m,
where k 1 1 and m is odd. Thus,
2N = (N) = (2
k1
m) = (2
k1
)(m) = (2
k
1)(m).
It follows that
(m) =
2N
2
k
1
=
2
k
2
k
1
m = m +
m
2
k
1
.
Note that the number
m
2
k
1
, being the difference (m)m, is an integer.
As such, it is a divisor of m. This expression shows that m has exactly
two divisors. From this we conclude that
m
2
k
1
= 1 and m = 2
k
1 is a
prime. This means that every even perfect number must be of the form
2
k1
(2
k
1) in which the factor 2
k
1 is a prime. This was exactly what
Euclid gave.
1
The number M
k
= 2
k
1 is usually known as the k-th Mersenne number. There are only 44 known
Mersenne primes. The latest and greatest record is M
32582657
which has 9808358 digits. It is also the
greatest known prime.
2
It is not known if an odd perfect number exists.
Chapter 2
Pythagorean triangles
2.1 Construction of Pythagorean triangles
By a Pythagorean triangle we mean a right triangle whose side lengths
are integers. Any common divisor of two of the side lengths is necessar-
ily a divisor of the third. We shall call a Pythagorean triangle primitive if
no two of its sides have a common divisor. Let (a, b, c) be one such trian-
gle. From the relation a
2
+b
2
= c
2
, we make the following observations.
1. Exactly two of a, b, c are odd, and the third is even.
2. In fact, the even number must be one of a and b. For if c is even,
then a and b are both odd, and c
2
= a
2
+b
2
1 +1 = 2 (mod 4),
an impossibility.
3. We shall assume a odd and b even, and rewrite the Pythagorean
relation in the form
c +a
2
c a
2
=
_
b
2
_
2
.
Note that the integers
c+a
2
and
ca
2
are relatively prime, for any
common divisor of these two numbers would be a common divisor
c and a. Consequently, each of
c+a
2
and
ca
2
is a square.
4. Writing
c+a
2
= u
2
and
ca
2
= v
2
, we have c = u
2
+ v
2
and a =
u
2
v
2
. From these, b = 2uv.
5. Since c and a are both odd, u and v are of different parity.
We summarize this in the following theorem.
202 Pythagorean triangles
Theorem 2.1. The side lengths of a primitive Pythagorean triangle are
of the form u
2
v
2
, 2uv, and u
2
+v
2
for relatively prime integers u and
v of different parity.
B
C A
u
2
v
2
2uv
u
2
+
v
2
Figure 2.1: Primitive Pythagorean triangle
Here are some simple properties of a primitive Pythagorean triangle.
1. Exactly one leg is even.
2. Exactly one leg is divisible by 3.
3. Exactly one side is divisible by 5.
4. The area is divisible by 6.
Exercise
Three relatively prime numbers a, b, c are such that a
2
, b
2
, c
2
are in
arithmetic progression. Show that they can be written in the form
a = p
2
+ 2pq +q
2
, b = p
2
+q
2
, c = p
2
+ 2pq q
2
for relatively prime integers p, q of different parity
2.2 Primitive Pythagorean triangles with consecutive legs
Let a, b, c be the lengths of the sides of a right triangle, c the hypotenuse.
Figures (a) and (b) below, together with the Pythagorean theorem, give
2.2 Primitive Pythagorean triangles with consecutive legs 203
the following two relations
(a +b c)
2
=2(c a)(c b), (2.1)
(a +b +c)
2
=2(c +a)(c +b). (2.2)
c b
c a
c b
c a
a + b c
a + b c
(a) a, b, c from c a
and c b
b
a
b
a
c
c
(b) a, b, c from c + a and c + b
Beginning with a right triangle (a, b, c), we construct a new right tri-
angle (a
, b
, c
) with c
= c +b and c
= c +a. By a comparsion
of (2.1) and (2.2), we have a
+b
=2a +b + 2c,
b
=a + 2b + 2c,
c
=2a + 2b + 3c.
Note that b
, b
, c
) one can
construct a smaller one (a, b, c) with the same difference between the
204 Pythagorean triangles
legs. More precisely,
a =2a
+b
2c
,
b =a
+ 2b
2c
, (2.3)
c =2a
2b
+ 3c
.
Since a+b+c = a
+b
< a
+b
+c
+ b
2c
+ b
> c
that 4a
> 3b
, or a
> 3(b
). This means
that from every Pythagorean triangle with legs differing by 1, there is
a descent, by repeated applications of (2.3), to a minimal integer right
triangle with shortest side not exceeding 3. It is clear that there is only
one such triangle, namely, (3,4,5). This therefore shows that the above
construction actually gives all Pythagorean triangles with consecutive
legs.
2.3 Fermat Last Theorem for n = 4
Theorem 2.2 (Fermat). The area of a Pythagorean triangle cannot be
a square.
Proof. Suppose to the contrary there is one such triangle, which we may
assume primitive, with side lengths (u
2
v
2
, 2uv, u
2
+ v
2
), u, v being
relative prime of different parity. The area A = uv(u
2
v
2
) being a
square, and no two of u, v, u
2
v
2
sharing common divisors, each of
these numbers must be a square. We write u = a
2
, v = b
2
so that
u
2
v
2
= a
4
b
4
is also a square. Since a
4
b
4
= (a
2
b
2
)(a
2
+ b
2
)
and the two factors are relatively prime, we must have a
2
b
2
= r
2
and
a
2
+b
2
= s
2
for some integers r and s. From these, 2a
2
= r
2
+s
2
and
(2a)
2
= 2(r
2
+s
2
) = (r +s)
2
+ (r s)
2
.
Thus, we have a new Pythagorean triangle (r s, r + s, 2a). This is a
Pythagorean triangle whose area is the square of an integer:
1
2
(r s)(r +s) =
1
2
(r
2
s
2
) = b
2
.
But it is a smaller triangle since b
2
= v is a proper divisor of A =
uv(u
2
v
2
). By descent, beginning with one Pythagorean triangle with
2.3 Fermat Last Theorem for n = 4 205
square area, we obtain an innite sequence of Pythagorean triangles with
decreasing areas, each of which is a square integer; a contradiction.
Corollary 2.3 (Fermat Last Theorem for n = 4). The equation
x
4
+y
4
= z
4
does not have solutions in nonzero integers.
Proof. Suppose x
4
+y
4
= z
4
for positive integers x, y, z. The Pythagorean
triangle with sides z
4
y
4
, 2z
2
y
2
and z
4
+y
4
has a square area
z
2
y
2
(z
4
y
4
) = z
2
y
2
x
4
= (x
2
yz)
2
,
a contradiction.
Remark. This proof actually shows that the equation x
2
+ y
4
= z
4
has
no solution in nonzero integers.
Theorem 2.4. There is no integer right triangle whose area is twice a
square.
Proof. Suppose there is one such triangle, which we may assume prim-
itive, with sides u
2
v
2
, 2uv, u
2
+ v
2
for relatively prime u and v of
different parity. The area is uv(u
2
v
2
). Note that u
2
v
2
and one
of u, v must be odd. Since u
2
v
2
is an odd square, u is odd and v is
even. The area being twice a square, we must have u = r
2
, v = 2s
2
,
u +v = m
2
, u v = n
2
for integers r, s, m, n. 4s
2
= 2v = m
2
n
2
=
(m + n)(m n). Since m + n and m n are even and have gcd = 1,
we have m + n = 2p
2
and m n = 2q
2
for relatively prime integers p
and q. Thus, m = p
2
+q
2
and n = p
2
q
2
. Also,
p
4
+q
4
=
1
2
_
(p
2
+q
2
)
2
+ (p
2
q
2
)
2
_
=
1
2
(m
2
+n
2
) = u = r
2
.
This gives a smaller integer triangle of sides (p
2
, q
2
, r) whose area is
1
2
(p
2
q
2
) = 2
_
pq
2
_
2
, twice a square. By descent, we arrive at a contradic-
tion.
Corollary 2.5. The equation x
4
+y
4
= z
2
has no nontrivial solution in
positive integers.
1
1
Here is a more direct proof of the corollary without invoking Pythagorean triangles. Suppose x
4
+y
4
=
z
2
with x, y, z pairwise relatively prime. By considering the equation modulo 4, we see that z and exactly
one of x, y must be odd. Assume x even. Note that x
4
= z
2
y
4
= (z y
2
)(z + y
2
). The two factors
206 Pythagorean triangles
Corollary 2.6. The product of 4 nonzero integers in arithmetic progres-
sion (with nonzero common difference) cannot be a fourth power of an
integer.
Proof. Given four integers in A. P., by doubling if necessary, we may
write the numbers as a 3d, a d, a +d, and a +3d, for integers a and
d. If their product
(a3d)(ad)(a+d)(a+3d) = (a
2
d
2
)(a
2
9d
2
) = a
4
10a
2
d
2
+9d
4
is a fourth power, say x
4
, we have x
4
+ (2d)
4
= (a
2
5d
2
)
2
, an impos-
siblity since d and x are nonzero.
Remark. We shall later prove the stronger result that the product of 4
distinct nonzero integers in arithmetic progression cannot be a square.
Exercise
Prove that the product of 4 consecutive integers cannot be a square.
2.4 Nonexistence of a pair of Pythagorean triangles with
legs a, b, and a, 2b
Proposition 2.7. There do not exist a pair of integer right triangles with
legs (a, b) and (a, 2b).
Proof. Suppose there is one such pair. We may assume a, b relatively
prime. We may also assume a odd, for if a is even, then we may replace
by the smaller pair (
a
2
, b) and (a, b). There are integers u, v, x, y such
that
(i) u and v are relatively prime and of different parity, and
a = u
2
v
2
, b = 2uv;
(ii) x and y are relatively prime and of different parity, and
a = x
2
y
2
, b = xy.
z y
2
and z + y
2
are both even; yet they cannot be both divisible by 4. We have two possiblities:
(i) z + y
2
= 8u
4
and z y
2
= 2v
4
for relatively prime u and v, or
(ii) z + y
2
= 2u
4
and z y
2
= 8v
4
.
In (i), y
2
= 4u
4
v
4
. But this is a contradiction modulo 4. Therefore, we must have (ii) and y
2
= u
4
4v
4
.
Thus, (u
2
+ y)(u
2
y) = 4v
4
. Thus, u and y are both odd, and u
2
+ y = 2r
4
and u
2
y = 2s
4
for
relatively prime r and s. From this, r
4
+ s
4
= u
2
. This is a smaller solution of the same equation since
z = u
4
+ 4v
4
> u. By innite descent, the equation has no nontrivial solution in positive integers.
2.5 Impossibility of 4 squares in arithmetic progression 207
This means xy = 2uv. There exist pairwise relatively prime integers p,
q, r, s such that
x = pq, y = 2rs; u = pr, v = qs.
Substitution into x
2
y
2
= u
2
v
2
gives
q
2
(p
2
+s
2
) = r
2
(p
2
+ 4s
2
).
Now, q is prime to r and p is prime to s. Note that any common divisor
of p
2
+ s
2
and p
2
+ 4s
2
must divide their difference and hence must be
a multiple of 3. This is impossible since gcd(p, s) = 1.
2
It follows that
p
2
+ s
2
= r
2
and p
2
+ 4s
2
= q
2
, and we have a smaller pair of integer
right triangles with legs (p, s) and (p, 2s). This pair is indeed smaller
since s v < b. This is a contradiction by innite descent.
Therefore, it is impossible to make x
2
+ y
2
and x
2
+ 4y
2
simultane-
ously squares. This is often expressed by saying that the two quadratic
forms are discordant.
2.5 Impossibility of 4 squares in arithmetic progression
We study the possibility of four integer squares in arithmetic progres-
sion. It is well known that n
2
is the sum of the rst n odd numbers,
i.e.,
1 + 3 + 5 + + (2n 1) = n
2
.
Suppose four integer squares A
2
, B
2
, C
2
, D
2
are in arithmetic pro-
gression. This means that the three segments of consecutive odd num-
bers
2A+ 1, . . . , 2B 1,
2B + 1, . . . , 2C 1,
2C + 1, . . . , 2D1
have equal sums. These segments have a = B A, b = C B, and
c = D C numbers respectively. Their sums are
a(A +B) =a(2B a),
b(B +C) =b(2B +b) = b(2C b),
c(C +D) =c(2C +c).
2
p
2
+ s
2
0 (mod 3) only if p s 0 (mod 3).
208 Pythagorean triangles
The rst two have equal sums if and only if 2B =
a
2
+b
2
ab
. Likewise, the
last two have equal sums if and only if 2C =
b
2
+c
2
bc
. It follows that if the
three sums are equal, then
b
2
+c
2
bc
a
2
+b
2
ab
= 2b. Simplifying this, we have
(a +c)b
2
+ (a c)
2
b ac(a +c) = 0.
This has integer solution in b only if (a c)
4
+ 4ac(a + c)
2
= a
4
+
14a
2
c
2
+ c
4
is the square of an integer. By writing x = a + c and
y = a c, we have x
4
x
2
y
2
+y
4
= z
2
for some integer z.
Proposition 2.8. The Diophantine equation x
4
x
2
y
2
+y
4
= z
2
has no
nonzero solutions in integers except x
2
= y
2
= z
2
.
Proof. Suppose there is a positive integer solution with x > y. We may
assume x and y relatively prime, and rewrite the equation in the form
(x
2
y
2
)
2
+ (xy)
2
= z
2
.
Here, x
2
y
2
and xy are relatively prime, so that (x
2
y
2
, xy, z) is a
primitive Pythagorean triple.
(1) Suppose both x and y are odd. Then there are relatively prime u,
v, of different parity, so that
x
2
y
2
= 2uv, xy = u
2
v
2
.
Here,
(u
2
v
2
)
2
+ (uv)
2
=
_
x
2
+y
2
2
_
2
,
or
u
4
u
2
v
2
+v
4
= z
2
,
This is an equation of the same type, in which u and v have different
parity. It is a smaller solution since
z
2
=
_
x
2
+y
2
2
_
2
=
1
4
[(x
2
y
2
)
2
+ 4(xy)
2
]
= u
2
v
2
+ (u
2
v
2
)
2
< (u
2
+v
2
)
2
= z
2
.
(2) Now consider the case when x and y are of different parity. We
shall assume y even. There are relatively prime integers u and v such
that
x
2
y
2
= u
2
v
2
, xy = 2uv.
This gives a pair of integer right triangles with legs (a, b) and (a, 2b).
Such a pair does not exist by Proposition 2.7.
2.5 Impossibility of 4 squares in arithmetic progression 209
Theorem 2.9. There do not exist 4 distinct nonzero squares in arithmeti-
cal progression.
Theorem 2.10. The product of 4 nonzero integers in arithmetic progres-
sion (with nonzero common difference) cannot be a square.
Proof. Consider an arithmetic progression a, a + d, a + 2d, a + 3d of
integers with a square product. We may assume gcd(a, d) = 1. The only
possibility of a pair of these numbers admitting a common divisor are
(i) gcd(a, a + 2d) = 2,
(ii) gcd(a +d, a + 3d) = 2, or
(iii) gcd(a, a+3d) = 3. Therefore, each of the numbers a, a+d, a+2d,
a+3d is a square with a possibly extra factor 2, 3 or 6. Here are the only
possibilities:
(a) A
2
, B
2
, C
2
, D
2
;
(b) 6A
2
, B
2
, 2C
2
, 3D
2
;
(c) 3A
2
, 2B
2
, C
2
, 6D
2
.
Case (a) is impossible by Theorem 2.9.
For cases (b) and (c), we make use of the easily veried identity (for
four terms in arithmetic progression):
(a + 2d)(a + 3d) a(a +d) = 2((a +d)(a + 3d) a(a + 2d)).
In (b), we have (2C
2
)(3D
2
)(6A
2
)(B
2
) = 2((B
2
)(3D
2
)(6A
2
)(2C
2
),
and C
2
(4A
2
+D
2
) = B
2
(A
2
+D
2
). Since we may assume A, B, C, D
relatively prime, this means that A
2
+D
2
and 4A
2
+D
2
are both squares,
contradicting Proposition 2.7
Similarly, in (c), we have C
2
(A
2
+ D
2
) = B
2
(A
2
+ 4D
2
), a contra-
diction for the same reasoning.
210 Pythagorean triangles
Appendix: Primitive Pythagorean triples < 1000
m, n a, b, c m, n a, b, c m, n a, b, c m, n a, b, c
2, 1 3, 4, 5 3, 2 5, 12, 13 4, 1 15, 8, 17 4, 3 7, 24, 25
5, 2 21, 20, 29 5, 4 9, 40, 41 6, 1 35, 12, 37 6, 5 11, 60, 61
7, 2 45, 28, 53 7, 4 33, 56, 65 7, 6 13, 84, 85 8, 1 63, 16, 65
8, 3 55, 48, 73 8, 5 39, 80, 89 8, 7 15, 112, 113 9, 2 77, 36, 85
9, 4 65, 72, 97 9, 8 17, 144, 145 10, 1 99, 20, 101 10, 3 91, 60, 109
10, 7 51, 140, 149 10, 9 19, 180, 181 11, 2 117, 44, 125 11, 4 105, 88, 137
11, 6 85, 132, 157 11, 8 57, 176, 185 11, 10 21, 220, 221 12, 1 143, 24, 145
12, 5 119, 120, 169 12, 7 95, 168, 193 12, 11 23, 264, 265 13, 2 165, 52, 173
13, 4 153, 104, 185 13, 6 133, 156, 205 13, 8 105, 208, 233 13, 10 69, 260, 269
13, 12 25, 312, 313 14, 1 195, 28, 197 14, 3 187, 84, 205 14, 5 171, 140, 221
14, 9 115, 252, 277 14, 11 75, 308, 317 14, 13 27, 364, 365 15, 2 221, 60, 229
15, 4 209, 120, 241 15, 8 161, 240, 289 15, 14 29, 420, 421 16, 1 255, 32, 257
16, 3 247, 96, 265 16, 5 231, 160, 281 16, 7 207, 224, 305 16, 9 175, 288, 337
16, 11 135, 352, 377 16, 13 87, 416, 425 16, 15 31, 480, 481 17, 2 285, 68, 293
17, 4 273, 136, 305 17, 6 253, 204, 325 17, 8 225, 272, 353 17, 10 189, 340, 389
17, 12 145, 408, 433 17, 14 93, 476, 485 17, 16 33, 544, 545 18, 1 323, 36, 325
18, 5 299, 180, 349 18, 7 275, 252, 373 18, 11 203, 396, 445 18, 13 155, 468, 493
18, 17 35, 612, 613 19, 2 357, 76, 365 19, 4 345, 152, 377 19, 6 325, 228, 397
19, 8 297, 304, 425 19, 10 261, 380, 461 19, 12 217, 456, 505 19, 14 165, 532, 557
19, 16 105, 608, 617 19, 18 37, 684, 685 20, 1 399, 40, 401 20, 3 391, 120, 409
20, 7 351, 280, 449 20, 9 319, 360, 481 20, 11 279, 440, 521 20, 13 231, 520, 569
20, 17 111, 680, 689 20, 19 39, 760, 761 21, 2 437, 84, 445 21, 4 425, 168, 457
21, 8 377, 336, 505 21, 10 341, 420, 541 21, 16 185, 672, 697 21, 20 41, 840, 841
22, 1 483, 44, 485 22, 3 475, 132, 493 22, 5 459, 220, 509 22, 7 435, 308, 533
22, 9 403, 396, 565 22, 13 315, 572, 653 22, 15 259, 660, 709 22, 17 195, 748, 773
22, 19 123, 836, 845 22, 21 43, 924, 925 23, 2 525, 92, 533 23, 4 513, 184, 545
23, 6 493, 276, 565 23, 8 465, 368, 593 23, 10 429, 460, 629 23, 12 385, 552, 673
23, 14 333, 644, 725 23, 16 273, 736, 785 23, 18 205, 828, 853 23, 20 129, 920, 929
24, 1 575, 48, 577 24, 5 551, 240, 601 24, 7 527, 336, 625 24, 11 455, 528, 697
24, 13 407, 624, 745 24, 17 287, 816, 865 24, 19 215, 912, 937 25, 2 621, 100, 629
25, 4 609, 200, 641 25, 6 589, 300, 661 25, 8 561, 400, 689 25, 12 481, 600, 769
25, 14 429, 700, 821 25, 16 369, 800, 881 25, 18 301, 900, 949 26, 1 675, 52, 677
26, 3 667, 156, 685 26, 5 651, 260, 701 26, 7 627, 364, 725 26, 9 595, 468, 757
26, 11 555, 572, 797 26, 15 451, 780, 901 26, 17 387, 884, 965 27, 2 725, 108, 733
27, 4 713, 216, 745 27, 8 665, 432, 793 27, 10 629, 540, 829 27, 14 533, 756, 925
27, 16 473, 864, 985 28, 1 783, 56, 785 28, 3 775, 168, 793 28, 5 759, 280, 809
28, 9 703, 504, 865 28, 11 663, 616, 905 28, 13 615, 728, 953 29, 2 837, 116, 845
29, 4 825, 232, 857 29, 6 805, 348, 877 29, 8 777, 464, 905 29, 10 741, 580, 941
29, 12 697, 696, 985 30, 1 899, 60, 901 30, 7 851, 420, 949 31, 2 957, 124, 965
31, 4 945, 248, 977 31, 6 925, 372, 997
5.7. Genealogy of primitive Pythagorean triples
A. Hall [6] has arranged the totality the primitive Pythagorean triples in
the form of a binary tree, with the (3, 4, 5) triangle at its root. Recall
that a primitive Pythagorean triangle is represented by a unique rational
number t =
n
m
, with gcd(m, n) = 1 and m, n of different parity. We call
2.5 Impossibility of 4 squares in arithmetic progression 211
t the rational parameter of the primitive Pythagorean triangle.
In this genealogy, each primitive Pythagorean triangle (with parame-
ter t) has exactly three descendents, with rational parameters s =
1
2t
,
1
2+t
,
t
1+2t
repsectively. (Check that each of these rational parameters does lie in the
open interval (0, 1), and is represented by a reduced fraction whose nu-
merator and denominator are of different parity). We shall keep to this
order of the descendents and label them the left (L), middle (M), and
right (R) respectively. Thus, the (3, 4, 5) triangle, with rational param-
eter
1
2
has left descendent
2
5
, middle descendent
2
3
and right descendent
1
4
.
1
2
2
3
2
5
1
4
3
4
3
8
2
7
5
8
5
12
2
9
4
7
4
9
1
6
If we write t =
n
m
, then these three descendents are
m
2mn
,
m
2m+n
and
n
m+2n
. If we call n +m the heights of the rational number
n
m
in reduced
form, these three descendents have greater heights.
Now, each rational number s (0, 1)
1
3
,
1
2
is the descendent of a
unique rational number t. In fact, given a rational number s =
q
p
(0, 1),
exactly one of
2s1
s
=
2qp
q
,
12s
s
=
p2q
q
, and
s
12s
=
q
p2q
is in (0, 1).
We call this the parent of s. In fact, s is
(i) the left descendent of
2qp
q
if q < p < 2q,
(ii) the middle descendent of
p2q
q
if 2q < p < 3q, and
(iii) the right descendent of
q
p2q
if p > 3q.
212 Pythagorean triangles
Therefore, each rational parameter s (0, 1)
1
3
,
1
2
has a unique
ancestral sequence tracing back to the root
1
2
(of height 3). For exam-
ple,
23
36
L
10
23
M
3
10
R
3
4
L
2
3
L
1
2
.
If we atten the entire ternary tree by listing the vertices in order,
beginning with the root, going down through each level from left to
right, what is the position of a vertex with a known ancestral sequence?
Suppose this ancestral sequence has k terms, i.e., the vertex is k levels
below the root. Convert it into an integer N in base 3 expansion by
L 0, M 1, R 2
respectively. Then the position of the vertex in the list is
1
2
(3
k
+1) +N.
For example, the rational number
23
36
is in position
1
2
(3
5
+1) +01200
3
=
122 + 45 = 167.
Exercise
What is the 1000-th vertex in this list? 1000 = 1+1+3+3
2
+3
3
+3
4
+3
5
+635.
The base 3 expansion of 635 is 2121123. The ancestral sequence of the vertex is therefore
40
169
R
40
89
M
9
40
R
9
22
M
4
9
M
1
4
R
1
2
.
1
2
2
3
2
5
1
4
3
4
3
8
2
7
5
8
5
12
2
9
4
7
4
9
1
6
1
3
3
5
3
7
1
5
5
7
5
13
3
11
7
11
7
17
3
13
5
9
5
11
1
7
Chapter 3
Homogeneous quadratic
equations in 3 variables
3.1 Pythagorean triangles revisited
A primitive Pythagorean triangle (a, b, c) corresponds to a point (x, y) =
_
a
c
,
b
c
_
in the rst quadrant on the unit circle
x
2
+y
2
= 1.
Every rational point on the unit circle can be expressed in terms of the
slope of the line joining the point to a xed point, say P = (1, 0) on
the circle. Thus, solving the equations
y =t(x + 1),
x
2
+y
2
=1,
simultaneously, we obtain (x, y) = (1, 0) = P or
(x, y) = P(t) =
_
1 t
2
1 +t
2
,
2t
1 +t
2
_
.
This is a point in the rst quadrant if and only if 0 < t < 1. By putting
t =
q
p
for relatively prime integers p > q, and we obtain
_
p
2
q
2
p
2
+q
2
,
2pq
p
2
+q
2
_
.
It follows that the sidelengths of a primitive Pythagorean triangle can be
written in the form
(a, b, c) =
1
g
_
p
2
q
2
, 2pq, p
2
+q
2
_
214 Homogeneous quadratic equations in 3 variables
for suitable choice of p and q. Here,
g = gcd(p
2
q
2
, 2pq) = gcd(p
2
q
2
, 2) = gcd(p q, 2).
To avoid repetition of representing a primitive Pythagorean triangle
by both (x, y) and (y, x) in the rst quadrant, we note that
_
1t
2
1+t
2
,
2t
1+t
2
_
=
_
2s
1+s
2
,
1s
2
1+s
2
_
if and only if s =
1t
1+t
. Thus, the rational number t =
q
p
and s =
q
=
pq
p+q
represent the same primitive Pythagorean triangle.
Note that gcd(p q, 2) = 1 if and only if gcd(p
, 2) = 2. Thus, we
may always restrict p and q of different parity.
3.2 Rational points on a conic
The method in the preceding section applies to a general (nonsingular)
homogeneous equation in 3 variables, or after dehomogenization, to a
nonsingular conic in the Cartesian plane. Suppose a nonsingular conic
f(x, y) = c contains a rational point P = (x
0
, y
0
). Then by passing
through P lines of rational slope t to intersect the conic again, we obtain
a parametrization of the rational points on the curve.
Proposition 3.1. (1) The rational solutions of x
2
dy
2
= 1 can be
parametrized in the form
(x, y) =
_
1 +dt
2
1 dt
2
,
2t
1 dt
2
_
.
(2) The positive integer solutions of x
2
dy
2
= z
2
can be parametrized
in the form
(x, y, z) =
1
g
_
p
2
+dq
2
, 2pq, p
2
dq
2
_
,
where g = gcd(p
2
+dq
2
, 2pq, p
2
dq
2
).
Chapter 4
Integer triangles with a 60
or
120
angle
4.1 Integer triangles with a 60
angle
If triangle ABC has C = 60
, then
c
2
= a
2
ab +b
2
. (4.1)
Integer triangles with a 60
or 120
angle
with
p
2
< q p.
gcd(a, b) =gcd(2pq p
2
, 2pq q
2
)
=gcd((p q)(p +q), q(2p q))
=gcd((p q)(p +q), 2p q)
since gcd(p q, q) = gcd(p +q, q) = gcd(p, q) = 1. Now,
gcd(p q, 2p q) = gcd(p q, p) = 1 and
gcd(p + q, 2p q) = gcd(p + q, 3p) = gcd(p + q, 3). This gives
gcd(a, b) = gcd(p +q, 3).
Proposition 4.1. The primitive integer triangles with a 60
angle are
given by
1
g
_
p(2q p), q(2p q), p
2
pq +q
2
_
,
where p and q are relatively prime positive integers satisfying
p
2
< q p
and g = gcd(p +q, 3).
p q (a, b, c)
1 1 (1, 1, 1)
3 2 (3, 8, 7)
4 3 (8, 15, 13)
5 3 (5, 21, 19)
5 4 (5, 8, 7)
6 5 (24, 35, 31)
7 4 (7, 40, 37)
7 5 (7, 15, 13)
7 6 (35, 48, 43)
8 5 (16, 55, 49)
8 7 (16, 21, 19)
9 5 (9, 65, 61)
9 7 (45, 77, 67)
9 8 (63, 80, 73)
10 7 (40, 91, 79)
10 9 (80, 99, 91)
Exercise
A standard calculus exercise asks to cut equal squares of dimension x
from the four corners of a rectangle of length a and breadth b so that the
box obtained by folding along the creases has a greatest capacity.
4.2 Integer triangles with a 120
angle 217
a
b
x
The answer to this problem is given by
x =
a +b
a
2
ab +b
2
6
.
How should one choose relatively prime integers a and b so that the
resulting x is an integer? For example, when a = 5, b = 8, x = 1.
Another example is a = 16, b = 21 with x = 3.
4.2 Integer triangles with a 120
angle
If triangle ABC has C = 120
, then
c
2
= a
2
+ab +b
2
. (4.3)
Integer triangles with a 120
31
2
.
218 Integer triangles with a 60
or 120
angle
Putting t =
q
p
for relatively prime integers p, q satisfying q <
31
2
p,
and clearing denominators, we obtain
a =p
2
q
2
,
b =q(2p +q),
c =p
2
+pq +q
2
,
with 0 < q < p. Note that
gcd(p
2
q
2
, q(2p +q) =gcd((p +q)(p q), q(2p +q))
=gcd((p +q)(p q), 2p +q)
=gcd(p q, 2p +q)
=gcd(p q, 3p)
=gcd(p q, 3).
Proposition 4.2. The primitive integer triangles with a 120
angle are
given by
1
g
_
p
2
q
2
, q(2p +q), p
2
+pq +q
2
_
,
where q <
_
31
2
_
p are relatively prime positive integers and g =
gcd(p q, 3).
p q (a, b, c)
3 1 (8, 7, 13)
4 1 (5, 3, 7)
5 1 (24, 11, 31)
6 1 (35, 13, 43)
7 1 (16, 5, 19)
7 2 (45, 32, 67)
8 1 (63, 17, 73)
9 1 (80, 19, 91)
9 2 (77, 40, 103)
10 1 (33, 7, 37)
10 3 (91, 69, 139)
Exercise
1 (a) Show that a number c is a sum of two consecutive squares if and
only if 2c 1 is a square.
4.3 A pair of discordant forms: x
2
xy + y
2
219
(b) Suppose an integer triangle contains a 120
and 120
, 2b, c).
The proof is similar to Proposition 2.7.
Theorem 4.4. The Diophantine equation x
4
+x
2
y
2
+y
4
= z
2
does not
have nonzero solutions in integers.
Proof. Suppose the equation has nontrivial solutions in integers x, y, z,
which we may assume relatively prime. Then (x
2
+ y
2
)
2
= z
2
+ (xy)
2
.
This give a primitive Pythagorean triangle, say with parameters u and v.
This means x and y are of different parity, and xy = 2uv, z = u
2
v
2
. This gives a pair of Pythagorean triangles with equal hypotenuses
and one with a leg twice a leg of the other, and is a contradiction to
Proposition 4.3.
Exercise
Show that in a parallelogram with a 60
or 120
angle
Chapter 5
Heron triangles
5.1 The Heron formula
Let ABC be a triangle with sidelengths BC = a, CA = b, AB = c, and
semiperimeter s =
1
2
(a + b + c). If the incircle touches the sides BC,
CA and AB respectively at X, Y , and Z,
AY = AZ = s a, BX = BZ = s b, CX = CY = s c.
s b s c
s c
s a
s a
s c
Z
X
Y
I
C
A
B
The radius r of the incircle and the area of the triangle are given
by
r =
_
(s a)(s b)(s c)
s
,
=
_
s(s a)(s b)(s c).
The latter one is the famous Heron formula. Explicitly in terms of a, b,
c, it can be written as
2
=
1
16
_
2a
2
b
2
+ 2b
2
c
2
+ 2c
2
a
2
a
4
b
4
c
4
_
. (5.1)
222 Heron triangles
Remark. The inradius of a right triangle is r = s c.
s a
s a
s b
s b
r
r
s c
s c
C A
B
Exercise
Given a positive integer r, determine all Pythagorean triangles with in-
radius r.
First consider the case of primitive Pythagorean triangles. The one with parameters p > q
(of different parity) has inradius r = q(p q). Note that p q must be odd, and q does not
contain any prime divisor of p q. There are 2
k
choices of p q, where k is the number of odd
prime divisors of r. In particular, there is only one (primitive) Pythagorean triangle of inradius
1, which is the (3, 4, 5) triangle.
5.2 Heron triangles
A Heron triangle is an integer triangle with integer area. Here are some
fundamental facts about Heron triangles.
Proposition 5.1. (1) The semiperimeter of a Heron triangle is an integer.
(2) The area of a Heron triangle is a multiple of 6.
Proof. It is enough to consider primitive Heron triangles, those whose
sides are relatively prime.
(1) Note that modulo 16, each of a
4
, b
4
, c
4
is congruent to 0 or 1,
according as the number is even or odd. To render in (5.1) the sum
2a
2
b
2
+ 2b
2
c
2
+ 2c
2
a
2
a
4
b
4
c
4
0 modulo 16, exactly two of a,
b, c must be odd. It follows that the perimeter of a Heron triangle must
be an even number.
(2) Since a, b, c are not all odd nor all even, and s is an integer, at
least one of s a, s b, s c is even. This means that is even.
We claim that at least one of s, s a, s b, s c must be a multiple
of 3. If not, then modulo 3, these numbers are +1 or 1. Since s =
(sa)+(sb)+(sc), modulo 3, this must be either 1 1+1+(1) or
5.3 Construction of Heron triangles 223
1 1+(1)+(1). In each case the product s(sa)(sb)(sc)
1 (mod 3) cannot be a square. This justies the claim that one of s,
s a, s b, s c, hence , must be a multiple of 3.
5.3 Construction of Heron triangles
Let t
1
= tan
A
2
, t
2
= tan
B
2
, and t
3
= tan
C
2
. Since
A
2
+
B
2
+
C
2
=
2
, we
have t
1
t
2
+t
2
t
3
+t
3
t
1
= 1. If we construct a triangle with sides
1
t
2
+
1
t
3
,
1
t
3
+
1
t
1
, and
1
t
1
+
1
t
2
, then it has inradius 1 and area
1
t
1
1
t
2
1
t
3
_
1
t
1
+
1
t
2
+
1
t
3
_
=
1
t
1
t
2
t
3
.
Writing t
i
=
p
i
q
i
for relatively prime integers p
i
, q
i
, i = 1, 2, and mag-
nifying the triangle by a factor p
1
p
2
p
3
, we obtain a Heron triangle with
sides
a = p
1
(p
2
q
3
+p
3
q
2
), b = p
2
(p
3
q
1
+p
1
q
3
), c = p
3
(p
1
q
2
+ p
2
q
1
),
and area p
1
p
2
p
3
q
1
q
2
q
3
and inradius p
1
p
2
p
3
.
p1q2p3 p1p2q3
p1p2q3
q1p2p3
q1p2p3
p1q2p3
p1p2p3
p1p2p3
p1p2p3
Z
X
Y
I
C
A
B
Note that these integers satisfy
p
1
p
2
q
3
+p
1
q
2
p
3
+q
1
p
2
p
3
= q
1
q
2
q
3
,
or
p
3
q
3
=
q
1
q
2
p
1
p
2
p
1
q
2
+p
2
q
1
.
224 Heron triangles
5.4 Heron triangles with sides in arithmetic progres-
sion
Consider a primitive Heron triangle with sides in arithmetic progression.
By Proposition 5.1, the sidelengths are 2a d, 2a, 2a +d for integers a
and d. The semiperimeter being s = 3a, we require (3a)(a)(a + d)(a
d) = 3a
2
(a
2
d
2
) to be an integer. This means
a
2
d
2
= 3b
2
(5.2)
for an integer b. With x =:
a
d
, y :=
b
d
, we transform this condition into
x
2
3y
2
= 1. The Heron triangles with sides in arithmetic progression,
therefore, correspond to the rational points in the rst quadrant on the
curve x
2
3y
2
= 1. Now, such rational points can be parametrized as
(x, y) =
_
1 + 3t
2
1 3t
2
,
2t
1 3t
2
_
, 0 < t <
1
3
.
The integer solutions of (5.2) are therefore
a = p
2
+ 3q
2
, d = p
2
3q
2
, b = 2pq
for relatively prime p, q satisfying p
2
> 3q
2
. This gives a Heron trian-
gle (2a d, 2a, 2a +d; 3ab). In each case, we obtain a primitive Heron
triangle by dividing the sidelengths by the g = gcd(2a, d) (and corre-
spondingly by g
2
).
Here are the primitive Heron triangles with sides in A.P., generated
by taking p 7:
1
p q (a, b, c; )
2 1 (13, 14, 15; 84)
3 1 (3, 4, 5; 6)
4 1 (25, 38, 51; 456)
5 1 (17, 28, 39; 210)
5 2 (61, 74, 87; 2220)
6 1 (15, 26, 37; 156)
7 1 (29, 52, 75; 546)
7 2 (85, 122, 159; 5124)
7 3 (65, 76, 87; 2394)
7 4 (193, 194, 195; 16296)
1
Note that some of these Heron triangles have consecutive integers as sidelengths, namely (3, 4, 5; 6),
(13, 14, 15; 84), and (193, 194, 195; 1629). These correspond to d = 1. We shall treat this case in detail
when we study the Pell equation. There is one such small triangle missing from the table, corresponding
to (p, q) = (9, 5).
5.5 Heron triangles with integer inradii 225
Exercise
Is there a Heron triangle whose sides are in geometric progression?
5.5 Heron triangles with integer inradii
We determine all Heron triangles with a given positive integer r as inra-
dius. This is equivalent to the solution of
uvw = r
2
(u +v +w) (5.3)
in positive integers u, v, w. We shall assume u v w (so that
A B C). The Heron triangle in question has sides a = v + w,
b = w + u, and c = u + v. We shall distinguish between three cases.
In each case, we nd appropriate bounds for v and w to determine if the
corresponding u is an integer.
Proposition 5.2. (1) For obtuse Heron triangles with given inradius r,
it is enough to check if
u =
r
2
(v +w)
vw r
2
. (5.4)
is an integer for w < r and
r
2
w
< v <
r(r+
r
2
+w
2
)
w
.
(2) For acute Heron triangles with given inradius r, it is enough to
check if u given by (5.4) is integer for
w <
3r and w v (
2 + 1)r.
(3) For Pythagorean triangles with given inradius r, it is enough to
check if u =
r(v+r)
vr
is an integer for r < v < (
2 + 1)r.
Proof. The expression (5.4) follows easily from (5.3).
(1) Since
C
2
4
, w < r. Clearly vw r
2
> 0. From u =
r
2
(v+w)
vwr
2
v, we have, after clearing denominator, wv
2
2r
2
v r
2
w < 0. Hence,
r
2
w
< v <
r(r+
r
2
+w
2
)
w
.
(2) If the triangle is acute angled, all u, v, w are greater than r. Since
C
2
>
6
,
r
w
> tan
3
=
1
3
, we have w <
3r. Also,
B
2
>
8
. This means
r
v
>
1
2+1
and v < (
2 + 1)r.
(3) In the Pythagorean case, r = w, so that (5.3) becomes uv = r(u+
v+r), and u =
r(v+r)
vr
v. By clearing denominator, r(v+r) v(vr),
v
2
2rv r
2
0, (v r)
2
2r
2
, v < (
2 + 1)r.
226 Heron triangles
Example 5.1. A Heron triangle is said to be perfect if its area is numer-
ically equal to its perimeter. Equivalently, a perfect Heron triangle has
inradius 2. Using Proposition 5.2 above,
(i) for obtuse triangles, we need only check w = 1, and 4 < v 8. For
v = 5, 6, 8, the corresponding u is an integer. These give three obtuse
Heron triangles.
w v u (a, b, c; )
1 5 24 (6, 25, 29; 60)
1 6 14 (7, 15, 20; 42)
1 8 9 (9, 10, 17; 36)
(ii) There is no acute Heron triangle with inradius 2. We need only
check w = 3 and v = 3, 4.
(iii) The only Pythagorean triangles with inradius 2 are (6, 8, 10; 24)
and (5, 12, 13; 30).
5.6 Impossibility of a Heron triangle with one side twice
another
Is there a Heron triangle in which one side is twice another?
2
Consider
a rational triangle with sides t
1
(t
2
+t
3
), t
2
(t
3
+t
1
) and t
3
(t
1
+t
2
), with
t
1
, t
2
, t
3
satisfying t
1
t
2
+ t
2
t
3
+ t
3
t
1
= 1. The condition 2 =
t
1
(t
2
+t
3
)
t
2
(t
1
+t
3
)
reduces to
t
1
t
2
2
2(1 +t
2
1
)t
2
+t
1
= 0.
This has rational solution in t
2
if and only if (1 +t
2
1
)
2
t
2
1
= 1 +t
2
1
+t
4
1
is the square of a rational number. Equivalently, writing t
1
=
y
x
, we have
x
4
+x
2
y
2
+ y
4
= . This is impossible by Theorem 4.4.
2
This is Problem 1193 of Crux Mathematicorum.
5.6 Impossibility of a Heron triangle with one side twice another 227
Appendix: Primitive Heron triangles with sides < 100
(a, b, c, ) (a, b, c, ) (a, b, c, ) (a, b, c, ) (a, b, c, )
(3, 4, 5, 6) (5, 5, 6, 12) (5, 5, 8, 12) (5, 12, 13, 30) (10, 13, 13, 60)
(4, 13, 15, 24) (13, 14, 15, 84) (9, 10, 17, 36) (8, 15, 17, 60) (16, 17, 17, 120)
(11, 13, 20, 66) (7, 15, 20, 42) (10, 17, 21, 84) (13, 20, 21, 126) (13, 13, 24, 60)
(12, 17, 25, 90) (7, 24, 25, 84) (14, 25, 25, 168) (3, 25, 26, 36) (17, 25, 26, 204)
(17, 25, 28, 210) (20, 21, 29, 210) (6, 25, 29, 60) (17, 17, 30, 120) (11, 25, 30, 132)
(5, 29, 30, 72) (8, 29, 35, 84) (15, 34, 35, 252) (25, 29, 36, 360) (19, 20, 37, 114)
(15, 26, 37, 156) (13, 30, 37, 180) (12, 35, 37, 210) (24, 37, 37, 420) (16, 25, 39, 120)
(17, 28, 39, 210) (25, 34, 39, 420) (10, 35, 39, 168) (29, 29, 40, 420) (13, 37, 40, 240)
(25, 39, 40, 468) (15, 28, 41, 126) (9, 40, 41, 180) (17, 40, 41, 336) (18, 41, 41, 360)
(29, 29, 42, 420) (15, 37, 44, 264) (17, 39, 44, 330) (13, 40, 45, 252) (25, 25, 48, 168)
(29, 35, 48, 504) (21, 41, 50, 420) (39, 41, 50, 780) (26, 35, 51, 420) (20, 37, 51, 306)
(25, 38, 51, 456) (13, 40, 51, 156) (27, 29, 52, 270) (25, 33, 52, 330) (37, 39, 52, 720)
(15, 41, 52, 234) (5, 51, 52, 126) (25, 51, 52, 624) (24, 35, 53, 336) (28, 45, 53, 630)
(4, 51, 53, 90) (51, 52, 53, 1170) (26, 51, 55, 660) (20, 53, 55, 528) (25, 39, 56, 420)
(53, 53, 56, 1260) (33, 41, 58, 660) (41, 51, 58, 1020) (17, 55, 60, 462) (15, 52, 61, 336)
(11, 60, 61, 330) (22, 61, 61, 660) (25, 52, 63, 630) (33, 34, 65, 264) (20, 51, 65, 408)
(12, 55, 65, 198) (33, 56, 65, 924) (14, 61, 65, 420) (36, 61, 65, 1080) (16, 63, 65, 504)
(32, 65, 65, 1008) (35, 53, 66, 924) (65, 65, 66, 1848) (21, 61, 68, 630) (43, 61, 68, 1290)
(7, 65, 68, 210) (29, 65, 68, 936) (57, 65, 68, 1710) (29, 52, 69, 690) (37, 37, 70, 420)
(9, 65, 70, 252) (41, 50, 73, 984) (26, 51, 73, 420) (35, 52, 73, 840) (48, 55, 73, 1320)
(19, 60, 73, 456) (50, 69, 73, 1656) (25, 51, 74, 300) (25, 63, 74, 756) (35, 44, 75, 462)
(29, 52, 75, 546) (32, 53, 75, 720) (34, 61, 75, 1020) (56, 61, 75, 1680) (13, 68, 75, 390)
(52, 73, 75, 1800) (40, 51, 77, 924) (25, 74, 77, 924) (68, 75, 77, 2310) (41, 41, 80, 360)
(17, 65, 80, 288) (9, 73, 80, 216) (39, 55, 82, 924) (35, 65, 82, 1092) (33, 58, 85, 660)
(29, 60, 85, 522) (39, 62, 85, 1116) (41, 66, 85, 1320) (36, 77, 85, 1386) (13, 84, 85, 546)
(41, 84, 85, 1680) (26, 85, 85, 1092) (72, 85, 85, 2772) (34, 55, 87, 396) (52, 61, 87, 1560)
(38, 65, 87, 1140) (44, 65, 87, 1386) (31, 68, 87, 930) (61, 74, 87, 2220) (65, 76, 87, 2394)
(53, 75, 88, 1980) (65, 87, 88, 2640) (41, 50, 89, 420) (28, 65, 89, 546) (39, 80, 89, 1560)
(21, 82, 89, 840) (57, 82, 89, 2280) (78, 89, 89, 3120) (53, 53, 90, 1260) (17, 89, 90, 756)
(37, 72, 91, 1260) (60, 73, 91, 2184) (26, 75, 91, 840) (22, 85, 91, 924) (48, 85, 91, 2016)
(29, 75, 92, 966) (39, 85, 92, 1656) (34, 65, 93, 744) (39, 58, 95, 456) (41, 60, 95, 798)
(68, 87, 95, 2850) (73, 73, 96, 2640) (37, 91, 96, 1680) (51, 52, 97, 840) (65, 72, 97, 2340)
(26, 73, 97, 420) (44, 75, 97, 1584) (35, 78, 97, 1260) (75, 86, 97, 3096) (11, 90, 97, 396)
(78, 95, 97, 3420)
Chapter 6
Sums of two and four squares
6.1 Eulers proof of Fermats two-square theorem
Theorem 6.1. Let p be an odd prime. p is a sum of two squares if and
only if p 1 (mod 4). In this case, the expression is unique.
Proof. Since p 1 (mod 4), the equation x
2
+ y
2
= mp is solvable in
integers for some m. We want to show that the smallest possible value of
m is 1. Note that we may choose [x[, [y[ <
p
2
so that m <
p
2
. If m ,= 1, it
cannot divide both of x and y, for otherwise m
2
[x
2
+y
2
= mp and m[p,
contrary to m <
p
2
. Now choose integers a and b such that x
1
= x am
and y
1
= y bm satisfy [x
1
[, [y
1
[
m
2
. Note that x
1
and y
1
cannot be
both zero, and
0 < x
2
1
+y
2
1
m
2
2
.
It follows that x
2
1
+y
2
1
= m
m for some m
m
2
< m. Now,
m
2
m
p = (x
2
+y
2
)(x
2
1
+ y
2
1
) = (xx
1
+yy
1
)
2
+ (xy
1
yx
1
)
2
,
and
xx
1
+yy
1
= x(x am) +y(y bm) = (x
2
+y
2
) (ax +by)m = mX
xy
1
yx
1
= x(y bm) y(x am) = m(bx +ay) = mY
for some X and Y . From this it follows that
X
2
+Y
2
= m
p
with m
i
p
b
i
i
j
q
c
j
j
be the prime factorization of n in which the ps and qs are respectively
primes of the form 4k + 1 and 4k + 3. The number n is expressible as a
sum of two squares if and only if each of the exponents c
j
is even.
Proof. (Sufciency) Since 2 = 1
2
+ 1
2
, and every p
i
is a sum of two
squares, if every c
j
is even, by repeatedly using the composition formula
(a
2
+b
2
)(x
2
+y
2
) = (ax +by)
2
+ (ay bx)
2
we easily obtain n as a sum of two squares.
(Necessity) Let n be divisible by a prime q 3 (mod 4), with high-
est power q
c
, c odd. Consider a representation n = x
2
+ y
2
, with
gcd(x, y) = d > 1. Let q
c
. This is
positive since c is odd, contradicting Lemma 6.2 above.
6.3 Lagranges proof of the four-square theorem 303
6.3 Lagranges proof of the four-square theorem
Theorem 6.4. Every positive integer can be represented as a sum of four
squares of nonnegative integers.
Lemma 6.5 (4-square identity).
(x
2
1
+x
2
2
+x
2
3
+x
2
4
)(y
2
1
+y
2
2
+y
2
3
+y
2
4
) = z
2
1
+z
2
2
+z
2
3
+z
2
4
,
where
z
1
= x
1
y
1
+x
2
y
2
+x
3
y
3
+x
4
y
4
,
z
2
= x
1
y
2
x
2
y
1
+x
3
y
4
x
4
y
3
,
z
3
= x
1
y
3
x
2
y
4
x
3
y
1
+x
4
y
2
,
z
4
= x
1
y
4
+x
2
y
3
x
3
y
2
x
4
y
1
.
Therefore it is enough to prove Lagranges theorem for prime num-
bers.
Lemma 6.6. Let p be a prime number. There are integers x and y such
that x
2
+y
2
+ 1 0 (mod p).
Proof. The set S := x
2
Z
p
: x Z has exactly
p+1
2
elements; so
does the set T := (x
2
+ 1) Z
p
: x Z. Now,
[S T[ = [S[ +[T[ [S T[
p + 1
2
+
p + 1
2
p = 1.
Therefore, there are integers x and y satisfying x
2
(y
2
+1) (mod p),
i.e., x
2
+y
2
+ 1 0 (mod p).
6.3.1 Descent
Let p be a prime number. There are integers x and y such that x
2
+y
2
+1
is divisible by p. We write this in the form x
2
1
+ x
2
2
+ x
2
3
+ x
2
4
= kp for
some integer k. Clearly, we may assume [x
1
[, [x
2
[, [x
3
[, [x
4
[
p1
2
<
p
2
.
This means kp < 4
_
p
2
_
2
= p
2
and k < p. If k ,= 1, we shall show
that x
1
, x
2
, x
3
, x
4
can be replaced by another quadruple with a smaller
k. Then, by descent, we shall ultimately reach k = 1.
304 Sums of two and four squares
Suppose k is even. We may assume x
1
x
2
(mod 2) and x
3
x
4
(mod 2). Then
_
x
1
+x
2
2
_
2
+
_
x
1
x
2
2
_
2
+
_
x
3
+x
4
2
_
2
+
_
x
3
x
4
2
_
2
=
x
2
1
+x
2
2
+x
2
3
+x
2
4
2
=
k
2
p
with a smaller multiplier for p.
Suppose k is odd. For i = 1, 2, 3, 4, choose y
i
x
i
with [y
i
[ <
k
2
.
Note that y
2
1
+ y
2
2
+ y
2
3
+ y
2
4
x
2
1
+ x
2
2
+ x
2
3
+ x
2
4
(mod k). Write
y
2
1
+y
2
2
+y
2
3
+y
2
4
= kq for some q < k. Note that q must be nonzero.
1
Apply the four-square identity to the two quadruples x
i
and y
i
. The
left hand side is (kp)(kq) = k
2
pq. On the right hand side, z
2
, z
3
, z
4
are
clearly divisible by k; so is z
1
because z
1
= x
1
y
1
+x
2
y
2
+x
3
y
3
+x
4
y
4
x
2
1
+x
2
2
+x
2
3
+x
2
4
0 (mod k). Writing z
i
= kw
i
for i = 1, 2, 3, 4, we
have, from the 4-square identity, w
2
i
+w
2
2
+w
2
3
+w
2
4
= qp for q < k.
1
Chapter 7
Finite continued fractions
7.1 Eulers function for the convergents of a continued
fraction
Given two positive integers a > b, the gcd can be computed by succes-
sive divisions. More precisely, we form two sequences
r
0
, r
1
, r
2
, . . . , r
k
, . . .
and
q
1
, q
2
, . . . , q
k
,
by the following rules
(i) r
0
= a and r
1
= b;
(ii) q
k
=
r
k1
r
k
|;
(iii) r
k+1
= r
k1
q
k
r
k
.
The sequence r
k
eventually decreases to 0. If r
n+1
= 0, then r
n
is
the gcd of a and b. We call the sequence (r
k
) the euclidean algorithm
sequence of a and b.
Like the sequence r
k
, we use the same recurrence relations to gener-
ate two sequences s
k
and t
k
, using the same q
k
but with different initial
values
(iv) s
0
= 1, s
1
= 0;
(v) t
0
= 0, t
1
= 1.
It is clear that r
k
= as
k
+bt
k
for each k.
Proposition 7.1. (1) r
k
= as
k
+ bt
k
for every k. In particular, bt
k
r
k
(mod a).
306 Finite continued fractions
(2) The sequences (s
k
) and (t
k
) are alternating in sign. More pre-
cisely,
s
k
= (1)
k
[s
k
[ and t
k
= (1)
k+1
[t
k
[,
for k = 0, 1, 2, . . . , n + 1.
(3) The sequences ([s
k
[) and ([t
k
[) satisfy
[s
k+1
[ = [s
k1
[ +q
k
[s
k
[,
[t
k+1
[ = [t
k1
[ +q
k
[t
k
[.
(4) The sequence ([t
k
[) is increasing. Consequently, the reversal of
([t
k
[) is a euclidean algorithm sequence.
The euclidean algorithm sequence leads to the continued fraction ex-
pansion of the rational number
a
b
. Since
a
b
= q
1
+
1
q
2
+
1
q
3
+
1
.
.
. +
1
q
n1
+
1
qn
For convenience, we shall write this continued fraction as
[q
1
, q
2
, q
n
. . . , q
n1
, q
n
].
The convergents of the continued fraction [q
1
, q
2
, . . . , q
n
] are
[q
1
] =
q
1
1
,
[q
1
, q
2
] =
q
1
q
2
+ 1
q
2
,
[q
1
, q
2
, q
3
] =
q
1
q
2
q
3
+q
1
+q
3
q
2
q
3
+ 1
,
[q
1
, q
2
, q
3
, q
4
] =
q
1
q
2
q
3
q
4
+q
1
q
2
+q
1
q
4
+q
2
q
3
+ 1
q
2
q
3
q
4
+q
2
+q
4
,
.
.
.
These convergents are given by
[q
1
, q
2
, . . . , q
k
] =
F(q
1
, q
2
, . . . , q
k
)
F(q
2
, . . . , q
k
)
,
7.2 Cornacchia algorithm for a prime as a sum of two squares 307
where F is the Euler function obtained in the following way:
F(q
1
, q
2
, . . . , q
k
) is the sumq
1
q
2
q
k
and all products obtained by delet-
ing pairs of consecutive factors, with the stipulation that if k is even,
deleting all consecutive pairs leads to the empty product 1.
Note that
F(q
1
, q
2
, . . . , q
k
) = F(q
k
, , q
2
, q
1
);
F(q
1
, q
2
, . . . , q
k+1
) = F(q
1
, q
2
, . . . , q
k1
) +q
k+1
F(q
1
, q
2
, . . . q
k
).
In the euclidean algorithm sequence,
r
k
= F(q
k+1
, q
k+2
, . . . , q
n
),
for k = 0, 1, 2, . . . , n.
7.2 Cornacchia algorithm for a prime as a sum of two
squares
Theorem 7.2 (Cornacchia). Let p 1 (mod 4) be a prime, and q the
smaller positive square root of 1 mod p. If x and y are the rst
two remainders in the euclidean algorithm sequence of (p, q), then p =
x
2
+y
2
.
Proof. In the euclidean algorithm table for the pair (a, b) = (p, q) (end-
ing in n divisions), we make the following observations.
(1) n is even.
(2) The sequence ([t
k
[) is the reversal of (r
k
); i.e., [t
k
[ = r
n+1k
for ev-
ery k n.
(3) The sequence (q
k
) is palindromic; i.e., q
n+1k
= q
k
for every k n.
(4) r
2
k
+t
2
k
is divisible by p for every k.
(5) Let n = 2m. In the sequence (r
k
), r
m
is the rst term smaller than
p.
Clearly, [t
n+1
[ = p. Since r
n
= 1, we have qt
n
1 mod p, and
t
n
q mod p. It follows that t
n
= q or p q. The reversal of ([t
k
[)
is a euclidean algorithm sequence ending in exactly n divisions (as the
sequence (r
k
)). If [t
n
[ = p x, the sequence of division would be
p, p q, q, . . .
which would be longer than the division sequence of (p, q), a contradic-
tion. Thus,
308 Finite continued fractions
(1) n is even, and
(2) the reversal of sequence ([t
k
[) is the euclidean algorithm sequence of
(p, q), which is exactly the sequence (r
k
).
(3) is an immediate consequence of (2).
(4) follows from qt
k
r
k
mod p. Squaring, we have r
2
k
q
2
t
2
k
t
2
k
mod p, and r
2
k
+t
2
k
0 mod p.
(5) Write n = 2m. Note that r
m
= F(q
m+1
, q
m+2
, . . . , q
2m
), and p =
r
0
= F(q
1
, q
2
, . . . , q
2m
). Now,
r
2
m
= r
m
r
m
= F(q
m+1
, q
m+2
, . . . , q
2m
)F(q
m+1
, q
m+2
, . . . , q
2m
)
= F(q
m
, q
m1
, . . . q
1
)F(q
m+1
, q
m+2
, . . . , q
2m
)
= F(q
1
, q
2
, . . . q
m
)F(q
m+1
, q
m+2
, . . . , q
2m
).
It is clear that each term in the product is contained in F(q
1
, q
2
, . . . , q
2m
).
This shows that r
2
m
< p. On the other hand,
r
2
m1
= r
m1
r
m1
= F(q
m
, q
m+1
, q
m+2
, . . . , q
2m
)F(q
m
, q
m+1
, q
m+2
, . . . , q
2m
)
= F(q
m+1
, q
m
, q
m1
, . . . q
1
)F(q
m
, q
m+1
, q
m+2
, . . . , q
2m
)
= F(q
1
, q
2
, . . . q
m
, q
m+1
)F(q
m
, q
m+1
, q
m+2
, . . . , q
2m
).
Every product in F(q
1
, q
2
, . . . , q
2m
) is contained in this product. This
shows that r
2
m1
> p.
Now, since r
2
m
+r
2
m+1
= r
2
m
+t
2
nm
= r
2
m
+t
2
m
is divisible by p, and
r
m+1
< r
m
<
p, the sum r
2
m
+ r
2
m+1
being positive and smaller than
2p, must be p.
Chapter 8
Quadratic Residues
Let n > 1 be a given positive integer, and gcd(a, n) = 1. We say that
a Z
n
is a quadratic residue mod n if the congruence x
2
a mod n is
solvable. Otherwise, a is called a quadratic nonresidue mod n.
1. If a and b are quadratic residues mod n, so is their product ab.
2. If a is a quadratic residue, and b a quadratic nonresidue mod n, then
ab is a quadratic nonresidue mod n.
3. The product of two quadratic residues mod n is not necessarily a
quadratic residue mod n. For example, in Z
12
= 1, 5, 7, 11, only
1 is a quadratic residue; 5, 7, and 11 5 7 are all quadratic
nonresidues.
Theorem 8.1. Let p be an odd prime. Exactly one half of the elements
of Z
p
are quadratic residues.
Proof. Each quadratic residue modulo p is congruent to one of the fol-
lowing
1
2
(p 1) residues.
1
2
, 2
2
, . . . , k
2
, . . . ,
_
p 1
2
_
2
.
We showthat these residue classes are all distinct. For 1 h < k
p1
2
,
h
2
k
2
mod p if and only if (k h)(h + k) is divisible by p, this is
impossible since each of k h and h +k is smaller than p.
Corollary 8.2. If p is an odd prime, the product of two quadratic non-
residues is a quadratic residue.
402 Quadratic Residues
Theorem 8.3. Let p be an odd prime. 1 is a quadratic residue modp
if and only if p 1 mod 4.
Proof. If x
2
1 mod p, then (1)
p1
2
x
p1
1 mod p by Fer-
mats little theorem. This means that
p1
2
is even, and p 1 mod 4.
Conversely, if p 1 mod 4, the integer
p1
2
is even. By Wilsons
theorem,
((
p 1
2
)!)
2
=
p1
2
i=1
j
2
=
p1
2
i=1
j(j)
p1
2
i=1
j(pj) = (p1)! 1 mod p.
The solutions of x
2
1 mod p are therefore x (
p1
2
)!.
Here are the square roots of 1 mod p for the rst 20 primes of the
form 4k + 1:
p
1 p
1 p
1 p
1 p
1
5 2 13 5 17 4 29 12 37 6
41 9 53 23 61 11 73 27 89 34
97 22 101 10 109 33 113 15 137 37
149 44 157 28 173 80 181 19 193 81
Theorem 8.4. There are innitely many primes of the form 4n + 1.
Proof. Suppose there are only nitely many primes p
1
, p
2
, . . . , p
r
of the
form 4n + 1. Consider the product
P = (2p
1
p
2
p
r
)
2
+ 1.
Note that P 1 mod 4. Since P is greater than each of p
1
, p
2
, . . . , p
r
,
it cannot be prime, and so must have a prime factor p different from p
1
,
p
2
, . . . , p
r
. But then modulo p, 1 is a square. By Theorem 8.3, p must
be of the form 4n + 1, a contradiction.
In the table below we list, for primes < 40, the quadratic residues
and their square roots. It is understood that the square roots come in
pairs. For example, the entry (2,7) for the prime 47 should be interpreted
as saying that the two solutions of the congruence x
2
2 mod 47 are
x 7 mod 47. Also, for primes of the form p = 4n +1, since 1 is a
quadratic residue modulo p, we only list quadratic residues smaller than
p
2
. Those greater than
p
2
can be found with the help of the square roots of
1.
8.1 The Legendre symbol 403
3 (1,1)
5 (1,2) (1,1)
7 (1,1) (2,3) (4,2)
11 (1,1) (3,5) (4,2) (5,4) (9,3)
13 (1,5) (1,1) (3,4) (4,2)
17 (1,4) (1,1) (2,6) (4,2) (8,5)
19 (1,1) (4,2) (5,9) (6,5) (7,8) (9,3) (11,7) (16,4)
(17,6)
23 (1,1) (2,5) (3,7) (4,2) (6,11) (8,10) (9,3) (12,9)
(13,6) (16,4) (18,8)
29 (1,12) (1,1) (4,2) (5,11) (6,8) (7,6) (9,3) (13,10)
31 (1,1) (2,8) (4,2) (5,6) (7,10) (8,15) (9,3) (10,14)
(14,13) (16,4) (18,7) (19,9) (20,12) (25,5) (28,11)
37 (1,6) (1,1) (3,15) (4,2) (7,9) (9,3) (10,11) (11,14) (12,7)
(16,4)
8.1 The Legendre symbol
Let p be an odd prime. For an integer a, we dene the Legendre symbol
_
a
p
_
:=
_
+1, if a is a quadratic residue mod p,
1, otherwise.
Lemma 8.5.
_
ab
p
_
=
_
a
p
__
b
p
_
.
Proof. This is equivalent to saying that modulo p, the product of two
quadratic residues (respectively nonresidues) is a quadratic residue, and
the product of a quadratic residue and a quadratic nonresidue is a quadratic
nonresidue.
For an odd prime p,
_
1
p
_
= (1)
1
2
(p1)
. This is a restatement of
Theorem 8.3 that 1 is a quadratic residue mod p if and only if p
1 mod 4.
Theorem 8.6 (Euler). Let p be an odd prime. For each integer a not
divisible by p,
_
a
p
_
a
1
2
(p1)
mod p.
Proof. Suppose a is a quadratic nonresidue mod p. The mod p residues
1, 2, . . . , p 1 are partitioned into pairs satisfying xy = a. In this case,
(p 1)! a
1
2
(p1)
mod p.
404 Quadratic Residues
On the other hand, if a is a quadratic residue, with a k
2
(p
k)
2
mod p, apart from 0, k, the remaining p 3 elements of Z
p
can be
partitioned into pairs satisfying xy = a.
(p 1)! k(p k)a
1
2
(p3)
a
1
2
(p1)
mod p.
Summarizing, we obtain
(p 1)!
_
a
p
_
a
1
2
(p1)
mod p.
Note that by putting a = 1, we obtain Wilsons theorem: (p 1)!
1 mod p. By comparison, we obtain a formula for
_
a
p
_
:
_
a
p
_
a
1
2
(p1)
mod p.
Theorem 8.7 (Gauss Lemma). Let p be an odd prime, and a an integer
not divisible by p. Then
_
a
p
_
= (1)
,
and negative ones
s
1
, s
2
, . . . , s
.
Here, + =
p1
2
, and 0 < r
i
, s
j
<
p
2
.
8.1 The Legendre symbol 405
Note that no two of the rs are equal; similarly for the ss. Suppose
that r
i
= s
j
for some indices i and j. This means
ha r
i
mod p; ka s
j
mod p
for some h, k in the range 0 < h, k <
1
2
(p 1). Note that (h + k)a
0 mod p. But this is a contradiction since h + k < p 1 and p does not
divide a. It follows that
r
1
, r
2
, . . . , r
, s
1
, s
2
, . . . , s
are a permutation of 1, 2, . . . ,
1
2
(p 1). From this
a 2a
p 1
2
a = (1)
1 2
p 1
2
,
and a
1
2
(p1)
= (1)
. By Theorem 8.6,
_
a
p
_
= (1)
.
Example
Let p = 19 and a = 5. We consider the rst 9 multiples of 5 mod 19.
These are
5, 10, 15, 20 1, 25 6, 30 11, 35 16, 40 2, 45 7.
4 of these exceed 9, namely, 10, 15, 11, 16. It follows that
_
5
19
_
= 1; 5
is a quadratic residue mod 19.
1
Theorem 8.8.
_
2
p
_
= (1)
[
1
4
(p+1)]
= (1)
1
8
(p
2
1)
.
Equivalently,
_
2
p
_
= +1 if and only if p 1 mod 8.
Proof. We need to see how many terms in the sequence
2 1, 2 2, 2 3, . . . , 2
p 1
2
are in the range
p
2
< x < p. If p = 4k + 1, these are the numbers
2k+2, . . . , 4k, and there are k of them. On the other hand, if p = 4k+3,
these are the numbers 2k + 2, . . . , 4k + 2, and there are k + 1 of them.
In each case, the number of terms is [
1
4
(p + 1)].
1
Indeed 5 9
2
mod 19.
406 Quadratic Residues
Example
Square root of 2 mod p for the rst 20 primes of the form 8k 1.
p
2 p
2 p
2 p
2 p
2
7 3 17 6 23 5 31 8 41 17
47 7 71 12 73 32 79 9 89 25
97 14 103 38 113 51 127 16 137 31
151 46 167 13 191 57 193 52 199 20
8.2 The law of quadratic reciprocity
Theorem 8.9 (Law of quadratic reciprocity). Let p and q be distinct
odd primes.
_
p
q
__
q
p
_
= (1)
p1
2
q1
2
.
Equivalently, when at least one of p, q 1 mod 4, p is a quadratic
residue mod q if and only if q is a quadratic residue mod p.
2
Proof. (1) Let a be an integer not divisible by p. Suppose, as in the proof
of Gauss Lemma above, of the residues a, 2a, . . .
p1
2
a, the positive least
absolute value representatives are r
1
, r
2
, . . . , r
, k
1
, . . . , k
are a permutation of 1, 2, . . . ,
p1
2
. Con-
2
For p q 3 mod 4, p is a quadratic residue mod q if and only if q is a quadratic nonresidue
mod p.
8.2 The law of quadratic reciprocity 407
sidering the sum of these numbers, we have
a
1
2
(p1)
m=1
m =p
1
2
(p1)
m=1
_
ma
p
_
+
i=1
r
i
+
j=1
(p s
j
)
=p
1
2
(p1)
m=1
_
ma
p
_
+
i=1
r
i
+
j=1
s
j
+
j=1
(p 2s
j
)
=p
1
2
(p1)
m=1
_
ma
p
_
+
1
2
(p1)
m=1
m + p 2
j=1
s
j
.
In particular, if a is odd, then
1
2
(p1)
m=1
_
ma
p
_
(mod 2),
and by Gauss lemma,
_
a
p
_
= (1)
1
2
(p1)
m=1
ma
p
|
.
(2) Therefore, for distinct odd primes p and q, we have
_
q
p
_
= (1)
1
2
(p1)
m=1
mq
p
|
,
and
_
p
q
_
= (1)
1
2
(q1)
n=1
np
q
|
.
(3) In the diagram above, we consider the lattice points (m, n) with
1 m
p1
2
and 1 n
q1
2
. There are altogether
p1
2
q1
2
such
points forming a rectangle. These points are separated by the line L of
slope
q
p
through the point (0,0).
For each m = 1, 2, . . . ,
p1
2
, the number of points in the vertical line
through (m, 0) under L is
mq
p
|. Therefore, the total number of points
under L is
1
2
(p1)
m=1
_
mq
p
_
. Similarly, the total number of points on the
left side of L is
1
2
(q1)
n=1
_
np
q
_
. From these, we have
408 Quadratic Residues
1 2
p
2
1
2
q
2
n
m
1
2
(p1)
m=1
_
mq
p
_
+
1
2
(q1)
n=1
_
np
q
_
=
p 1
2
q 1
2
.
It follows that
_
p
q
__
q
p
_
= (1)
p1
2
q1
2
.
The lawof quadratic reciprocity can be recast into the following form:
_
p
q
_
=
_
_
_
_
q
p
_
, if p q 3 mod 4,
+
_
q
p
_
, otherwise.
Examples
1.
_
59
131
_
=
_
131
59
_
=
_
13
59
_
=
_
59
13
_
=
_
7
13
_
=
_
13
7
_
=
_
1
7
_
= (1) = 1.
2.
_
34
97
_
=
_
2
97
_ _
17
97
_
. Now,
_
2
97
_
= +1 by Theorem 8.8, and
_
17
97
_
=
_
97
17
_
=
_
12
17
_
=
_
3
17
__
4
17
_
=
_
3
17
_
=
_
17
3
_
=
_
2
3
_
= 1.
8.3 Calculation of square roots modulo p 409
3. For which primes p is 3 a quadratic residue ?
_
3
p
_
= (1)
p1
2
_
p
3
_
= (1)
k+
1
2
(1)
= (1)
k
provided p = 6k + , = 1. This means 3 is a quadratic residue
mod p if and only if k is even, i.e., p = 12m1.
8.3 Calculation of square roots modulo p
1. Let p be a prime of the form 4k + 3. If
_
a
p
_
= 1, then the square
roots of a mod p are a
1
4
(p+1)
.
Proof.
_
a
1
4
(p+1)
_
2
a
1
2
(p+1)
= a
1
2
(p1)
a =
_
a
p
_
a = a mod p.
2. Let p be a prime of the form 8k + 5. If
_
a
p
_
= 1, then the square
roots of a mod p are
a
1
8
(p+3)
if a
1
4
(p1)
1 mod p,
2
1
4
(p1)
a
1
8
(p+3)
if a
1
4
(p1)
1 mod p.
Proof. Note that
_
a
1
8
(p+3)
_
2
a
1
4
(p+3)
= a
1
4
(p1)
a mod p.
Since
_
a
p
_
= a
1
2
(p1)
1 mod p, we have a
1
4
(p1)
1 mod p.
If a
1
4
(p1)
1 mod p, then this gives a
1
8
(p+3)
as a square root of
a mod p.
If a
1
4
(p1)
1 mod p, then we have
a
_
a
1
8
(p+3)
_
2
_
y
p
_
_
a
1
8
(p+3)
_
2
_
y
1
4
(p1)
a
1
8
(p+3)
_
2
for any quadratic nonresidue y mod p. Since p 5 mod 8, we
may simply take y = 2.
410 Quadratic Residues
Examples
1. Let p = 23. Clearly 2 is a quadratic residue mod 23. The square
roots of 2 are 2
6
18 5 mod 23.
2. Let p = 29. Both 6 and 7 are quadratic residues mod 29.
Since 7
7
1 mod 29, the square root of 7 are 7
4
23
6 mod 29.
On the other hand, Since 6
7
1 mod 29, the square roots of 6
are 2
7
6
4
12 20 8 mod 29.
Proposition 8.10. Let p be an odd prime and p 1 = 2
u, u odd.
Consider the congruence x
2
a (mod p). Let b be any quadratic non-
residue mod p. Assume that a
u
, 1 (mod p), and that > 1 is the
smallest integer for which (a
u
)
2
p
. Then with b
k
ac
2
k
p
k
(mod p), We have a solution c
k+1
=
c
k
+b
k
p
k
(mod p
k+1
) of x
2
a (mod p
k+1
).
Example 8.2. The solutions of the congruences x
2
12345 (mod 7
k
)
for k 8 are as follows:
k 1 2 3 4 5 6 7 8
x (mod 7
k
) 2 37 37 380 5182 89217 677462 3148091
The base 7 expansions of these solutions are x 1235521052
7
.
412 Quadratic Residues
8.5 Square modulo 2
k
Here are the squares modulo 2
k
, up to k = 7.
Z
4
: 0, 1,
Z
8
: 4,
Z
16
: 9,
Z
32
: 16, 17, 25,
Z
64
: 33, 36, 41, 49, 57,
Z
128
: 64, 65, 68, 73, 81, 89, 97, 100, 105, 113, 121.
It is easy to see that the analogue of Proposition 8.2.2 is no longer
true. For example, 1 is clearly a square of Z
4
; but 5 = 1 + 4 is not a
square in Z
8
.
Suppose c Z
2
k is a square. Let h be the smallest integer such that
c = (a+2
h
)
2
for some a Z
2
h1 . Since c = (a+2
h
)
2
= a
2
+2
h+1
a+2
2h
,
we must have h + 1 < k, and h k 2.
From this, we infer that 5 is not a square, and the squares in Z
8
are
0, 1, 4. Also, apart from these, the squares in Z
16
are 4
2
= 0, 5
2
= 9,
6
2
= 4, and 7
2
= 1. This means that the squares in Z
16
are 0, 1, 4 and 9.
Proposition 8.12. Let k 3. For every square c Z
2
k
, c + 2
k
is a
square in Z
2
k+1
.
Proof. Clearly, if c = 1, c + 2
k
= 1 + 2
k
= (1 + 2
k1
)
2
Z
2
k+1. If
c ,= 1, we write c = (a + 2
h
)
2
for 1 h k 2 and a Z
2
k3 . Then,
(a + 2
h
+ 2
k1
)
2
= c + 2
k
(a + 2
h
) + 2
2k2
. Since a is a unit, modulo
2
k+1
, this is c + 2
k
.
Corollary 8.13. A residue given in binary expansion
a = (a
k1
a
k2
a
1
a
0
)
2
,
is a quadratic residue mod 2
k
if and only if on the right of the rightmost
digit 1 there is an even number (possibly none) of zeros, and on its left
there are at least two zeros.
Chapter 9
The ring of Gaussian integers
9.1 The ring Z[i]
9.1.1 Norm and units
By the ring of Gaussian integers we mean
Z[i] := a +bi : a, b Z.
Each element of Z[i] is called a Gaussian integer. For = a + bi, we
dene the norm N() := a
2
+ b
2
Z. One important property of the
norm is its multiplicativity:
Lemma 9.1. For , Z[i],
N() = N()N().
A Gaussian integer is a unit if it is invertible in Z. If is a unit
with multiplicative inverse , then = 1 and N()N() = N() =
N(1) = 1. This means that N() = 1 and = 1, or i.
Proposition 9.2. The only units in Z[i] are 1 and i.
9.1.2 Gaussian primes
Two Gaussian integers and are associate if = for some unit
Z[i].
Exercise
1. Show that the relation of being associate is an equivalence relation
on Z[i].
502 The ring of Gaussian integers
2. Show that 2 is not a prime in Z[i].
A Gaussian integer Z[i] is prime if
(i) is not a unit in Z[i], and
(ii) = Z[i] or is a unit in Z[i].
Proposition 9.3. The ring of Gaussian integers satises the euclidean
algorithm: for , Z[i] with ,= 0, there are and Z[i] satisfying
(i) = + ,
(ii) N() < N().
Proof. Regarding and as complex numbers, we have
= x +iy for
rational numbers x and y. Let a and b be integers such that [x a[
1
2
and [y b[
1
2
. The numbers := a+bi and := ((xa) +(y b)i)
satisfy = and so is a Gaussian integer. Since
2
= (x a)
2
+ (y b)
2
1
4
+
1
4
1
2
,
we have N() < N().
Therefore, we have a notion of gcd in Z[i]. The gcd of two Gaussian
integers is dened up to a unit.
Corollary 9.4. The ring of Gaussian integers is a B ezout domain: for
, Z[i], there are , Z[i] such that
gcd(, ) = +.
Proposition 9.5. The following two statements are equivalent.
(i) Z[i] is a prime.
(ii) [ Z[i] [ or [.
Theorem 9.6. The primes in Z[i] are precisely
(i) the primes p 3 (mod 4) in Z,
(ii) 1 i which have norm 2, and
(iii) a +bi for which a
2
+b
2
is an odd prime p 1 (mod 4) in Z.
Corollary 9.7 (Unique factorization). Every nonzero Gaussian integer
can be decomposed uniquely into a product of Gaussian primes: if
=
1
h
=
1
k
for Gaussian primes
1
, . . . ,
1
and
1
, . . .
k
, then
(i) h = k,
(ii) after a suitable permutation of
1
, . . . ,
k
, for i = 1, 2, . . . , k, the
Gaussian primes
i
and
i
are associate.
9.2 An alternative proof of Fermats two-square theorem 503
9.2 An alternative proof of Fermats two-square theo-
rem
Since p 1 (mod 4), 1 is a quadratic residue. This means that there
exists an integer a
p1
2
such that a
2
+ 1 is divisible by p. Note that
a
2
+ 1 < p
2
.
Regarded as Gaussian integers, a
2
+1 = (a+i)(ai). We claim that
p does not divide a + i nor a i; otherwise, p
2
= N(p) N(a + i) =
a
2
+1 < p
2
, a contradiction. This means that p is not a prime in Z[i] and
there is a factorization of p = Z[i], in which none of , is a unit,
i.e., N(), N() > 1. It follows from
p
2
= N(p) = N()N()
that N() = N() = p, and p is a sum of two squares of integers.
504 The ring of Gaussian integers
Chapter 10
Construction of indecomposable
Heron triangles
10.1 Primitive Heron triangles
10.1.1 Rational triangles
Given a triangle ABC with sidelengths BC = a, CA = b and AB = c,
we let s :=
1
2
(a +b +c) be the semiperimeter, and
t
1
= tan
A
2
, t
2
= tan
B
2
, t
3
= tan
C
2
.
These satisfy
t
1
t
2
+t
2
t
3
+t
3
t
1
= 1. (10.1)
r
r
r
s b s c
s c
s a
s a
s b
I
X
Y
Z
A
B C
We shall assume throughout this chapter that all sidelengths of trian-
gles are rational. Such a triangle is called a rational triangle if its area is
506 Construction of indecomposable Heron triangles
rational. Equivalently, t
1
, t
2
, t
3
are all rational numbers. Putting t
i
=
n
i
d
i
,
i = 1, 2, 3, with gcd(n
i
, d
i
) = 1, we rewrite (14.1) in the form
n
1
n
2
d
3
+n
1
d
2
n
3
+d
1
n
2
n
3
= d
1
d
2
d
3
. (10.2)
A rational triangle, under a suitable magnication, gives a primitive
Heron triangle, one with integer sides which are relatively prime, and
with integer area. In fact, by putting
a =n
1
(d
2
n
3
+n
2
d
3
),
b =n
2
(d
3
n
1
+n
3
d
1
), (10.3)
c =n
3
(d
1
n
2
+n
1
d
2
),
we obtain a Heron triangle with semiperimeter s = n
1
n
2
d
3
+ n
1
d
2
n
3
+
d
1
n
2
n
3
= d
1
d
2
d
3
and area = n
1
d
1
n
2
d
2
n
3
d
3
. A primitive Heron
triangle
0
results by dividing by the sides by g := gcd(a
1
, a
2
, a
3
).
10.1.2 Triple of simplifying factors
Unless explicitly stated otherwise, whenever the three indices i, j, k
appear altogether in an expression or an equation, they are taken as a
permutation of the indices 1, 2, 3.
Note that from (14.1) or (10.2), any one of t
i
, t
j
, t
k
can be expressed
in terms of the remaining two. In the process of expressing t
i
=
n
i
d
i
in terms of t
j
=
n
j
d
j
and t
k
=
n
k
d
k
, we encounter certain simplifying
factors, namely,
g
i
:= gcd(d
j
d
k
n
j
n
k
, n
j
d
k
+d
j
n
k
),
so that
g
i
n
i
= d
j
d
k
n
j
n
k
,
g
i
d
i
= d
j
n
k
+n
j
d
k
, (10.4)
We shall call (g
1
, g
2
, g
3
) the triple of simplifying factors for the num-
bers (t
1
, t
2
, t
3
), or of the similarity class of triangles they dene.
Example 10.1. For the (13, 14, 15; 84), we have t
1
=
1
2
, t
2
=
4
7
and
t
3
=
2
3
. From
1 t
2
t
3
t
2
+t
3
=
7 3 4 2
7 2 + 4 3
=
13
26
=
1
2
,
10.1 Primitive Heron triangles 507
it follows that g
1
= 13. Similarly, g
2
= 1 and g
3
= 5. On the
other hand, for the indecomposable Heron triangle (25, 34, 39; 420), we
have (t
1
, t
2
, t
3
) = (
5
14
,
4
7
,
6
7
). The simplifying factors are (g
1
, g
2
, g
3
) =
(5, 17, 13).
Example 10.2. For (15, 34, 35; 252), the simplifying factors are (g
1
, g
2
, g
3
) =
(5, 17, 5).
Exercise
For the sidelengths given in (10.3), we have
a = g
1
n
1
d
1
, b = g
2
n
2
d
2
, c = g
3
n
3
d
3
.
10.1.3 Decomposition of Heron triangles
A Heron triangle := (a
1
, a
2
, a
3
; ) is said to be decomposable if
there are (nondegenerate) Pythagorean triangles
1
:= (x
1
, y, a
1
;
1
),
2
:= (x
2
, y, a
2
;
2
), and = 1 such that
a
3
= x
1
+x
2
, =
1
+
2
.
According as = 1 or 1, we shall say that is obtained by juxtaposing
1
and
2
, ( =
1
2
), or by excising
1
from
2
, ( =
2
1
).
In general, a Heron triangle is decomposable into two Pythagorean
components if and only if it has at least one integer height.
Theorem 10.1. A primitive Heron triangle can be decomposed into two
Pythagorean components in at most one way.
Proof. This follows from three propositions.
(1) A primitive Pythagorean triangle is indecomposable.
1
(2) A primitive, isosceles, Heron triangle is decomposable, the only
decomposition being into two congruent Pythagorean triangles.
2
1
Proof of (1). We prove this by contradiction. A Pythagorean triangle, if decomposable, is partitioned by
the altitude on the hypotenuse into two similar but smaller Pythagorean triangles. None of these, however,
can have all sides of integer length by the primitivity assumption on the original triangle.
2
Proof of (2). The triangle being isosceles and Heron, the perimeter and hence the base must be even.
Each half of the isosceles triangle is a (primitive) Pythagorean triangle, (m
2
n
2
, 2mn, m
2
+ n
2
), with
m, n relatively prime, and of different parity. The height on each slant side of the isosceles triangle is
2mn(m
2
n
2
)
m
2
+ n
2
,
which clearly cannot be an integer. This shows that the only way of decomposing a primitive isosceles
triangle is into two congruent Pythagorean triangles.
508 Construction of indecomposable Heron triangles
(3) If a non-Pythagorean Heron triangle has two integer heights, then
it cannot be primitive.
3
10.2 Gaussian integers
We shall associate with each positive rational number t =
n
d
, n, d rela-
tively prime, the primitive, positive Gaussian integer z(t) := d+n
1
Z[
1 is
primitive if x and y are relatively prime, and
positive if both x and y are positive.
The norm of the Gaussian integer z = x + y
1 is the integer
N(z) := x
2
+y
2
. The norm in Z[
1] is multiplicative:
N(z
1
z
2
) = N(z
1
)N(z
2
).
The argument of a Gaussian integer z = x + y
1 is the unique
real number = (z) [0, 2) dened by
cos =
x
_
x
2
+y
2
, sin =
y
_
x
2
+y
2
.
A Gaussian integer z is positive if and only if 0 < (z) <
1
2
. Each
positive Gaussian integer z = x +y
1 has a complement
z
:= y +x
1 =
1 z,
3
Proof of (3). Let (a, b, c; ) be a Heron triangle, not containing any right angle. Suppose the heights
on the sides b and c are integers. Clearly, b and c cannot be relatively prime, for otherwise, the heights of the
triangle on these sides are respectively ch and bh, for some integer h. This is impossible since, the triangle
not containing any right angle, the height on b must be less than c, Suppose therefore gcd(b, c) = g > 1.
We write b = b
g and c = c
and c
h
b
. Replacing h by b
h, we
may now assume that the heights on b and c are respectively c
h and b
k and
(c b
k) = 0, where g
2
= h
2
+ k
2
. It follows that
a
2
= (b
h)
2
+ (c
g b
k)
2
= b
2
(h
2
+ k
2
) + c
2
g
2
2b
gk
= g[g(b
2
+ c
2
) 2b
k]
From this it follows that g divides a
2
, and every prime divisor of g is a common divisor of a, b, c. The Heron
triangle cannot be primitive.
10.2 Gaussian integers 509
where z := x y
) = N(z),
and
(z) +(z
) =
2
. (10.5)
for each pair of complementary positive Gaussian integers.
Recall that the units of Z[
1. An
odd (rational) prime number p ramies into two non - associate primes
(p) and (p) in Z[
1] as follows.
Proposition 10.2. Let g > 1 be an odd number. There is a primitive
Gaussian integer satisfying N() = g if and only if each prime divisor
of g is congruent to 1 (mod 4).
10.2.1 Heron triangles and Gaussian integers
Consider the Heron triangle := (t
1
, t
2
, t
3
) with sides given by (10.3).
In terms of the Gaussian integers z
i
:= z(t
i
) = d
i
+n
i
1, the relations
(10.4) can be rewritten as
g
i
z
i
=
1 z
j
z
k
= (z
j
z
k
)
. (10.6)
Lemma 10.3. N(z
i
) = g
j
g
k
.
Proof. From the relation (10.6), we have
g
2
i
N(z
i
) = N(z
j
)N(z
k
).
Combining these, we have
(g
i
g
j
g
k
)
2
= N(z
i
)N(z
j
)N(z
k
),
and the result follows easily.
Proposition 10.4. (1) g
i
is a common divisor of N(z
j
) and N(z
k
).
(2) At least two of g
i
, g
j
, g
k
exceed 1.
(3) g
i
is even if and only if all n
j
, d
j
, n
k
and d
k
are odd.
(4) At most one of g
i
, g
j
, g
k
is even, and none of them is divisible by
4.
(5) g
i
is prime to each of n
j
, d
j
, n
k
, and d
k
.
(6) Each odd prime divisor of g
i
, i = 1, 2, 3, is congruent to 1 (mod 4).
510 Construction of indecomposable Heron triangles
Proof. (1) follows easily from Lemma 10.3.
(2) Suppose g
1
= g
2
= 1. Then, N(z
3
) = 1, which is clearly impos-
sible.
(3) is clear from the relation (10.4).
(4) Suppose g
i
is even. Then n
j
, d
j
, n
k
, d
k
are all odd. This means
that g
i
, being a divisor of N(z
j
) = d
2
j
+n
2
j
2 (mod 4), is not divisible
by 4. Also, d
j
d
k
n
j
n
k
and n
j
d
k
+d
j
n
k
are both even, and
(d
j
d
k
n
j
n
k
) + (n
j
d
k
+d
j
n
k
)
= (d
j
+n
j
)(d
k
+n
k
) 2n
j
n
k
2 (mod 4),
it follows that one of them is divisible by 4, and the other is 2 (mod 4).
After cancelling the common divisor 2, we see that exactly one of n
i
and
d
i
is odd. This means, by (c), that g
j
and g
k
cannot be odd.
(5) If g
i
and n
j
admit a common prime divisor p, then p divides both
n
j
and n
2
j
+ d
2
j
, and hence d
j
as well, contradicting the assumption that
d
j
+n
j
1 be primitive.
(6) is a consequence of Proposition 10.2.
Proposition 10.5. gcd(g
1
, g
2
, g
3
) = 1.
Proof. We shall derive a contradiction by assuming a common rational
prime divisor p 1 (mod 4) of g
i
, g
j
, g
k
, with positive exponents r
i
, r
j
,
r
k
in their prime factorizations. By the relation (10.6), the product z
j
z
k
is
divisible by the rational prime power p
r
i
. This means that the primitive
Gaussian integers z
j
and z
k
should contain in their prime factorizations
powers of the distinct primes (p) and (p). The same reasoning also
applies to each of the pairs (z
k
, z
i
) and (z
i
, z
j
), so that z
k
and z
i
(re-
spectively z
i
and z
j
) each contains one of the non - associate Gaussian
primes (p) and (p) in their factorizations. But then this means that z
j
and z
k
are divisible by the same Gaussian prime, a contradiction.
Corollary 10.6. If a, b, c are given as in (10.3), then
gcd(a, b, c) = gcd(n
1
d
1
, n
2
d
2
, n
3
d
3
).
Proof. This follows from the expressions (10.3): a
i
= g
i
n
i
d
i
, for i =
1, 2, 3, and Proposition 10.5.
10.3 Orthocentric Quadrangles 511
Exercise
Prove that a Heron triangle is Pythagorean if and only if its triple of
simplifying factors is of the form (1, 2, g), for an odd number g whose
prime divisors are all of the form 4m+ 1.
10.3 Orthocentric Quadrangles
Nowwe consider a rational triangle which does not contain a right angle.
The vertices and the orthocenter form an orthocentric quadrangle, i.e.,
each of these four points is the orthocenter of the triangle with vertices at
the remaining three points. If any of the four triangles is rational, then so
are the remaining three. The convex hull of these four points is an acute
- angled triangle . We label the vertices A, B, C, and the orthocenter
in the interior by H and use the following notation for triangles:
= ABC,
1
= HBC,
2
= BHC,
3
= ABH.
Let t
1
, t
2
, t
3
be the tangents of the half angles of , z
1
, z
2
, z
3
the asso-
ciated Gaussian integers, and (g
1
, g
2
, g
3
) the corresponding simplifying
factors. Then the tangents of the half angles of
k
are
1 t
i
1 +t
i
,
1 t
j
1 +t
j
, and
1
t
k
.
We rst assume that g
1
, g
2
, g
3
are all odd, so that for i = 1, 2, 3, d
i
and n
i
are of different parity, (Proposition 10.4(3)). The triangle
k
has
associated primitive Gaussian integers
z
i
= (d
i
+n
i
) + (d
i
n
i
)
1 = (1 +
1)z
i
,
z
j
= (d
j
+n
j
) + (d
j
n
j
)
1 = (1 +
1)z
j
,
z
k
= n
k
+d
k
1 =
1 z
k
. (10.7)
From these,
z
j
z
k
= (1 +
1)
1 z
j
z
k
= g
i
(1 +
1)z
i
= g
i
1 z
i
,
z
i
z
k
= (1 +
1)
1 z
i
z
k
= g
j
(1 +
1)z
j
= g
j
1 z
j
,
z
i
z
j
= 2
1 z
i
z
j
= 2g
k
z
k
= 2g
k
1 z
k
.
512 Construction of indecomposable Heron triangles
Thus, the triangle
k
has simplifying factors (g
i
, g
j
, 2g
k
).
Suppose now that one of the simplifying factors of , say, g
k
is even.
Then n
i
, d
i
, n
j
, d
j
are all odd, and n
k
, d
k
have different parity. A similar
calculation shows that the simplifying factors for the triangles
i
,
j
and
k
are (2g
i
, g
j
,
g
k
2
), (g
i
, 2g
j
,
g
k
2
), and (g
i
, g
j
,
g
k
2
) respectively.
We summarize these in the following proposition.
Proposition 10.7. The simplifying factors for the four (rational) trian-
gles in an orthocentric quadrangle are of the form(g
1
, g
2
, g
3
), (2g
1
, g
2
, g
3
),
(g
1
, 2g
2
, g
3
) and (g
1
, g
2
, 2g
3
), with g
1
, g
2
, g
3
odd integers.
10.4 Indecomposable primitive Heron triangles
A routine computer search gives the following indecomposable, primi-
tive Heron triangles with sides 100, excluding Pythagorean triangles:
(5, 29, 30; 72) (10, 35, 39; 168) (15, 34, 35; 252) (13, 40, 45; 252) (17, 40, 41; 336)
(25, 34, 39; 420) (5, 51, 52; 126) (15, 52, 61; 336) (20, 53, 55; 528) (37, 39, 52; 720)
(17, 55, 60; 462) (26, 51, 73; 420) (17, 65, 80; 288) (29, 65, 68; 936) (34, 55, 87; 396)
(39, 55, 82; 924) (41, 50, 89; 420) (35, 65, 82; 1092) (26, 75, 91; 840) (39, 58, 95; 456)
(17, 89, 90; 756) (26, 73, 97; 420) (41, 60, 95; 798) (51, 52, 97; 840)
We study the condition under which the primitive Heron triangle
0
=
0
(t
1
, t
2
, t
3
) constructed in 10.1.1 is indecomposable. Clearly,
0
= (t
1
, t
2
, t
3
) is indecomposable if this is so for the triangle dened
by (10.3). More remarkable is the validity of the converse.
Theorem 10.8. A non-Pythagorean, primitive Heron triangle
0
=
0
(t
1
, t
2
, t
3
)
is indecomposable if and only if each of the simplifying factors g
i
, i =
1, 2, 3, contains an odd prime divisor.
Proof. We rst prove the theorem for the triangle := (t
1
, t
2
, t
3
) de-
ned by (10.3).
Since has area = n
1
d
1
n
2
d
2
n
3
d
3
, the height on the side a
i
=
g
i
n
i
d
i
is given by
h
i
=
2n
j
d
j
n
k
d
k
g
i
.
Since the triangle does not contain a right angle, it is indecomposable if
and only if none of the heights h
i
, i = 1, 2, 3, is an integer. By Proposi-
tion 8(d), this is the case if and only if each of g
1
, g
2
, g
3
contains an odd
prime divisor.
10.4 Indecomposable primitive Heron triangles 513
To complete the proof, note that the sides (and hence also the heights)
of
0
are
1
g
times those of . Here, g := gcd(a
1
, a
2
, a
3
) = gcd(n
1
d
1
, n
2
d
2
, n
3
d
3
)
by Corollary 10.6. The heights of
0
are therefore
h
i
=
2n
j
d
j
n
k
d
k
g
i
g
=
2
g
i
n
j
d
j
n
k
d
k
gcd(n
1
d
1
, n
2
d
2
, n
3
d
3
)
.
Note that
n
j
d
j
n
k
d
k
gcd(n
1
d
1
,n
2
d
2
,n
3
d
3
)
is an integer prime to g
i
. If h
i
is not an
integer, then g
i
must contain an odd prime divisor, by Proposition 10.4(4)
again.
Corollary 10.9. Let be a primitive Heron triangle. Denote by
i
,
i = 1, 2, 3, the primitive Heron triangles in the similarity classes of
the remaining three rational triangles in the orthocentric quadrangle
containing . The four triangles and
i
, i = 1, 2, 3, are either all
decomposable or all indecomposable.
Example 10.3. From the orthocentric quadrangle of each the indecom-
posable Heron triangles (15, 34, 35; 252) and (25,34,39;420), we obtain
three other indecomposable primitive Heron triangles.
(a1, b1, c1) (g1, g2, g3) (a1, b1, c1) (g1, g2, g3)
(15, 34, 35; 252) (5, 17, 5) (25, 34, 39; 420) (5, 17, 13)
(55, 17, 60; 462) (5, 17, 10) (285, 187, 364; 26334) (5, 17, 26)
(119, 65, 180; 1638) (5, 17, 10) (700, 561, 169; 30030) (10, 17, 13)
(65, 408, 385; 12012) (5, 34, 5) (855, 952, 169; 62244) (5, 34, 13)
10.4.1 Construction of Heron triangles with given simplifying fac-
tors
Theorem 10.10. Let g
1
, g
2
, g
3
be odd numbers satisfying the following
conditions.
(i) At least two of g
1
, g
2
, g
3
exceed 1.
(ii) The prime divisors of g
i
, i = 1, 2, 3, are all congruent to 1 (mod
4).
(iii) gcd(g
1
, g
2
, g
3
) = 1.
Suppose g
1
, g
2
, g
3
together contain distinct rational (odd) prime divi-
sors. Then there are 2
1
distinct, primitive Heron triangles with sim-
plifying factors (g
1
, g
2
, g
3
).
514 Construction of indecomposable Heron triangles
Proof. Suppose (g
1
, g
2
, g
3
) satises these conditions. By (ii), there are
primitive Gaussian integers
i
, i = 1, 2, 3, such that g
i
= N(
i
). Since
gcd(g
1
, g
2
, g
3
) = 1, if a rational prime p 1 (mod 4) divides g
i
and g
j
,
then, in the ring Z[
3
and z
2
=
2
1
are positive.
Two positive Gaussian integers z
1
and z
2
dene a positive Gaussian
integer z
3
via (10.6) if and only if
0 < (z
1
) +(z
2
) <
2
. (10.8)
Since (z
1
) + (z
2
) = ((z
1
) + (z
2
)), it follows that exactly one
of the two pairs (z
1
, z
2
) and (z
1
, z
2
) satises condition (10.8). There are,
therefore, 2
1
Heron triangles with (g
1
, g
2
, g
3
) as simplifying factors.
Making use of Theorems 10.8, 10.10, and Proposition 10.7, it is now
easy to construct indecomposable primitive Heron triangles from any
triples of odd integers (g
1
, g
2
, g
3
), each greater than 1, and satisfying the
conditions of Theorem 10.10. For example, by choosing g
1
, g
2
, g
3
from
the rst few primes of the form 4k+1, we obtain the following primitive
Heron triangles, all indecomposable:
(g1, g2, g3) (d1, n1) (d2, n2) (d3, n3) (a, b, c; )
(5, 13, 17) (14, 5) (7, 6) (7, 4) (25, 39, 34; 420)
(5, 14) (9, 2) (8, 1) (175, 117, 68; 2520)
(11, 10) (7, 6) (8, 1) (275, 273, 68; 9240)
(10, 11) (9, 2) (7, 4) (275, 117, 238; 13860)
(5, 13, 29) (4, 19) (12, 1) (8, 1) (95, 39, 58; 456)
(16, 11) (8, 9) (8, 1) (110, 117, 29; 1584)
(11, 16) (12, 1) (7, 4) (220, 39, 203; 3696)
(19, 4) (8, 9) (7, 4) (95, 234, 203; 9576)
(5, 17, 29) (22, 3) (12, 1) (2, 9) (55, 34, 87; 396)
(18, 13) (9, 8) (9, 2) (65, 68, 29; 936)
(18, 13) (12, 1) (6, 7) (195, 34, 203; 3276)
(22, 3) (9, 8) (7, 6) (55, 204, 203; 5544)
(13, 17, 29) (22, 3) (16, 11) (10, 11) (39, 136, 145; 2640)
(22, 3) (19, 4) (5, 14) (429, 646, 1015; 87780)
(18, 13) (19, 4) (11, 10) (1521, 646, 1595; 489060)
(18, 13) (16, 11) (14, 5) (1521, 1496, 1015; 720720)
Further examples can be obtained by considering the orthocentric
quadrangle of each of these triangles.
Chapter 11
Innite continued fractions
Associated with an innite continued fraction [q
0
, q
1
, q
2
, q
3
, . . . , q
n
, . . . ]
is a sequence of convergents which are nite continued fractions:
P
k
Q
k
= [q
0
, q
1
, . . . , q
k
].
The numerators P
k
and Q
k
can be determined recursively as follows.
P
k
= P
k2
+q
k
P
k1
, P
2
= 0, P
1
= 1,
Q
k
= Q
k2
+q
k
Q
k1
, Q
2
= 1, Q
1
= 0.
Examples
1. The successive convergents of the continued fraction [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
are computed easily using these relations.
k 2 1 0 1 2 3 4 5 6 7 8 9
q
k
1 2 3 4 5 6 7 8 9 10
P
k
0 1 1 3 10 43 225 1393 9976 81201 740785 7489051
Q
k
1 0 1 2 7 30 157 972 6961 56660 516901 5225670
2. Here are the convergents of the continued fraction [1, 2, 1, 3, 1, 4, 1, 5, 1, 6]
and their differences:
1
3
2
4
3
15
11
19
14
91
67
110
81
641
472
751
553
5147
3790
1
2
1
6
1
33
1
154
1
938
1
5427
1
38232
1
261016
1
2095870
Note that the numerators of the differences are all 1.
Lemma 11.1.
P
k
Q
k
P
k1
Q
k1
=
(1)
k1
Q
k1
Q
k
.
602 Innite continued fractions
Proof. Write
P
k
Q
k
P
k1
Q
k1
=
N
k
Q
k1
Q
k
. We have
N
k
= P
k
Q
k1
Q
k
P
k1
= (P
k2
+q
k
P
k1
)Q
k1
(Q
k2
+q
k
Q
k1
)P
k1
= (P
k1
Q
k2
Q
k1
P
k2
)
= N
k1
.
Since N
1
= 1, we have by easy induction N
k
= (1)
k1
N
1
= (1)
k1
,
and the result follows.
Theorem 11.2. Let q
0
, q
1
, . . . , q
n
, . . . be an innite sequence of positive
integers, q
0
possibly zero. The innite continued fraction
a := [q
0
, q
1
, q
2
, . . . , q
n
, . . . ]
is always well dened, i.e., lim
n
[q
0
, q
1
, . . . , q
n
] exists. This limit is
always an irrational number.
Proof. For each n 0, let a
n
be the n-th convergent
Pn
Qn
. By the above
lemma,
an+2an = (an+2an+1)+(an+1an) =
(1)
n+1
Qn+1Qn
+
(1)
n
QnQn1
=
(1)
n
(Qn+1 Qn1)
Qn1QnQn+1
.
Note that (Q
n
) is an increasing sequence of positive integers, (this is
clear from the recurrence relation for Q
n
). It follows that a
0
, a
2
, a
4
, . . .
is an increasing sequence, and a
1
, a
3
, a
5
, . . . is a decreasing sequence.
Furthermore, each a
2h+1
is greater than every a
2k
:
a
0
< a
2
< a
4
< < a
2k
< < a
2h+1
< a
5
< a
3
< a
1
.
It follows that the subsequences a
2n
and a
2n+1
are convergent; indeed,
they converge to a common limit since
lim
n
a
2n+1
lim
n
a
2n
= lim
n
(a
2n+1
a
2n
) = lim
n
1
Q
2n
Q
2n+1
= 0
since the sequence (Q
n
) of positive integers is strictly increasing. The
common limit a of these two subsequences is the innite continued frac-
tion [q
0
, q
1
, . . . , q
n
, . . . ]. This number a is irrational since its continued
fraction expansion is not nite.
603
Let be a real, irrational number, The continued fraction expansion
of can be found recursively as follows.
0
= , q
0
= [
0
];
n+1
=
1
n
[
n
]
, q
n+1
= [
n+1
].
Then,
= [q
0
, q
1
, q
2
, . . . , q
n
, . . . ].
Theorem 11.3 (Lagrange). Let d be a nonsquare integer. The continued
fraction expansion of of a quadratic irrationality of the form a + b
d,
a, b Q, is eventually periodic; i.e., there exist k and l such that in the
expansion
a +b
d = [q
0
, q
1
, . . . , q
n
, . . . ],
q
k+nl+i
= q
k+i
for n 0, 0 i < l.
Theorem 11.4. Let d be a rational number which is not a square. The
continued fraction expansion of d is of the form
d = [q
0
, q
1
, q
2
, . . . , q
2
, q
1
, 2q
0
],
where q
0
= [
d].
Examples
1. Continued fraction expansions of
2 = [1, 2];
27 = [5, 5, 10];
3 = [1, 1, 2];
28 = [5, 3, 2, 3, 10];
5 = [2, 4];
29 = [5, 2, 1, 1, 2, 10];
6 = [2, 2, 4];
30 = [5, 2, 10];
7 = [2, 1, 1, 1, 4];
31 = [5, 1, 1, 3, 5, 3, 1, 1, 10];
8 = [2, 1, 4];
32 = [5, 1, 1, 1, 10];
10 = [3, 6];
33 = [5, 1, 2, 1, 10];
11 = [3, 3, 6];
34 = [5, 1, 4, 1, 10];
12 = [3, 2, 6];
35 = [5, 1, 10];
13 = [3, 1, 1, 1, 1, 6];
37 = [6, 12];
14 = [3, 1, 2, 1, 6];
38 = [6, 6, 12];
15 = [3, 1, 6];
39 = [6, 4, 12];
17 = [4, 8];
40 = [6, 3, 12];
18 = [4, 4, 8];
41 = [6, 2, 2, 12];
19 = [4, 2, 1, 3, 1, 2, 8];
42 = [6, 2, 12];
20 = [4, 2, 8];
43 = [6, 1, 1, 3, 1, 5, 1, 3, 1, 1, 12];
21 = [4, 1, 1, 2, 1, 1, 8];
44 = [6, 1, 1, 1, 2, 1, 1, 1, 12];
22 = [4, 1, 2, 4, 2, 1, 8];
45 = [6, 1, 2, 2, 2, 1, 12];
23 = [4, 1, 3, 1, 8];
46 = [6, 1, 3, 1, 1, 2, 6, 2, 1, 1, 3, 1, 12];
24 = [4, 1, 8];
47 = [6, 1, 5, 1, 12];
26 = [5, 10];
48 = [6, 1, 12].
604 Innite continued fractions
2. Some simple patterns:
a
2
+ 1 = [a, a, 2a];
a
2
1 = [a 1, 1, 2a 2];
a
2
+a = [a, 2, 2a];
a
2
+ 2 = [a, a, 2a];
a
2
2 = [a 1, 1, a 2, 1, 2a 2].
11.1 Lagranges Theorem
11.1.1 Purely periodic continued fractions.
Let a be represented by a purely periodic continued fraction:
= [q
0
, q
1
, . . . , q
k
].
This means = [q
0
, q
1
, . . . , q
k
, ]. Let
P
k1
Q
k1
and
P
k
Q
k
be the last two
convergents of the nite continued fraction [q
0
, q
1
, . . . , q
k
]. Then,
=
P
k1
+P
k
Q
k1
+Q
k
.
From this, we see that is a root of the quadratic equation
Q
k
x
2
(P
k
Q
k1
)x P
k1
= 0.
Since the product of the two roots of this equation, being
P
k1
Q
k
, is nega-
tive, exactly one of them is positive. This must be the number , and it is
clear that this is a number of the form a +b
d, a, b Q. Here, d cannot
be a square, for otherwise, the number would have been rational.
11.1.2 Eventually periodic continued fractions
It follows that a number with eventually periodic continued fraction ex-
pansion is also a quadratic irrationality. Consider
= [p
0
, p
1
, . . . , p
h
, q
1
, . . . , q
k
].
Let be the irrational number with purely periodic continued fraction
expansion [q
1
, . . . , q
k
]. This is of the forma+b
d according to 11.1.1.
If h = 0, then
= [p
0
, ] = p
0
+
1
+b
d, a
, b
Q. If h 1, let
P
and
P
Q
be the
last two convergents of the continued fraction [p
0
, . . . , p
h
]. Then
= [p
0
, . . . , p
h
, ] =
P
+P
Q
+Q
.
This also is of the form a
+b
d, a
, b
Q.
We have therefore proved the easier half of Lagrange theorem: every
eventually periodic continued fraction represents a quadratic irrational-
ity. The proof of the converse is more difcult, and requires a more
detailed analysis of numbers with purely periodic continued fraction ex-
pansions.
11.1.3 Reduced quadratic irrationalities
Let = [q
0
, q
1
, . . . , q
k
]. It is the positive root of the quadratic equation
x = [q
0
, q
1
, . . . , q
k
, x].
Note that q
0
x =
1
[q
1
,...,q
k
,x]
, and this can be rewritten as
[q
0
,
1
x
] =
1
[q
1
, . . . , q
k
, x]
.
Continuing, we obtain
[q
k
, q
k1
, . . . , q
1
, q
0
,
1
x
] =
1
x
.
This means is the positive root of x = [q
0
, q
1
, . . . , q
k
, x] if and only
if
1
d
Q
,
where P, Q and d are integers. By replacing P, Q and d by suitable
integer multiples, we may assume that
dP
2
Q
is an integer, and we shall
work with this assumption, and write d = P
2
+QQ
for an integer Q
.
Lemma 11.5. If the quadratic irrationality =
P+
d
Q
is reduced, then
the integers P and Q are positive, and
P < [
d], Q < P +
d < [2
d].
Now, let =
P+
d
Q
be a quadratic irrationality with d P
2
= QQ
d
=
Q(P + mQ +
d)
d (P mQ)
2
=
P + mQ +
d
1
Q
[d (P mQ)
2
]
=
P + mQ +
d
Q
+ 2mP m
2
Q
.
Note that in this expression,
d(P +mQ)
2
= (dP
2
)+2mPQm
2
Q
2
= Q(Q
+2mP m
2
Q).
It follows that we can obtain the continued fraction expansion of by
working out
P
0
= P, Q
0
= Q, Q
1
= Q
k
=
P
k
+
d
Q
k
, q
k
= [
k
],
P
k+1
= P
k
+q
k
Q
k
,
Q
k+1
= Q
k1
+ 2q
k
P
k
q
2
k
Q
k
=
d P
2
k+1
Q
k
.
Note that = [q
0
, . . . , q
n1
,
n
]. In particular,
=
P
n2
+
n
P
n1
Q
n2
+
n
Q
n1
.
11.1 Lagranges Theorem 607
Consider the conjugate
=
P
n2
+
n
P
n1
Q
n2
+
n
Q
n1
.
From this,
n
=
Q
n2
P
n2
Q
n1
P
n1
=
Q
n2
Q
n1
P
n2
Q
n2
P
n1
Q
n1
.
Since the sequence
Pn
Qn
converges to , we can choose N large enough so
that
N
lies between 1 and 0. In other words,
N
is reduced.
It follows as a consequence of this observation that in the construc-
tion of the continued fraction expansion of above, all
n
, n N, are
reduced. By Lemma 11.5, we have
0 < P
n
<
d, 0 < Q
n
< 2
d, for every n N.
There must exist distinct integers h, k N such that
P
h
= P
k
, Q
h
= Q
k
.
If we choose h and k = h + r to be the smallest possible integers for
which these hold, then for every integer t 0 and 0 s < r,
P
h+tr+s
= P
h+s
, Q
h+tr+s
= Q
h+s
.
From this,
q
h+tr+s
= q
h+s
.
This completes the proof of Lagranges theorem.
Corollary 11.6. The continued fraction expansion of a reduced quadratic
irrationality is purely periodic.
Proof. It is enough to show that if = [q
0
, q
1
, . . . , q
r
] is reduced, then
indeed, q
0
= q
r
. (The general case follows by induction). Let =
[q
1
, . . . , q
r
]. Since q
0
+
1
is reduced,
q
0
+
1
> 1.
From this, q
0
= [
1
]. However,
1
d = [q
0
, q
1
, . . . , q
k
],
as follows. Let
P
k1
Q
k1
the (k 1)th convergent of
d.
(a). If the length of the period is even, then (a, b) = (P
k1
, Q
k1
) is
the smallest positive solution of the Pell equation x
2
dy
2
= 1.
(b). If the length of the period is odd, then the smallest positive solu-
tion of the equation x
2
dy
2
= 1 is (a, b) = (P
2
k1
+dQ
2
k1
, 2P
k1
Q
k1
).
Examples
1. The fundamental solution of the Pell equation x
2
2y
2
= 1 is
(3,2). This generates an innite sequence of nonnegative solutions
610 The Pell Equation
(x
n
, y
n
) dened by
x
n+1
= 3x
n
+4y
n
, y
n+1
= 2x
n
+3y
n
; x
0
= 1, y
0
= 0.
The beginning terms are
n 1 2 3 4 5 6 7 8 9 10 . . .
xn 3 17 99 577 3363 19601 114243 665857 3880899 22619537 . . .
yn 2 12 70 408 2378 13860 80782 470832 2744210 15994428 . . .
2. Fundamental solution (a, b) of x
2
dy
2
= 1 for d < 100:
d a b d a b d a b
2 3 2 3 2 1 5 9 4
6 5 2 7 8 3 8 3 1
10 19 6 11 10 3 12 7 2
13 649 180 14 15 4 15 4 1
17 33 8 18 17 4 19 170 39
20 9 2 21 55 12 22 197 42
23 24 5 24 5 1 26 51 10
27 26 5 28 127 24 29 9801 1820
30 11 2 31 1520 273 32 17 3
33 23 4 34 35 6 35 6 1
37 73 12 38 37 6 39 25 4
40 19 3 41 2049 320 42 13 2
43 3482 531 44 199 30 45 161 24
46 24335 3588 47 48 7 48 7 1
50 99 14 51 50 7 52 649 90
53 66249 9100 54 485 66 55 89 12
56 15 2 57 151 20 58 19603 2574
59 530 69 60 31 4 61 1766319049 226153980
62 63 8 63 8 1 65 129 16
66 65 8 67 48842 5967 68 33 4
69 7775 936 70 251 30 71 3480 413
72 17 2 73 2281249 267000 74 3699 430
75 26 3 76 57799 6630 77 351 40
78 53 6 79 80 9 80 9 1
82 163 18 83 82 9 84 55 6
85 285769 30996 86 10405 1122 87 28 3
88 197 21 89 500001 53000 90 19 2
91 1574 165 92 1151 120 93 12151 1260
94 2143295 221064 95 39 4 96 49 5
97 62809633 6377352 98 99 10 99 10 1
3. Pells equations whose fundamental solutions are very large:
d a b
421 3879474045914926879468217167061449 189073995951839020880499780706260
541 3707453360023867028800645599667005001 159395869721270110077187138775196900
601 38902815462492318420311478049 1586878942101888360258625080
613 464018873584078278910994299849 18741545784831997880308784340
661 16421658242965910275055840472270471049 638728478116949861246791167518480580
673 4765506835465395993032041249 183696788896587421699032600
769 535781868388881310859702308423201 19320788325040337217824455505160
919 4481603010937119451551263720 147834442396536759781499589
937 480644425002415999597113107233 15701968936415353889062192632
949 609622436806639069525576201 19789181711517243032971740
991 379516400906811930638014896080 12055735790331359447442538767
12.1 The equation x
2
dy
2
= 1 611
4. The equation x
2
4729494y
2
= 1 arises from the famous Cattle
problem of Archimedes, and has smallest positive solution
x = 109931986732829734979866232821433543901088049,
y = 50549485234315033074477819735540408986340.
Exercise
1. Solve the Pell equations (a) x
2
+ 3y
2
= 1; (b) x
2
4y
2
= 1 for
integer solutions.
1
2. Find the 10 smallest nonnegative solutions of the Pell equation x
2
3y
2
= 1.
2
3. For a positive, nonsquare integer n, let (a
n
, b
n
) be the fundamental
solution of the Pell equation x
2
ny
2
= 1. If n is a square, set
b
n
= 0.
(a) Show that every positive integer occurs innitely often in the
sequence (b
n
).
(b) Determine all occurrences of p
k
, p prime, k > 0, in the sequence
(b
n
).
4. Deduce that if p is a prime of the form 4k + 1, then the continued
fraction expansion of
d = [q
0
, q
1
, . . . , q
k
],
with the rst k convergents
P
i
Q
i
= [q
0
, q
1
, . . . , q
i
], i = 0, 1, 2, . . . , k 1.
Theorem 12.2. If [c[ <
d, and x
2
dy
2
= c is solvable, then c must
be one of the numbers P
2
i
dQ
2
i
, i = 0, 1, 2, . . . , k 1.
Theorem 12.3. Let c > 1 be a positive integer.
(a) If the equation x
2
dy
2
= c is solvable, it must have a fundamen-
tal solution (u, v) in the range
0 < [u[
_
1
2
(a + 1)c, 0 v
b
_
2(a + 1)
c.
Every solution appears in a doubly innite sequence (x
n
, y
n
)
u
n+1
= au
n
+dbv
n
,
v
n+1
= bu
n
+av
n
, u
1
= u, v
1
= v,
for some (u, v) in the range above.
(b) Same conclusion for the equation x
2
dy
2
= c, except that it
must have a solution (u, v) in the range
0 [u[
_
1
2
(a 1)c, 0 < v
b
_
2(a 1)
c.
Example 12.1. Consider the equation x
2
23y
2
= 4 11 23. It is easy
to see that x and y must be both even, and 23 divides x. With x = 46h,
y = 2k, we have 23h
2
k
2
= 11, or k
2
23h
2
= 11. The fundamental
solution of x
2
23y
2
= 1 being (a, b) = (24, 5), we need only nd y
in the range 1 h 2 It is now easy to see that only h = 2 gives
k = 9. From this we obtain (x
1
, y
1
) = (92, 18). The other solutions are
generated recursively by
x
n+1
= 24x
n
+ 115y
n
, y
n+1
= 5x
n
+ 24y
n
, x
1
= 92, y
1
= 18.
Here are the rst 5 solutions.
n 1 2 3 4 5 . . .
xn 92 4278 205252 9847818 472490012 . . .
yn 18 892 42798 2053412 98520978
614 The Pell Equation
12.4 Applications
1. Which triangular numbers are squares ? Suppose the kth triangu-
lar number T
k
=
1
2
k(k + 1) is the square of n. n
2
=
1
2
k(k + 1);
4k
2
+4k +1 = 8n
2
+1; (2k +1)
2
8n
2
= 1. The smallest positive
solution of the Pell equation x
2
8y
2
= 1 being (3, 1), we have the
solutions (k
i
, n
i
) of the equation given by
2k
i+1
+ 1 = 3(2k
i
+ 1) + 8n
i
,
n
i+1
= (2k
i
+ 1) + 3n
i
, k
0
= 1, n
0
= 1.
This means
k
i+1
= 3k
i
+ 4n
i
+ 1,
n
i+1
= 2k
i
+ 3n
i
+ 1, k
0
= 1, n
0
= 1.
The beginning values of k and n are as follows.
i 0 1 2 3 4 5 6 7 8 9 10 . . .
ki 1 8 49 288 1681 9800 57121 332928 1940449 11309768 65918161 . . .
ni 1 6 35 204 1189 6930 40391 235416 1372105 7997214 46611179 . . .
2. Find all integers n so that the mean and the standard deviation of n
consecutive integers are both integers.
If the mean of n consecutive integers is an integer, n must be odd.
We may therefore assume the numbers to be m ,(m 1), . . . ,
1, 0, 1, . . . , m 1, m. The standard deviation of these number
is
_
1
3
m(m + 1). For this to be an integer, we must have
1
3
m(m +
1) = k
2
for some integer k. m
2
= m = 3k
2
; n
2
= (2m + 1)
2
=
12k
2
+ 1. The smallest positive solution of the Pell equation n
2
12k
2
= 1 being (7,2), the solutions of this equations are given by
(n
i
, k
i
), where
n
i+1
= 7n
i
+ 24k
i
,
k
i+1
= 2n
i
+ 7k
i
, n
0
= 1, k
0
= 0.
The beginning values of n and k are
i 1 2 3 4 5 6 7 8 . . .
ni 7 97 1351 18817 262087 3650401 50843527 708158977 . . .
ki 2 28 390 5432 75658 1053780 14677262 204427888 . . .
12.4 Applications 615
3. Find all Pythagorean triangles the lengths of whose two shorter
sides differ by 1.
Let x and x + 1 be the two shorter sides of a Pythagorean triangle,
with hypotenuse y. Then y
2
= x
2
+(x+1)
2
= 2x
2
+2x+1. From
this, 2y
2
= (2x + 1)
2
+ 1. The equation With z = 2x + 1, this
reduces to the Pell equation z
2
2y
2
= 1, which we know has
solutions, with the of this equations are (z
n
, y
n
) given recursively
by smallest positive one (1, 1), and the equation z
2
2y
2
= 1 has
smallest positive solution (3, 2). It follows that the solutions are
given recursively by
z
n+1
= 3z
n
+ 4y
n
,
y
n+1
= 2z
n
+ 3y
n
, z
0
= 1, y
0
= 1.
If we write z
n
= 2x
n
+ 1, these become
x
n+1
= 3x
n
+ 2y
n
+ 1,
y
n+1
= 4x
n
+ 3y
n
+ 2, x
0
= 0, y
0
= 1.
The beginning values of x
n
and y
n
are as follows.
n 1 2 3 4 5 6 7 8 9 10 . . .
xn 3 20 119 696 4059 23660 137903 803760 4684659 27304196 . . .
yn 5 29 169 985 5741 33461 195025 1136689 6625109 38613965 . . .
4. Find eleven consecutive positive integers, the sumof whose squares
is the square of an integer.
Answer:
18
2
+ 19
2
+ + 28
2
= 77
2
,
38
2
+ 39
2
+ + 48
2
= 143
2
,
456
2
+ 457
2
+ + 466
2
= 1529
2
,
854
2
+ 855
2
+ + 864
2
= 2849
2
,
9192
2
+ 9193
2
+ + 9202
2
= 30503
2
,
17132
2
+ 17133
2
+ + 17142
2
= 56837
2
,
.
.
.
Chapter 13
Elliptic Curves
13.1 Group law on y
2
= x
3
+ ax
2
+ bx +c
Consider an elliptic curve
(E) y
2
= f(x) := x
3
+ax
2
+bx +c.
We shall write a point P on (E) in the form P = (x[P], y[P]), andput
the identity at a point of innity, so that
y[P] = y[P].
P
Q
P Q
P + Q
Consider a line of slope m passing through P. It has equation
y y[P] = m(x x[P]). It intersects the elliptic curve (E) at points
whose x-coordinates are the roots of the equation
(mx + (y[P] mx[P]))
2
= x
3
+ax
2
+bx +c,
702 Elliptic Curves
or equivalently,
x
3
(m
2
a)x
2
(2m(y[P] mx[P])b)x+c(y[P] mx[P])
2
= 0.
Since the sum of the three roots of the cubic is m
2
a, we make the
following conclusions.
(1) If the line is the tangent at P, then
(i) m =
f
(x[P])
2y[P]
,
(ii) the third intersection has x-coordinate
m
2
a 2x[P] =
f
(x[P])
2
4y[P]
2
a 2x[P]
=
x[P]
4
2bx[P]
2
8cx[P] + (b
2
4ac)
4y[P]
2
=
x[P]
4
2bx[P]
2
8cx[P] + (b
2
4ac)
4(x[P]
3
+ax[P]
2
+bx[P] +c)
.
The y-coordinate can be computed from the equation of the line.
x[2P] =
x[P]
4
2bx[P]
2
8cx[P] + (b
2
4ac)
4(x[P]
3
+ax[P]
2
+bx[P] +c)
.
(2) If the line joins two points P
1
and P
2
on (E), then
(i) m =
y[P
1
]y[P
2
]
x[P
1
]x[P
2
]
;
(ii) the third intersection has x-coordinate
m
2
a x[P
1
] x[P
2
]
=
_
y[P
1
] y[P
2
]
x[P
1
] x[P
2
]
_
2
a (x[P
1
] +x[P
2
])
=
x[P
1
]x[P
2
](x[P
1
] +x[P
2
] + 2a) +b(x[P
1
] +x[P
2
]) + 2c 2y[P
1
]y[P
2
]
(x[P
1
] x[P
2
])
2
.
The y-coordinate can be computed from the equation of the line.
13.2 The discriminant
The discriminant of the cubic f(x) := x
3
+ax
2
+bx +c is the number
D := 4a
3
c +a
2
b
2
+ 18abc 4b
3
27c
2
.
13.2 The discriminant 703
Theorem 13.1 (Nagell-Lutz). Let P = (x, y) be a nite order point of
(E) : y
2
= x
3
+ ax
2
+ bx +c. Then either y = 0 (in which case P has
order 2) or y
2
[D.
Theorem 13.2 (Mazur). The torsion group of the rational points of an
elliptic curve over Q is one of the following 15 groups:
(i) Z
n
with n = 1, 2, 3, . . . , 9, 10, 12;
(ii) Z
2n
Z
2
with n = 1, 2, 3, 4.
Example 13.1.
Elliptic Curve Torsion group Discriminant
y
2
= x
3
+ 2 0 2
2
3
3
y
2
= x
3
+x Z
2
2
2
y
2
= x
3
+ 4 Z
3
2
4
3
3
y
2
= x
3
+ 4x Z
4
2
8
704 Elliptic Curves
Chapter 14
Heron triangles and Elliptic
Curves
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
A triangle is determined, up to similarity, by a set of three positive real
numbers t
1
, t
2
, t
3
satisfying the relation
t
1
t
2
+t
2
t
3
+t
3
t
1
= 1. (14.1)
Such are indeed the tangents of the half - angles of the triangle. If the
triangle is scaled to have unit semiperimeter, the lengths of the sides are
t
1
(t
2
+t
3
), t
2
(t
3
+t
1
), and t
3
(t
1
+t
2
),
and the area is k = t
1
t
2
t
3
. From the inequality of arithmetic and geo-
metric means, it is easy to see that k
2
1
27
, with equality precisely in
the case of an equilateral triangle. We study triangles with rational sides
and rational areas. It is clear that for such triangles, the parameters t
1
,
t
2
, and t
3
are all rational. Since such triangles cannot be equilateral, we
shall assume k
2
<
1
27
. Elimination of t
3
leads to
t
2
1
t
2
2
(t
1
k)t
2
+kt
1
= 0.
A given rational number t
1
determines a rational number t
2
, and con-
sequently a triangle with rational sides and rational area, if and only if
(t
1
k)
2
4kt
3
1
is a rational square. A rational point (x, y) on the elliptic
curve
E
k
: y
2
= (x k)
2
4kx
3
,
706 Heron triangles and Elliptic Curves
therefore, determines rational numbers
t
1
= x, t
2
=
x +y k
2x
2
, t
3
=
x y k
2x
2
. (14.2)
These parameters in turn dene a genuine triangle provided x > k, (see
Lemma 2 below), the sides of the triangles being
a = t
1
(t
2
+t
3
) =
x k
x
,
b = t
2
(t
3
+t
1
) =
x +y +k
2x
,
c = t
3
(t
1
+t
2
) =
x y +k
2x
.
Given a triangle with unit semiperimeter and rational area k, we shall
show that the associated elliptic curves E
k
has positive rank, provided
that the triangle is non-isosceles. This leads to the following theorem on
the existence of arbitrary number of Heron triangles equal in perimeter
and in area.
Theorem 14.1. Given a non-isosceles rational triangle T (of semiperime-
ter 1) and a positive integer N, there are an integer s and N noncongru-
ent Heron triangles all having the same area and perimeter as sT.
The qualication of non-isosceles triangle is essential. An example is
provided by the case of the isosceles with sides (5,5,6), with t
1
= t
2
=
1
2
,
and t
3
=
3
4
, and k = t
1
t
2
t
3
=
3
16
. The elliptic curve E
k
has rank 0,
(See Proposition 10), showing that there are no other triangles of unit
semiperimeter with the same value of k. However, such an isosceles
triangle has equal perimeter and equal area as another isosceles triangle,
then the elliptic curve has positive rank, and the statement of the theorem
remains valid.
Guy [??, D16] reports that the problem of nding as many different
triples of positive integers as possible with the same sum and the same
product has been solved by A. Schinzel, that there are arbitrarily many.
Theorem 1 offers a solution to the same problem: an arbitrary number
of such triples, with the additional property that the sum and the product
multiply to a square, can be constructed from any triple of distinct posi-
tive integers x, y, z with the same property, i.e., xyz(x+y +z) = A
2
for
an integer A. Any such triple denes a Heron triangle with sides x + y,
y +z, z +x, and area A.
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
707
Let k be a rational number <
1
3
3
. The cubic polynomial
f
k
(x) := (x k)
2
4kx
3
(14.3)
has three distinct real roots separated by k and 3k, since
f() = +,
f(k) = 4k
4
< 0,
f(3k) = 4k
2
(1 27k
2
) > 0,
f(+) = .
This means that the elliptic curve E
k
has two components, one of
which is compact. A point (x, y) on E
k
lies in the compact component
if and only if x > k. By Lemma 2 below, a point on E
k
corresponds to a
genuine triangle if and only if its lies in the compact component.
Lemma 14.2. A point (x, y) on the elliptic curve E
k
denes a genuine
triangle if and only if x > k.
Proof. From (14.2), t
2
+t
3
=
xk
x
2
and t
2
t
3
=
y
2
4x
4
. It is clear that t
1
, t
2
, t
3
are all positive (and denes a genuine triangle) if and only if x > k.
The addition law of E
k
is given by
x(P +Q) =
1
4k
(1
2
) x(P) x(Q),
where
=
_
y(P)y(Q)
x(P)x(Q)
, if P ,= Q,
x(P)k6kx(P)
2
y(P)
, if P = Q.
Lemma 14.3. Let P be a point on the compact component of E
K
. The six
points P, P I all represent the same (similarity class of) rational
triangles.
Proof. Write P = (t
1
, t
2
1
(t
2
t
3
)). Then, for = 1,
(P +I) = (t
2
, t
2
2
(t
3
t
1
)),
(P I) = (t
3
, t
2
3
(t
1
t
2
)).
Let P and Q be two distinct points on E
k
, one on each of the two
components. By the convexity of the compact component, it is clear that
708 Heron triangles and Elliptic Curves
the sumP +Qlies in the compact component. Now, if P is a point in the
compact component, then 2P must be in the noncompact one. It follows
by induction that all odd multiples of P are in the compact component,
and hence dene genuine rational triangles.
Example 14.1. For k =
1
6
, the cubic polynomial f
k
(x) =
1
36
(1 12x +
36x
2
24x
3
) is irreducible.
Example 14.2. For k =
168
1331
=
2
3
37
11
3
, the cubic polynomial
f
k
(x) = 4k(x
56
33
)(x
2
699
2464
x +
9
484
).
The rational root
56
33
corresponds to the isosceles Heron triangle (65, 65, 112).
On the same curve, there are rational points with x =
2
11
,
8
11
,
21
22
, corre-
sponding to the Heron triangle (37, 100, 105), also of perimeter 242 and
area 1848.
Example 14.3. For k =
60
343
, the cubic polynomial f
k
(x) has three ratio-
nal roots
15
112
<
12
35
<
20
21
. The larger two correspond respectively to the
isosceles triangles (24, 37, 37) and (29, 29, 40), both with perimeters 98
and area 420. On E
k
lie also the rational points with x =
5
14
,
4
7
,
6
7
, corre-
sponding to the Heron triangle (25, 34, 39), with the same perimeter and
area.
14.1.1 Proof of Theorem 14.1
A non-isosceles triangle with semiperimeter 1 and area k corresponds to
a point P in the component of the elliptic curve E
k
. Such a point cannot
have nite order, and so generates an innite cyclic subgroup of E
k
. The
points mP lies in the compact component precisely when m is odd. For
any given integer N, the points (2m 1)P, 1 m N, all lie in the
compact component, and therefore represent rational triangles T
m
, each
of semiperimeter 1 and area k. Let s be the least common multiple of the
denominators of the lengths of sides of these N triangles. Magnifying
each of them by the factor s, we obtain a sequence of N Heron triangles,
all with semiperimeter s, and area ks
2
.
Example 14.4. The right triangle (3,4,5) corresponds to the point P(1,
1
6
)
on the curve E
1/6
. The primitive Heron triangles corresponding the
points P, 3P, 5P, 7P, and 9P, with their semiperimeters and areas,
are as follows.
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
709
(3, 4, 5; 6, 6),
(287, 468, 505; 630, 66150),
(3959527, 3997940, 5810001; 6883734, 7897632297126),
(3606573416251, 5935203156525, 6344028032612; 7942902302694,
10514949498356941266609606),
(480700822846118327460, 630296830413008002763, 795751643958885119197;
953374648609005724710, 151487203435057523536941712814925384097350).
The LCM of the semiperimeters being
s = 1447986121797526457728510272387457724310,
magnifying these triangles by appropriate factors, we obtain ve Heron
triangles, all with semiperimeter s and area
= 349443968153040187579733428603820320155254000034420331290213618794580660829350.
The following example shows that the hypothesis of non-isoscelesity
is essential.
Remark. Let k =
1
2
1
2
3
4
=
3
16
. The elliptic curve is cyclic of order 6.
In particular, it has rank 0.
This value of k arises from the isosceles triangle (5, 5, 6). By Propo-
sition 7, there is no other (noncongruent) triangle of unit semiperimeter
and the same area. On the other hand, Example 1 shows that for the
isosceles triangle (65,65,126), the associated elliptic curve has positive
rank.
Supplements and Corrections
5.1
The partial solution of the exercise should be replaced by the following.
Let u = sa and v = sb. Since r = sc for a right triangle, we have (u+r)
2
+(v+r)
2
=
(u + v)
2
. This can be rearranged as (u r)(v r) = 2r
2
. Each factorization of 2r
2
into the
product of two numbers gives u and v up to an interchanges, and one Pythagorean triangle of
inradius r. There are
1
2
d(2r
2
) such pairs, where d is the number-of-divisors function.
5.5
Proposition 5.2 (3) should be replaced by the following.
(3) For Pythagorean triangles of inradius r, there are exactly
1
2
d(2r
2
)
of such, where d is the number-of-divisors function.
The proof for (3) should be replaced by the following.
If k is a divisor of 2r
2
greater than
2r, then u = r + k and
v = r +
2r
2
k
give a Pythagorean triangle (r + v, r + u, u + v)
with inradius r.
5.6 Enumeration of Pythagorean triangles according to inradii
According to (the supplement of) 5.1, we can make a complete list of
Pythagorean triples arranged in ascending order of the inradius. For each
positive integer r,
(i) list the divisors of 2r
2
in ascending order up to
2r,
(ii) for each factor k, set
(a, b, c) =
_
k + 2r,
2r
2
k
+ 2r, k +
2r
2
k
+ 2r
_
.
See [10].
902 Heron triangles and Elliptic Curves
6.1
Lemma 14.4. Let p be an odd prime. The residue 1 is a square modulo
p if and only if p 1 (mod 4).
Proof. () If p = 4k + 1, it follows from Wilsons theorem that
((2k)!)
2
(2k)! (p 2k) (p 1)
=(2k)! (2k + 1) (p 1)
=(p 1)! 1 (mod p).
() If x
2
1 (mod p), then
(1)
(p1)/2
(x
2
)
(p1)/2
= x
p1
1 (mod p)
by Fermats little theorem. It follows that
p1
2
is an even integer, and
p 1 (mod 4).
In the proof of Theorem 6.1, replace each occurrence of x
1
by u and
y
1
by v. The rst part of the proof is rewritten with minor changes as
follows.
Since p 1 (mod 4), the equation x
2
+ y
2
= mp is solvable in
integers for some m. We want to show that the smallest possible value
of m is 1. Note that we may choose [x[, [y[ <
p
2
so that m <
p
2
. If
m ,= 1, it cannot divide both of x and y, for otherwise m
2
[x
2
+y
2
= mp
and m[p, contrary to m <
p
2
. Now choose integers u and v in the range
m
2
< u, v <
m
2
such that u x and v y (mod m). Note that u and
v cannot be both zero, and
0 < u
2
+v
2
m
2
2
.
It follows that u
2
+v
2
= m
m for some m
m
2
< m. Now,
m
2
m
p = (x
2
+y
2
)(u
2
+v
2
) = (xu +yv)
2
+ (xv yu)
2
, (14.4)
Note that
xu +yv x
2
+y
2
0 (mod m),
xv yu xy yx 0 (mod m).
Therefore, X :=
xu+yv
m
and Y :=
xvyu
m
are integers. From (14.4) it
follows that
X
2
+Y
2
= m
p
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
903
with m
m
n+1
2
,
m
n+1
2
_
such that u
n+1
x
n+1
(mod m
n+1
) and v
n+1
y
n+1
(mod m
n+1
).
Example 14.5. For p = 3637, we have q = 1027 and p = 39
2
+ 46
2
from the following table.
n x
n
y
n
m
n
u
n
v
n
1 1027 1 290 133 1
2 471 4 61 17 4
3 131 32 5 1 2
4 39 46 1
Chapter 8
Page 401: 3. The product of two quadratic residues mod n is not nec-
essarily a quadratic residue mod n. For example, in Z
12
= 1, 5, 7, 11,
only 1 is a quadratic residue; 5, 7, and 11 5 7 are all quadratic non-
residues.
904 Heron triangles and Elliptic Curves
14.1.2 Theorem 11.4
Note the symmetry within a period of the continued fraction expansion
of
94,
which is purely periodic, since the quadratic irrationality 9 +
94 is
reduced:
k
1
k1
q
k1
=
k
= q
k
+ (
k
q
k
)
0 9 +
94 = 18 + (9 +
94)
1
1
9+
94
=
9+
94
13
= 1 +
4+
94
13
2
13
4+
94
=
4+
94
6
= 2 +
8+
94
6
3
6
8+
94
=
8+
94
5
= 3 +
7+
94
5
4
5
7+
94
=
7+
94
9
= 1 +
2+
94
9
5
9
2+
94
=
2+
94
10
= 1 +
8+
94
10
6
10
8+
94
=
8+
94
3
= 5 +
7+
94
3
7
3
7+
94
=
7+
94
15
= 1 +
8+
94
15
8
15
8+
94
=
8+
94
2
= 8 +
8+
94
2
9
2
8+
94
=
8+
94
15
= 1 +
7+
94
15
.
It is here where symmetry begins when in
9
= q
9
+
1
10
, we have
1
10
=
9
. This is because the preceding line
8
= q
8
+
1
9
can be conjugated to give
8
= q
8
+
1
9
= q
8
10
.
In other words,
10
= q
8
+ (
8
).
Note that since
8
is reduced, this last term is between 0 and 1. This
means q
9
= q
8
and
1
10
=
8
. By iteration, we obtain the sequence
q
8
, q
7
, . . . , q
1
, and
9 +
94 = [18, 1, 2, 3, 1, 1, 5, 1, 8, 1, 5, 1, 1, 3, 2, 1];
94 = [9, 1, 2, 3, 1, 1, 5, 1, 8, 1, 5, 1, 1, 3, 2, 1, 18].
In this case, the period has even length.
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
905
(b) Another kind of symmetry occurs in the expansions of, say,
97.
Again, we compute the purely periodic expansion of 9 +
97:
k
1
k1
q
k1
=
k
= q
k
+ (
k
q
k
)
0 9 +
97 = 18 + (9 +
97)
1
1
9+
97
=
9+
97
16
= 1 +
7+
97
16
2
16
7+
97
=
7+
97
3
= 5 +
8+
97
3
3
3
8+
97
=
8+
97
11
= 1 +
3+
97
11
4
11
3+
97
=
3+
97
8
= 1 +
5+
97
8
5
8
5+
97
=
5+
97
9
= 1 +
4+
97
9
6
9
4+
97
=
4+
97
9
Here, we have
1
6
=
6
. In fact,
5
= q
5
+
1
6
= q
5
6
,
6
= q
5
5
,
6
= q
5
+ (
5
).
This means q
7
= q
5
and
1
8
=
6
. Symmetry emerges by iteration, and
we have
9 +
97 = [18, 1, 5, 1, 1, 1, 1, 1, 1, 5, 1];
97 = [9, 1, 5, 1, 1, 1, 1, 1, 1, 5, 1, 18].
In this case, the period has odd length.
Chapter 12
Approximations to Irrational Numbers
Theorem 14.5. Let be an irrational number. If a rational approxima-
tion
P
Q
, Q 1, satises
P
Q
<
1
2Q
2
,
then
P
Q
is one of the convergents of the continued fraction expansion of
.
906 Heron triangles and Elliptic Curves
Proof. (1) [Q
n
P
n
[ <
1
Q
n+1
.
P
n
Q
n
P
n1
+P
n
n+1
Q
n1
+Q
n
n+1
P
n
Q
n
.
.
.
=
1
Q
n
(Q
n1
+ Q
n
n+1
)
<
1
Q
n
(Q
n1
+ Q
n
a
n+1
)
=
1
Q
n
Q
n+1
.
The inequality follows by multiplying by Q
n
.
(2) If
P
Q
, Q > 0, satises [Q P[ < [Q
n
P
n
[ for some n 1.
Then, Q Q
n+1
.
Suppose [Q P[ < [Q
n
P
n
[ for Q < Q
n+1
. We can nd integers
x and y satisfying
xP
n
+yP
n+1
= P,
xQ
n
+yQ
n+1
= Q.
Actually, x = (1)
n
(PQ
n+1
QP
n+1
) and y = (1)
n
(P
n
Q Q
n
P).
Since
P
Q
is different from
Pn
Qn
and
P
n+1
Q
n+1
, x and y are nonzero.
First note that x and y must be nonzero. If any of x, y is zero, then
P
Q
is one of
Pn
Qn
and
P
n+1
Q
n+1
. Indeed, x and y have opposite signs.
If y < 0, then xQ
n
= QyQ
n+1
> 0, and x > 0.
If y > 0, then Q < Q
n+1
implies Q < yQ
n+1
and x
n
Q
n
must be
negative, and x < 0.
These justify that claim that x and y have opposite signs. Conse-
quently, x(Q
n
P
n
) and y(Q
n+1
P
n+1
) have the same sign, and
[Q P[ = [x(Q
n
P
n
) +y(Q
n+1
P
n+1
)[
= [x(Q
n
P
n
)[ +[y(Q
n+1
P
n+1
)[
> [Q
n
P
n
[,
a contradiction.
(3) Suppose
P
Q
is not a convergent of . Then Q
n
< Q < Q
n+1
for
some n. But [Q P[ < [Q
n
P
n
[ is impossible. Therefore,
[Q
n
P
n
[ [Q P[ <
1
2Q
.
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
907
Now, using the fact that
P
Q
,=
Pn
Qn
and that QP
n
PQ
n
is an integer, we
have
P
n
Q
n
P
Q
=
[QP
n
PQ
n
[
QQ
n
1
QQ
n
,
and
P
n
Q
n
P
Q
P
n
Q
n
P
Q
<
1
2QQ
n
+
1
2Q
2
.
By comparison, Q < Q
n
, an impossibility.
Theorem 12.2
Replaced by the following with minor change of notations.
Theorem 14.6. Let s be an integer satisfying [s[ <
d. If (x, y) =
(P, Q) is a positive solution of the equation
x
2
dy
2
= s
then
P
Q
is a convergent of the continued fraction expansion of
d.
Proof. Case 1: s > 0. Writing s = (P +Q
d)(P Q
d), we have
0 < P Q
d =
s
P +Q
d
<
d
P +Q
d
=
1
Q(1 +
P
Q
d
)
<
1
2Q
.
From this,
d
P
Q
<
1
2Q
2
,
and
P
Q
is a convergent of the continued fraction expansion of .
Case 2: s < 0. Rewriting the equation as
s
d
= (Q +
P
d
)(Q
P
d
),
we have
0 < Q
P
d
=
s
d
Q+
P
d
<
1
d
Q+
P
d
=
1
P +Q
d
=
1
P(1 +
Q
d
P
)
<
1
2P
.
908 Heron triangles and Elliptic Curves
Therefore,
Q
P
<
1
2P
2
and
Q
P
is a convergent of
1
d
, and
P
Q
one of
d.
Proof of Theorem 12.3
For an arbitrary (but xed) integer s, consider the equation E(d, s), with
solution set S
d
(s) as a subset of Z[
d].
This clearly is an equivalence relation. The solutions of E(d, s) there-
fore are partitioned into disjoint classes.
In generally, the class of and that of are disjoint. But sometimes,
they may coincide. In that case, we say that the class is ambiguous.
Clearly, for s = 1, there is only one class, and the class is ambigu-
ous.
We shall therefore assume s ,= 1. Note that each class of S
d
(s) is
innite. In fact, if := a + b
s,
0 < [u[
_
1
2
(a + 1)s.
Proof. We may assume u > 0. Consider
(u +v
d)(a b
d.
This clearly belongs to the same class of u + v
d S
d
(s). Now, since
au dbv = au
db
2
dv
2
= au
_
(a
2
1)(u
2
s) > 0,
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
909
we must have au dbv u. From this it follows that
(a 1)
2
u
2
d
2
b
2
v
2
= (a
2
1)(u
2
s),
and
u
2
1
2
(a + 1)s.
This completes the proof.
Theorem 12.3B.
Let s > 0. If u +v
s,
0 [u[
_
1
2
(a 1)s.
Proof. We may again suppose u 0. Again,
(a b
d)(u +v
_
) = (au dbv) + (av bu)
d
is in S
d
(s). Since
(av)
2
= a
2
v
2
= (db
2
+ 1)
1
d
(u
2
+s) = (b
2
+
1
d
)(u
2
+s) > (bu)
2
,
it follows that av bu > 0, and indeed av bu v. From this
dv
2
(a 1)
2
db
2
u
2
,
(u
2
+s)(a 1)
2
(a
2
1)u
2
,
u
2
1
2
(a 1)s.
910 Heron triangles and Elliptic Curves
Chapter 12. Sums of consecutive squares
Sums of an odd number of consecutive squares
Suppose the sum of the squares of 2k + 1 consecutive positive integers
is a square. If the integers are b, b 1, . . . , b k. We require
(2k + 1)b
2
+
1
3
k(k + 1)(2k + 1) = a
2
for an integer a. From this we obtain the equation
a
2
(2k + 1)b
2
=
1
3
k(k + 1)(2k + 1). (E
k
)
Exercise
1. Suppose 2k + 1 is a square. Show that (E
k
) has solution only when
k = 6m(m+) for some integers m > 1, and = 1. In each case, the
number of solutions is nite.
Number of solutions of (E
k
) when 2k + 1 is a square
2k + 1 25 49 121 169 289 361 529 625 841 961 . . .
0 1 1 2 7 3 5 3 3 10 . . .
2. Find the unique sequence of 49 (respectively 121) consecutive
positive integers whose squares sum to a square.
Answer: 25
2
+ 26
2
+ + 73
2
= 357
2
; 244
2
+ 245
2
+ + 364
2
=
3366
2
;
Remark: The two sequences of 169 consecutive squares whose sums
are squares are
30
2
+ 31
2
+ + 198
2
= 1612
2
;
510
2
+ 511
2
+ + 678
2
= 7748
2
.
3. Suppose 2k + 1 is not a square. If k + 1 is divisible 9 = 3
2
or
by any prime of the form 4k + 3 7, then the equation (E
k
) has no
solution.
4. Show that for the following values of k < 50, the equation (E
k
)
has no solution:
k = 6, 8, 10, 13, 17, 18, 20, 21, 22, 26, 27, 30, 32,
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
911
34, 35, 37, 40, 41, 42, 44, 45, 46, 48, . . .
5. Suppose p = 2k+1 is a prime. If the Legendre symbol
_
1
3
k(k+1)
p
_
=
1, then the equation (E
k
) has no solution.
6. Show that for the following values of k < 50, the equation (E
k
)
has no solution:
1, 2, 3, 8, 9, 14, 15, 20, 21, 26, 33, 39, 44.
We need only consider (E
k
) for the following values of k:
5, 7, 11, 16, 19, 23, 25, 28, 29, 31, 36, 38, 43, 47, 49.
7. Use Theorem12.3 to check that among these, only for k = 5, 11, 16, 23, 29
are the equations (E
k
) solvable.
8. From the data of Example 12.1, work out 5 sequences of 23 con-
secutive integers whose squares add up to a square in each case.
Answer:
7
2
+ 8
2
+ + 29
2
= 92
2
;
881
2
+ 882
2
+ + 903
2
= 4278
2
;
42787
2
+ 42788
2
+ + 42809
2
= 205252
2
;
2053401
2
+ 2053402
2
+ + 2053423
2
= 9847818
2
;
9. Consider the equation (E
36
) : a
2
73b
2
= 12 37 73. Check by
Theorem 10.6.3 that this equation does in fact have solutions (u, v) =
(4088, 478), (23360, 2734).
10. Make use of the fundamental solution of x
2
73y
2
= 1, namely,
(a, b) = (2281249, 267000), to obtain two sequences of solutions of
(E
73
):
Answer:
(4088, 478), (18642443912, 2181933022), (85056113063608088, 9955065049008478), . . .
(23360, 2734), (106578370640, 12474054766), (486263602888235360, 56912849921762734), . . .
This means, for example, the sum of the squares of the 73 numbers
with center 478 (respectively 2734) is equal to the square of 4088 (re-
spectively 23360).
912 Heron triangles and Elliptic Curves
Even number of consecutive squares
Suppose the sum of the squares of the 2k consecutive numbers
b k + 1, b k + 2, . . . , b, . . . , b +k 1, b +k,
is equal to a
2
. This means
(2a)
2
2k(2b + 1)
2
=
2k
3
(4k
2
1). (E
k
)
Note that the numbers 2k, 4k
2
1 are relatively prime.
Exercise
1. Show that the equation (E
k
) has no solution if 2k is a square.
2. Suppose 2k is not a square. Show that if 2k +1 is divisible by 9, or
by any prime of the form 4k +1, then the equation (E
k
) has no solution.
3. Show that for k 50, the equation (E
k
) has no solution for the
following values of k:
k = 3, 4, 5, 9, 11, 13, 15, 17, 21, 23, 24, 27, 29, 31, 33,
35, 38, 39, 40, 41, 45, 47, 49.
4. Let k be a prime. Show that the equation (E
k
) can be written as
(2b + 1)
2
2ky
2
=
4k
2
1
3
.
By considering Legendre symbols, show that the equation (E
k
) has no
solution for the following values of k 50:
k = 5, 7, 17, 19, 29, 31, 41, 43.
5. By using Theorem 12.3, check that, excluding square values of
2k < 100, the equation (E
k
) has solutions only for k = 1, 12, 37, 44.
The case 2k = 2 has been dealt with in 12.4, Example 3.
6. Show that (34, 0), (38, 3), (50, 7) are solutions of (E
12
). Con-
struct from them three innite sequences of expressions of the sum of 24
consecutive squares as a square.
Answer:
25
2
+ 26
2
+ + 48
2
= 182
2
;
44
2
+ 45
2
+ + 67
2
= 274
2
;
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
913
76
2
+ 77
2
+ + 99
2
= 430
2
.
7. Show that (185, 2), (2257,261), and (2849, 330) are solutions of
(E
37
). Construct from them three innite sequences of expressions of
the sum of 74 consecutive squares as a square.
Answer:
225
2
+ 226
2
+ + 298
2
= 2257
2
;
294
2
+ 295
2
+ + 367
2
= 2849
2
;
13096
2
+ 13097
2
+ + 13179
2
= 763865
2
.
8. Show that and (242, 4) and (2222,235) are solutions of (E
44
).
Construct from them two innite sequences of expressions of the sum of
88 consecutive squares as a square.
Answer:
192
2
+ 193
2
+ + 279
2
= 2222
2
;
5925
2
+ 5926
2
+ 6012
2
= 55990
2
.
Remark: The equation (E
26
) : x
2
52y
2
= 185253 does indeed have
two innite sequences of solutions generated by the particular solutions
(338, 36), (2002,276), and the fundamental solution (649,90) of the Pell
equation x
2
52y
2
= 1. None of these, however, leads to a solution of
(E
26
) since all the ys are even.
Lucas Problem
When does a square pyramid of cannon balls contain a number of cannon
balls which is a perfect square ? Lucas claimed that the only solutions
of
1
2
+ 2
2
+ +n
2
= k
2
are (n, k) = (1, 1), (24, 70). This was established by Watson in 1918.
914 Heron triangles and Elliptic Curves
Pair of Heron triangles with equal areas and equal perimeters
To nd a pair of Heron triangles with equal areas and equal perimeters,
one of them similar to (5, 12, 13).
The given triangle (5, 12, 13) has s = 15 and area 30. Scaled to unit
semiperimeter, it has area k =
2
15
.
Consider a point on the elliptic curve
(E) : y
2
= (x k)
2
4kx
3
.
The given triangle has one angle 90
8
49
1
_
+
7
15
=
1546
5145
. Therefore,
2P =
_
8
49
,
1546
5145
_
.
Now, the line joining P and 2P has slope m =
3947
5985
. It intersects (E)
again at a point with x-coordinate
1
_
3947
5985
_
2
4
2
15
1
_
8
49
_
=
10858
48735
.
This is the x-coordinate of the point 3P. It also means that with
t
1
=
10858
48735
, the system of equations
_
t
1
t
2
t
3
= k,
t
1
(t
2
+t
3
) +t
2
t
3
= 1
has ration rational solutions. In fact,
t
1
=
10858
48735
, t
2
=
3477
7921
, t
3
=
5073
3721
.
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
915
Fromthese, we have a triangle with sides
_
2180
5429
,
36313
52155
,
68653
76095
_
, semiperime-
ter 1, and area
2
15
. Magnifying 4641795 times, we obtain the Heron tri-
angle
(1863900, 3231857, 4187833; 4641795, 2872834776270).
The given triangle (5, 12, 13), magnied 309453 times, gives
(1547265, 3713436, 4022889; 4641795, 2872834776270)
of the same semiperimeter and area.
Exercises
Problem A1. (a) Prove that there is no Pythagorean triangle with
one side of length 2.
(b) Given an integer n 3, construct a Pythagorean triangle with one
leg of length n.
Problem A2. (a) Show that the hypotenuse of a Pythagorean trian-
gle cannot be congruent to 3 (mod 4).
(b) For n 30, determine if there is a Pythagorean triangle with
hypotenuse n. If so, give an example.
n (a, b, c)
1 none
2 none
4 none
5 (3, 4, 5)
6
8
9
10
12
13
14
16
n (a, b, c)
17
18
20
21
22
24
25
26
28
29
30 (18, 24, 30)
(c) Make a conjecture: which integers n can be realized as the hy-
potenuse of a right triangle?
1002 Heron triangles and Elliptic Curves
Problem A3. How many matches of equal length are required to
make up the following conguration?
Problem A4. (a) Verify that (a
2
+ b
2
)(x
2
+ y
2
) = (ax by)
2
+
(bx +ay)
2
.
(b) Make use of (a) to express 481 as a sum of two squares in two
different ways.
(c) Find all Pythagorean triangles (a, b, c) with a < b and c = 481.
Which of these are primitive?
Problem A5. Let (a, b, c) be a Pythagorean triple. Prove that
(a) at least one of a, b, c is divisible by 5;
(b) abc is divisible by 60.
Problem A6. Each of the following is a prime of the form 4k + 1.
Write it as a sum of two squares, and nd the primitive Pythagorean
triangle with this as hypotenuse.
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
1003
p u
2
+v
2
shorter sides
10009 100
2
+ 3
2
9991, 600
10037
10061
10069
10093
10133
10141
10169
10177
10181
10193
Problem A7. Make use of the following diagram to prove the irra-
tionality of
2.
p q
p q
p q
p q
2q p
2q p
(c) Irrationality of
2
Problem A8. Let p and q be positive integers such that the two
quadratics x
2
px+q and x
2
pxq can both be factored (with integer
1004 Heron triangles and Elliptic Curves
coefcients). Show that p and q are respectively the hypotenuse and the
area of a Pythagorean triangle.
Problem A9. Here is the smallest square which can be dissected
into three Pythagorean triangles and one with integer sides and integer
area.
a
a
289
375
424
(a) What is the length of a side of the square?
(b) What are the lengths of the sides of the Pythagorean triangles?
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
1005
Problem A10 (Optional).
perimeter m + n 2m m n a b c
1716 33
39
14280 85
105
119
317460 407
429
481
555
1542684 899
957
1023
1131
1209
6240360 1785
1955
1995
2185
2261
2415
19399380 3135
3315
3553
3705
3927
4199
4389
Problem A11 (Optional). In a class in Number Theory the profes-
sor gave four students the assignment of nding a fairly large primitive
Pythagorean triangle using the well known formula for the legs:
A = 2mn, B = m
2
n
2
, C = m
2
+n
2
,
where m and n are coprime integers, not both odd. The four students
produced four entirely different primitive triangles, but on comparing
them it was found that two of them had the same perimeter, while the
other two also had the same perimeter, this perimeter differing from the
1006 Heron triangles and Elliptic Curves
rst one by 2. This interested the class greatly, and much time was spent
in an effort to nd other such sets, only to discover that there were only
four such sets with perimeters less than 500,000. Can you nd at least
one such set ?
perimeter m +n 2m m n a b c
117390 273
301
117392 253
319
313038 459
527
313040 455
559
339150 425
475
525
339152 451
517
371448 469
603
371450 437
475
575
ProblemA12 (Optional). Cross number puzzle on primitive Pythagorean
triples.
1B, 3D, 9B 29B, 7A, 21D 12B, 11U, 20U
2D, 6D, 5B 19U, 15D, 7D 22D, 18B, 15U
27A, 2D, 26D 20A, 8D, 8A 16A, 31A, 33A
5D, 3A, 25B 30D, 14A, 9A 16B, 24D, 23B
28D, 35A, 3U 30U, 9U, 13D 22A, 32U, 32D
4U, 21A, 21D 19U, 17D, 10A 32U, 34A, 33A
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
1007
1 2 3 4 5 6
7 8 9
10 11 12 13
14 15 16 17 18 19
20 21 22
23 24 25 26
27 28 29 30 31 32
33 34 35
The answers are distinct 2- and 3-digit decimal numbers, none be-
ginning with zero. Each of the above sets of answers is a primitive
Pythagorean triple, in increasing size, so that the third member is the
hypotenuse.
A = across, B = back, D = down, U = up.
For example, 1B has its tens and units digits in the squares labeled 2
and 1 respectively; 11U is a 3-digit number with its tens and units digits
in squares 16 and 11 respectively.
Problem B1. (a) Find an integer right triangle such that the hy-
potenuse minus each of the sides gives a cube.
(b) Find an integer right triangle such that the hypotenuse added to
each of the sides gives a cube.
1
Problem B3. A man has a square eld, 60 feet by 60 feet, with
other property adjoining the highway. He put up a straight fence in the
line of 3 trees, at A, P, Q. If the distance between P and Q is 91 feet,
and that from P to C is an exact number of feet, what is this distance?
Problem B4. Find the general form of a primitive Pythagorean
triangle whose perimeter is a square. Give the smallest one.
1
These two problems appeared in Diophantus Arithmetica.
1008 Heron triangles and Elliptic Curves
60
60
9
1
?
A B
C D
P
Q
Problem B5. Find the shortest perimeter common to two different
primitive Pythagorean triangles.
Problem B6. Solve the equation
1
x
2
+
1
y
2
=
1
z
2
in positive integers.
Problem B7. It is known that the inradius r of a triangle with sides
(a, b, c) is given by r
2
=
(sa)(sb)(sc)
s
, where s =
1
2
(a + b +c). Deter-
mine all integer triangles with inradius 1.
Problem B8. The area of a triangle with sides a, b, c is given by
the Heron formula
2
= s(s a)(s b)(s c),
where s =
1
2
(a +b +c). Determine all integer triangles with area equal
to perimeter.
Problem B9. Let a, b, c Z. Prove that the line ax + by = c is
tangent to the unit circle x
2
+y
2
= 1 if and only if a
2
+b
2
= c
2
.
Problem B10. For each natural number n, how many Pythagorean
triangles are there such that the area is n times the perimeter ? How
many of these are primitive ?
Problem B11 (Optional). Show that there are an innite number
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
1009
of Pythagorean triangles whose hypotenuse is an integer of the form
3333 3.
Problem B12 (Optional). A lattice triangle is one whose vertices
have integer coordinates. Determine all lattice triangles whose sides are
tangent to the unit circle x
2
+y
2
= 1.
Problem C1. Find a parametrization of the rational points on the
circle x
2
+y
2
= 2.
Problem C2. For each of the following equations, nd a solution
in small positive integers.
Equation Positive integer solution (x, y)
x
2
2y
2
= 1 (1, 1)
x
2
2y
2
= 1 (3, 2)
x
2
3y
2
= 1
x
2
5y
2
= 1
x
2
5y
2
= 1
x
2
7y
2
= 1
x
2
8y
2
= 1
x
2
10y
2
= 1
x
2
10y
2
= 1
x
2
11y
2
= 1
x
2
12y
2
= 1
x
2
13y
2
= 1
x
2
13y
2
= 1
Problem C3. (a) For each of the integers n = 5, . . . , 34, write, if
possible, n as a sum of consecutive integers.
1010 Heron triangles and Elliptic Curves
n = sum n = sum n = sum
5 = 2 + 3 6 = 1 + 2 + 3 7 = 3 + 4
8 = 9 = 10 =
11 = 12 = 13 =
14 = 15 = 16 =
17 = 18 = 19 =
20 = 21 = 22 =
23 = 24 = 25 =
26 = 27 = 28 =
29 = 30 = 31 =
32 = 33 = 34 =
(b) Make a conjecture on the condition of a positive integer being a
sum of consecutive integers (more than one).
(c) Can you prove your conjecture?
Problem C4. Find all rational points on the curve x
2
2y
2
4x
4y + 2 = 0.
Problem C5. For each of the following conics, either nd a rational
point or prove that there are no rational points.
1. x
2
+y
2
= 6.
2. 3x
2
+ 5y
2
= 4.
3. 3x
2
+ 6y
2
= 4.
Problem D1.
Accompanying each prime p 1 (mod 4) below is a square root q
of 1 (mod p) with q
2
+ 1 = mp. Make use of this information and
follow Eulers proof to write p as a sum of two squares.
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
1011
p q m
7937 1962 485
7993 2110 557
8017 1813 410
8069 2732 925
8089 2293 650
Problem D2.
For each of the following primes p 1 (mod 4), write p as a sum
of two squares of integers by easy inspection. Make use of this to nd a
square root of 1 mod p.
p x
2
+y
2
square root of 1 (mod p)
13 3
2
+ 2
2
73
97
113
137
149
157
173
181
Problem D3. Use Gauss lemma to compute the Legendre symbol
_
7
31
_
.
Problem D4. Show that 3 is a quadratic residue of p if and only
if p = 6n + 1.
Problem D5. Show that 5 is a quadratic residue of all primes of
the forms 10n 1, and a quadratic nonresidue of all primes of the form
10n 7.
1012 Heron triangles and Elliptic Curves
Problem D6. In each of the following cases decide by calculating a
Legendre symbol if the congruence is solvable. If so, nd the solutions.
(a) x
2
11 (mod 59);
(b) x
2
7 (mod 83);
(c) x
2
73 (mod 127);
(d) x
2
11 (mod 37).
Problem D7. Show that 6 is a quadratic residue mod 101 and cal-
culate its square roots.
Problem E1. Find the square root of 2 modulo p for
1. p = 17
2. p = 19
3. p = 23
Problem E2. Let p be an odd prime. Show that 5 is a quadratic
residue modulo p if and only if p 1, 3, 7, 9 (mod 20).
Problem E3. For each of the following primes, decide if 5 is a
quadratic residue modulo p. If so, nd a square root of 5 (mod p).
1. p = 17
2. p = 19
3. p = 23
4. p = 29
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
1013
Problem E4. Solve the congruences
(a) x
2
30 (mod 113). (b) x
2
7 (mod 113).
Problem E5. (a) Write down the quadratic residues modulo 11.
(b) For each of the quadratic residue a modulo 11, nd two solutions
of the congruence x
2
a (mod 11).
Problem F1.
Let a be a positive integer. Find the continued fraction expansion of
a
2
+ 1 and exhibit its periodicity.
Problem F2.
Let a be a positive integer. Find the continued fraction expansion of
a
2
+a and exhibit its periodicity.
Problem F3. Find the continued fraction expansion of
29 and
exhibit its periodicity.
Problem F4. Find the continued fraction expansion of
44 and
exhibit its periodicity.
Problem F5. Find the continued fraction expansions of the follow-
ing quadratic irrationalities:
(i)
1
4
(
5 + 1), (ii)
51, (iii)
71.
Problem F6. Let d = 14. Determine
(i) the continued fraction expansion of
d;
(ii) the fundamental solution of the Pell equation x
2
dy
2
= 1;
(iii) the complete solution of the Pell equation x
2
dy
2
= 1 in the
form of a recurrence relation;
1014 Heron triangles and Elliptic Curves
(iv) the second and third smallest solution of the equation x
2
dy
2
=
1.
Problem F7. Let d = 13. Determine
(i) the continued fraction expansion of
d;
(ii) the fundamental solution of the Pell equation x
2
dy
2
= 1;
(iii) the complete solution of the Pell equation x
2
dy
2
= 1 in the
form of a recurrence relation;
(iv) the second and third smallest solution of the equation x
2
dy
2
=
1.
Problem F8. The nth triangular number is given by T
n
=
1
2
n(n+
1). Find all integers n for which the sum of the (n 1)st, the nth,
and the (n + 1)st triangular numbers is a square.
Problem F9. The pentagonal numbers are the sums of the arith-
metic progression
1 + 4 + 7 + + (3n 2) +
The nth pentagonal number is P
n
=
1
2
n(3n 1). Find all integers n
for which P
n
is a square.
Problem F10.
1. A developer wants to build a community in which the n (approxi-
mately 100) homes are arranged along a circle, numbered consec-
utively from 1, 2, . . . n, and are separated by the club house, which
is not numbered. He wants the house numbers on one side of club
14.1 The elliptic curve y
2
= (x k)
2
4kx
3
1015
house adding up to the same sum as the house numbers on the other
sides. Between which two houses should he build the club house?
How many houses are there altogether?
2. Later the developer nds out that government law requires the club
house also has to be numbered. If he wants to maintain equal house
number sums on both sides, he nds that he has to build signi-
cantly fewer homes. How many homes should he build, and what
is the number of the club house?
Bibliography
[AZ] M. Aigner and G. M. Ziegler, Proofs from the BOOK, Springer,
1999.
[And] G. E. Andrews, Number Theory, 1971; Dover reprint, 1994.
[Ble] A. H. Bleiler, Recreations in the Theory of Numbers, Dover, 1966.
[Cas] J. W. S. Cassels, Lectures on Elliptic Curves, LMS Student Texts
24, Cambridge University Press, 1991.
[DSV] G. Davidoff, P. Sarnak, and A. Valette, Elementary Number The-
ory, Group Theory, and Ramanujan Graphs, LMS Student Texts
55, Cambridge University Press, 2003.
[Dic] L. E Dickson, History of the Theory of Numbers, 3 volumes,
Chelsea; Dover reprint.
[Gro] E. Grosswald, Representations of Integers as Sums of Squares,
Springer-Verlag, 1985.
[Guy] R. K. Guy, Unsolved Problems in Number Theory, 3rd edition,
2004, Springer.
[HK] A. Hurwitz and N. Kritikos, Lectures on Number Theory,
Springer-Verlag, 1986.
[Lev] W. LeVeque, Fundamentals of Number Theory, 1977; Dover
reprint, 1996.
[OLD] C. D. Olds, A. Lax, and G. Davidoff, The Geometry of Numbers,
Anneli Lax New Mathematical Library, volume 41, MAA, 2000.
[Rob] J. Roberts, Elementary Number Theory, A Problem Oriented Ap-
proach, MIT Press, 1977.
1102 BIBLIOGRAPHY
[SO] W. Scharlau and H. Opolka, FromFermat to Minkowski, Springer-
Verlag, 1984.
[ST] I. Stewart and D. O. Tall, Algebraic Number Theory and Fermats
Last Theorem, 3rd edition, AK-Peters, 2001.
[Tat] J. J. Tattersall, Elementary Number Theory in Nine Chapters, 2nd
edition, Cambridge, 2005.
[Wei] A. Weil, Number Theory, An approach through history, from
Hammurapi to Legendre, Birkh auser, 1984.
BIBLIOGRAPHY 1103
[Articles]
[1] R. A. Beauregard, No arithmetic cyclic quadrilaterals, College
Math. Journal, 37 (2006) 110113.
There is no cyclic quadrilateral whose sides are integers in arithmetic progression and
whose area is an integer. This is a consequence of Eulers theorem that the product of
four distinct nonzero integers in arithmetic progression cannot be a square.
[2] R. A. Beauregard and K. D. Zelator, Perfect cyclic quadrilaterals,
Math. Mag., 7 (2002) 138143.
[3] L. E. Dickson, Lowest integers representing sides of a right trian-
gle, Amer. Math. Monthly, 1 (1894) 611.
[4] T. Erd elyi, On the equation a(a +d)(a +2d)(a +3d) = x
2
, Amer.
Math. Monthly, 107 (2000) 166169.
[5] K. Fogarty and C. OSullivan, Arithmetic progressions with three
parts in prescribed ratio and a challenge of Fermat, Math. Mag.,
77 (2004) 389391.
[6] A. Hall, Geneology of Pythaogean triads, Math. Gazette, 54
(1970) 377379.
[7] P Hilton and J. Pedersen, Casting out nines revisited, Math. Mag.,
54 (1981) 195201.
[8] J. A. Holdener, Conditions equivalent to the existence of odd per-
fect numbers, Math. Mag., 79 (2006) 389391.
[9] I. Kleiner, Fermat: the founder of modern number theory, Math.
Mag., 78 (2005) 314.
[10] H. Klostergaard, Tabulating all Pythagorean triples, Math. Mag.,
51 (1978) 226227.
[11] L. P. Markov, Pythagorean triples and the problem A = mP for
triangles, Math. Mag., 79 (2006) 114121.
[12] R. B. McNeill, Square roots of 1, Math. Mag., 51 (1978) 244.
[13] P. S. Park, Ramanujans continued fraction for a puzzle, College
Math. Journal 36 (2005) 363365.
[14] J. Poet and D. L. Vestal Jr., Curious consequences of a miscopied
quadratic, College Math. Journal, 36 (2005) 273277.
1104 BIBLIOGRAPHY
[15] I. Richards, Continued fractions without tear, Math. Mag., 54
(1981) 163171.
[16] F. Saidak, A new proof of Euclids theorem, Amer. Math. Monthly,
113 (2006) 937938.
[17] P. J. Schillo, On primitive Pythagorean triangles, Amer. Math.
Monthly, 58 (1951) 3032.
[18] S. Szab o, A paper-and-pencil gcd algorithmfor Gaussian integers,
College Math. Journal 36 (2005) 374380.
[19] P. Ungar, Irrationality of square roots, Math. Mag., 79 (2006) 147
148.
[20] P. W. Wade and
[21] A. Wayne, A genealogy of 120
and 60