6 The Gaussian Integers: Review
6 The Gaussian Integers: Review
6 The Gaussian Integers: Review
P REVIEW
The Gaussian integers Z[i] are the simplest generalization of the or-
dinary integers Z and they behave in much the same way. In par-
ticular, Z[i] enjoys unique prime factorization, and this allows us to
reason about Z[i] the same way we do about Z. We do this because
Z[i] is the natural place to study certain properties of Z. In particu-
lar, it is the best place to examine sums of two squares, because in
Z[i] we can factorize a sum of two integer squares into linear factors:
x2 + y2 = (x − yi)(x + yi).
In the present chapter we use this idea to prove a famous theorem
of Fermat: if p > 2 is prime then p = a2 + b2 , for some natural
numbers a and b, if and only if p = 4n + 1 for some natural number
n. The Fermat two square theorem turns out to be related, not only
to unique prime factorization in Z[i], but also to the actual “primes”
of Z[i], the so-called Gaussian primes.
The Gaussian primes are easily shown to include the ordinary primes
that are not sums of two squares, and the factors a − bi and a + bi of
each ordinary prime of the form a2 + b2 . Unique prime factorization
in Z[i] establishes that these are the only Gaussian primes, up to
multiples by ±1 and ±i.
An easy congruence argument shows that ordinary primes of the
form 4n + 3 are not sums of two squares. The two square theorem
then shows that the primes that are sums of two squares are 2 and
all the remaining odd primes, namely, those of the form 4n + 1.
The proof of the two square theorem involves an important lemma
proved with the help of Wilson’s theorem: each prime p = 4n + 1
101
102 6 The Gaussian integers
Z[i] = {a + bi : a, b ∈ Z}
because he knew that the product of sums of two squares is itself the sum
of two squares. Today we recognize this formula as equivalent to the mul-
tiplicative property of absolute value,
Exercises
When discussing factorization there are always trivial factors, called units, that we
prefer to ignore. For example, in N the only unit is 1, in Z the units are 1 and −1,
and in Z[i] the units are the elements of norm 1.
6.1.1 Show that the units of Z[i] are ±1, ±i.
√
Likewise,
√ the units of Z[ n] are its elements of norm 1, that is, the numbers
a + b n with a2 − nb2 = 1.
√
6.1.2 Describe the units of Z[ 2].
√
6.1.3 Show that Z[ n] has infinitely many units for any nonsquare natural num-
ber n.
then
norm(γ ) = norm(α )norm(β ),
that is, norm(α ) divides norm(γ ).
Because of this, questions about divisibility in Z[i] often reduce to
questions about divisibility in Z. In particular, it is natural to define a
Gaussian prime to be a Gaussian integer that is not the product of Gaus-
sian integers of smaller norm. Then we can answer various questions about
Gaussian primes by looking at norms.
Examples.
1. 4 + i is Gaussian prime.
Because norm(4 + i) = 16 + 1 = 17, which is a prime in Z. Hence
4+i is not the product of Gaussian integers of smaller norm, because
no such norms divide 17.
104 6 The Gaussian integers
Exercises
An equivalent way to define Gaussian primes, in line with a common way of
defining ordinary primes, is to say that ϖ is a Gaussian prime if ϖ is divisible
only by units and units times ϖ . (It is conventional to use the Greek letter pi to
denote primes in Z[i] and other generalizations of Z, the way p is used to denote
ordinary primes. However, to avoid confusion with π = 3.14159 . . . I prefer to use
ϖ , the variant form of pi.)
Ordinary primes are not always Gaussian primes, as we have already seen in
the case of 2. In fact, 2 is “almost a square” in Z[i].
6.3 Conjugates
The conjugate of z = a + bi is z = a − bi. The basic properties of conjuga-
tion (not only in Z[i] but for all complex numbers z) are
zz = |z|2 ,
z1 + z2 = z1 + z2 ,
z1 − z2 = z1 − z2 ,
z1 × z2 = z1 × z2 .
p = (a + bi)γ ,
where a + bi and γ are Gaussian integers with norm < the norm p2 of p
(and hence also of norm > 1). Taking conjugates of both sides we get
p = (a − bi)γ ,
p2 = (a − bi)(a + bi)γγ
= (a2 + b2 )|γ |2 ,
Exercises
6.3.1 Verify the basic properties of conjugation mentioned above.
The proof of the classification of real Gaussian primes has the following in-
teresting consequences.
6.3.2 Show that each ordinary prime has a distinct Gaussian prime associated
with it.
6.3.3 Deduce that there are infinitely many Gaussian primes.
Since the real positive Gaussian primes are those of the form 4n + 3, another
way to prove that there are infinitely many Gaussian primes is to show that there
are infinitely many ordinary primes of the form 4n + 3. The proof is along lines
similar to Euclid’s proof in Section 1.1.
6.3.4 Show that the product of numbers of the form 4n + 1 is of the same form.
Deduce that any number of the form 4n + 3 has a prime divisor of the form
4n + 3.
6.3.5 If p1 , p2 , . . . , pk are primes of the form 4n + 3, show that 2p1 p2 · · · pk + 1 is
also of the form 4n + 3.
6.3.6 Deduce from Exercises 6.3.4 and 6.3.5 that there are infinitely many primes
of the form 4n + 3.
6.4 Division in Z[i] 107
α = µβ + ρ with |ρ | < |β |.
Proof. This property becomes obvious once one sees that the Gaussian
integer multiples µβ of any Gaussian integer β = 0 form a square grid in
the complex plane.
This is because multiplication of β by i rotates the vector from 0 to β
through 90◦ , hence 0, β , and iβ are three corners of a square. All other
multiples of β are sums (or differences) of β and iβ , hence they lie at the
corners of a square grid. (Figure 6.1.)
iβ
β
Exercises
Using unique prime factorization we can prove results on squares and cubes in
Z[i], similar to those on squares and cubes in N proved in Section 2.5. The only
difference is that we have to take account of units, as indeed we already do in Z.
6.4.1 Is it true in Z that relatively prime factors of a square are themselves squares?
If not, how should the statement be modified to make it correct?
6.4.2 Show that relatively prime factors of a cube in Z are themselves cubes.
6.4.3 Formulate a theorem about relatively prime factors of a square in Z[i].
6.4.4 Show that relatively prime factors of a cube in Z[i] are themselves cubes.
6.5 Fermat’s two square theorem 109
1 × 2 × 3 × · · · × (p − 1) ≡ −1 (mod p).
−1 ≡ 1 × 2 × 3 × · · · × 4n (mod p)
≡ (1 × 2 × · · · × 2n)×
((2n + 1) × · · · × (4n − 1) × (4n)) (mod p)
≡ (1 × 2 × · · · × 2n)×
((−2n) × · · · × (−2)(−1)) (mod p) since p − k ≡ −k (mod p)
≡ (1 × 2 × · · · × 2n) (−1)
2 2n
(mod p)
≡ (1 × 2 × · · · × 2n)2 (mod p)
m2 + 1 = (m − i)(m + i).
And, even though p divides m2 +1, p does not divide m−i or m+i because
p − p and p + p are not Gaussian integers.
m i m i
Exercises
Here is another way in which Z[i] throws light on sums of two squares. The
following exercises develop a proof of a theorem of Euler (1747): if gcd(a, b) = 1
then any divisor of a2 + b2 is of the form c2 + d 2 where gcd(c, d) = 1. The main
steps depend on unique prime factorization in Z[i].
6.5.1 Give an example that shows why the condition gcd(a, b) = 1 is necessary.
6.5.2 Show that each integer divisor e > 1 of a2 + b2 is a product of Gaussian
prime divisors q + ir of a2 + b2 , unique up to unit factors.
6.5.3 Show that each of the Gaussian primes q + ir divides either a − ib or a + ib.
Deduce that none of them is an ordinary prime p.
6.5.4 Show that, along with each Gaussian prime factor q + ir of e, its conjugate
q − ir is also a factor.
6.5.5 Deduce from Exercise 6.5.4 that e is of the form c2 +d 2 where c+di divides
a + bi.
6.5.6 Deduce from Exercise 6.5.5 that gcd(c, d) = 1.
(s − ti)2 , −(s − ti)2 , i(s − ti)2 , −i(s − ti)2 , for some s,t ∈ Z.
In each case, equating real and imaginary parts gives one of x and y in
the form u2 − v2 and the other in the form 2uv for some natural numbers
u and v. Thus the result is essentially the same as that obtained by the
loose argument in Section 1.8, but better, because it does not force the
even member of the pair, 2uv, to be first.
Moreover, we necessarily have gcd(u, v) = 1 because any common
prime divisor of u and v is a common divisor of u2 − v2 and 2uv, hence
of x and y. Thus the correct outcome of the speculation in Section 1.8 is:
112 6 The Gaussian integers
Exercises
The last result, together with Fermat’s two square theorem, shows that the primes
of the form 4n + 1 are precisely those occurring as hypotenuses of integer right-
angled triangles.
6.6.1 Find integer right-angled triangles with hypotenuses 5, 13, 17 (you should
know these), and 29, 37, and 41.
6.6.2 Given a prime p = 4n + 1, is the integer right-angled triangle with hy-
potenuse p unique?
The argument above shows that, if (x, y, z) is a primitive Pythagorean triple,
then x + yi is a unit times a square in Z[i]. But once we know that x = u2 − v2 ,
y = 2uv we can say more.
6.6.3 If (x, y, z) is a primitive Pythagorean triple with x odd, show that x + yi is a
square in Z[i].
6.6.4 Verify directly that 3 + 4i is a square in Z[i].
It should be clear from your answer to Question 6.6.3 that finding the pa-
rameters u and v for a given primitive Pythagorean triple (x, y, z), with x odd, is
equivalent to finding the square root(s) of a complex number.
6.6.5 Find the square root of 5 + 12i.
6.6.6 If you have some software for computing square roots of complex numbers,
verify that each entry (x, y, z) in Plimpton 322 (Section 1.6), except the
triple (60, 45, 75), yields a y+xi that is a square in Z[i]. (Note: this includes
the last triple (90, 56, 106), which is clearly not primitive.)
6.6.7 Explain how to compute the square root of a complex number by hand,
using quadratic equations.
6.7 ∗ Primes of the form 4n + 1 113
Therefore, no prime divides g(y), for any y ∈ Z, and hence the only
possible values of the integers g(y) are ±1. In other words,
Exercises
The argument just used to prove that x2 + 1 is divisible by infinitely many primes
can be generalized to any nonconstant polynomial f (x) with integer coefficients.
We suppose that
has values divisible only by the primes p1 , p2 , . . . , pk , and consider the polynomial
f (a0 p1 p2 · · · pk y) = a0 g(y),
6.8 Discussion
The two square theorem was stated without proof by Fermat in 1640,
though he claimed to have a proof by descent: assuming there is a prime
that is of the form 4n + 1 but not a sum of two squares he could show that
there is a smaller prime with the same property. The first known proof of
the theorem was in fact by descent, and published by Euler (1755). It cost
him several years of effort.
Today it is possible to give quite simple proofs with the help of the re-
sult we called Lagrange’s lemma in Section 6.5. Lagrange himself proved
this lemma by means of Fermat’s little theorem and his own theorem on
the number of solutions of congruences mod p (Section 3.5).
Lagrange (1773) used his lemma together with his theory of equiva-
lence of quadratic forms (Section 5.6) to give a new proof of the two square
theorem. The part of the proof involving quadratic forms was simplified by
Gauss (1801), long before his creation of the Gaussian integers. It seems
that Gauss had the main results about Z[i], including unique prime fac-
torization, around 1815, but they were first published in 1832. The proof
used in this chapter, combining unique prime factorization in Z[i] with La-
grange’s lemma, is due to Dedekind (1894).
Yet another popular proof uses the geometry of numbers, developed in
the 1890s by Minkowski. It may be found in Scharlau and Opolka (1985)
together with a historical introduction to Minkowski’s results.
Parallel to all the popular proofs of the two square theorem there are
analogous proofs of the four square theorem of Lagrange (1770): every
natural number is the sum of (at most) four natural number squares. Most
use the following counterpart of Lagrange’s lemma: any prime p divides
a number of the form l 2 + m2 + 1. The counterpart turns out to be easier.
What is harder is the four square identity discovered by Euler (1748b). It is
analogous to the two square identity of Section 6.1 but is much more com-
plicated (see Section 8.3). It can be mechanically checked by multiplying
out both sides, but what does it mean?
The Gaussian integer proof is favored in this book because Z[i] is a
natural structure and the two square identity is a natural part of it—the
multiplicative property of the norm—rather than an accidental identity of
formal expressions. In Chapter 8 we give a similar “structural” proof of
the four square theorem that uses the quaternion integers. These are a
remarkable four-dimensional structure from which the four square identity
116 6 The Gaussian integers
p = x2 + 2y2 ⇔ p = 8n + 1 or p = 8n + 3,
p = x2 + 3y2 ⇔ p = 3n + 1.
Our proof of the two square theorem in Section 6.5 can be adapted to Fer-
mat’s x2 + 2y2 and x2 + 3y2 theorems with the help √ of unique prime√fac-
torization theorems for numbers of the forms a + b −2 and a + b −3
respectively. Such theorems will be proved in the next chapter.
The other thing we need to adapt is Lagrange’s lemma: if p = 4n + 1
then p divides a number of the form m2 + 1 for some m ∈ Z. In Section
6.7 we described this lemma (together with its converse) as the quadratic
character of −1 because it says that −1 is congruent to a square mod p
precisely when p = 4n + 1.
To prove Fermat’s theorems on primes of the form x2 +2y2 and x2 +3y2
we similarly need the quadratic characters of −2 and −3. They are:
−2 ≡ square (mod p) ⇔ p = 8n + 1 or 8n + 3,
−3 ≡ square (mod p) ⇔ p = 3n + 1.