Gaussian Integers
Lesson 03 showed that when p ≡ 1 (mod 4) the integers mod p contain a square root of −1. Over the ordinary integers there is none, so we adjoin one: a number i with i2 = −1. The resulting Gaussian integers x + yi form a square lattice in the plane, where multiplying by i is a quarter turn. You will build their arithmetic, the conjugate, trace and norm, prove the norm multiplies, find the units, divide with remainder, and connect ℤ[i] back to arithmetic mod p.
Where this lesson is headed
In words: the norm, the squared distance from 0, multiplies. So the only Gaussian integers that can be undone are the four of norm 1, and division with remainder works, with a remainder of smaller norm. When p ≡ 1 (mod 4), sending i to a square root u of −1 mod p turns Gaussian arithmetic into arithmetic mod p.
i: a number with i2 = −1
ℤ[i] = {x + yi : x, y ∈ ℤ}, the Gaussian integers
z̄ = x − yi: the conjugate of z = x + yi
Tr(z) = z + z̄ = 2x: the trace
N(z) = z z̄ = x2 + y2: the norm
unit: some w has zw = 1
01. Numbers you can multiply as points
Start with z = 2 + i and w = 1 + 2i. The plane shows z, its quarter turn iz, its mirror image z̄, w, and the product zw. Change the coordinates and watch what the trace and norm do. The lower panel shows the same arithmetic mod p = 13, where 5 plays the role of i.
Guided experiments
Do these in order. "Set this up" chooses z, w and p.
Lattice points of a given norm
How many Gaussian integers have norm n? They are the lattice points on the circle of radius √n.
Try n = 1, 2, 3, 5, 13, 25, 21. Which n have no points at all? Lesson 05 answers that for primes.
02. Conjugate, trace and norm
Each step has the general statement on the left and your z, w and p from Stage 01 on the right.
i, its powers, and the quarter turn
From i2 = −1: i3 = −i, i4 = 1, so the powers cycle 1, i, −1, −i with period 4, and in depends only on n mod 4. Multiplying x + yi by i gives ix + i2y = −y + xi:
a quarter turn counterclockwise about 0. Two quarter turns send z to −z.
Gaussian integers add and multiply
Expanding and using i2 = −1:
Sums and products of Gaussian integers are Gaussian integers, and the usual laws (commutative, associative, distributive) carry over from polynomial arithmetic. ℤ[i] is a ring containing ℤ.
The conjugate
z̄ = x − yi is the mirror image across the real axis. Replacing i by −i respects the rules (both square to −1), so
and z + z̄ = 2x, z z̄ = x2 + y2 are real: the imaginary parts cancel.
Trace adds, norm multiplies
Tr(z) = z + z̄ = 2x adds: Tr(z + w) = Tr z + Tr w. The norm multiplies:
Written out, this is the two-squares identity
Neither trace nor norm can tell z from z̄: both are unchanged by conjugation. (Lesson 09 meets exactly this ambiguity.)
The units are 1, i, −1, −i
If zw = 1 then N(z)N(w) = N(1) = 1, and norms are positive integers, so N(z) = 1: x2 + y2 = 1 forces z ∈ {±1, ±i}. Conversely each of these is undone by its conjugate. So the units are exactly the four powers of i.
Two Gaussian integers differing by a unit factor (z and iz, say) are called associates; they have the same norm.
Division with remainder
Given z and w ≠ 0, the exact quotient z/w = z w̄ / N(w) has rational coordinates. Round each to the nearest integer to get q ∈ ℤ[i]; the rounding error has each coordinate at most ½ in size, so
So ℤ[i] has a Euclidean algorithm, with the norm playing the role of size. Lesson 05 uses it to find a2 + b2 = p.
A copy of i mod p
If p ≡ 1 (mod 4), put u = g(p−1)/4. Then u2 = g(p−1)/2 ≡ −1, and the powers of u cycle 1, u, −1, −u exactly like the powers of i. The rule
respects sums and products, because the product formula of step 2 only used i2 = −1. If p ≡ 3 (mod 4) no such u exists (Lesson 03).
03. The results
Assemble the arguments, then test them by computer.
Complete proofs
(a) Conjugation x + yi ↦ x − yi preserves sums and, since (−i)2 = −1, products. Hence N(zw) = zw·z̄w̄ = N(z)N(w). The trace 2x is additive.
(b) zw = 1 gives N(z)N(w) = 1 with both factors positive integers, so N(z) = 1 and z ∈ {±1, ±i}; each of these has inverse z̄.
(c) Let z/w = s + ti with s, t rational, choose integers m, n with |s − m|, |t − n| ≤ ½, and put q = m + ni, r = z − qw. Then r = (z/w − q)w, so N(r) = ((s − m)2 + (t − n)2)N(w) ≤ N(w)/2.
(d) (g(p−1)/4)2 = g(p−1)/2 ≡ −1. The map sends sums to sums, and (a + bu)(c + du) = ac + bdu2 + (ad + bc)u ≡ (ac − bd) + (ad + bc)u, which is the image of the product. ∎
Computer check
Tests N(zw) = N(z)N(w) and Tr(z + w) = Tr z + Tr w on 20,000 random pairs, division with remainder on 20,000 random pairs, the list of units among all points with |x|, |y| ≤ 20, and for every prime below 1000 whether a square root of −1 exists (exactly when p ≡ 1 mod 4) and whether the map to ℤ/pℤ respects products.