Section 14.1 A Complex Situation
ΒΆSubsection 14.1.1 A new interpretation
ΒΆLet's see another to interpret sums of squares. Suppose first that, as before,Example 14.1.1.
For instance, we could factor the prime number thirteen!!!
xxxxxxxxxx
print(3^2+2^2)
print( (3+2*i)*(3-2*i))
Definition 14.1.2.
The Gaussian Integers Z[i] may be defined as the set
This does assume that we can have such a symbol i with i2=β1; typically this is considered to thus be a subset of the so-called complex numbers, denoted C.
Remark 14.1.3.
These are named after C.F. Gauss, who explored them a great deal, though others were at least incipiently aware of them. There are so many stories about Gauss that one can hardly know where to begin, and he will come up again when we continue exploring prime numbers in Section 21.2; perhaps most relevant to our work is that he actually published about Gaussian integers!

Subsection 14.1.2 Revisiting the norm
ΒΆHow can we decide whether the verb βto factorβ is legitimate to use in a given number system? In the Gaussian integers, the reason we can is that prime numbers can be defined for this new system as well.Fact 14.1.5.
Prime numbers in the Gaussian integers, or Gaussian primes, are of three possible forms:
Given a prime pβZ of the form p=4n+3, Β±pβZ[i] is prime.
Given a prime pβZ of the form p=4n+3, Β±pβ iβZ[i] is also prime.
Given a prime pβZ not of the form p=4n+3, the factors a+bi and aβbi in Z[i] corresponding to writing p=a2+b2 are prime (recall Theorem 13.5.5).

xxxxxxxxxx
def _(viewsize=10):
lattice_pts = [[i,j] for i in [-viewsize..viewsize] for j in [-viewsize..viewsize]]
plot_lattice_pts = points(lattice_pts,rgbcolor=(0,0,0),pointsize=2)
GG.<I> = GaussianIntegers()
Gaussian_primes = [ x for x in lattice_pts if GG(x[0]+x[1]*I).is_prime() ]
plot_Gaussian_primes = sum([polygon([(G[0]+1/2,G[1]+1/2), (G[0]+1/2,G[1]-1/2), (G[0]-1/2,G[1]-1/2), (G[0]-1/2,G[1]+1/2)],alpha=.6) for G in Gaussian_primes])
show(plot_Gaussian_primes+plot_lattice_pts, aspect_ratio=1)
pretty_print(html("Plot of Gaussian primes with coordinates less than {0} in absolute value".format(viewsize)))
Example 14.1.7.
The norm of 3+2i is 32+22=13 while the norm of 13=13+0i is 169.
xxxxxxxxxx
ZZI.<I> = GaussianIntegers()
(1+I).is_prime()
Subsection 14.1.3 A different approach to sums of squares
ΒΆThe Gaussian integers allow a quite different approach to the fact primes of the form 4n+1 can be written as a sum of squares. We could use complex numbers instead of geometry. Unfortunately, it requires us to take an algebraic fact on faith instead of the fact we proved using geometry; there are no shortcuts. Still, it's worth looking at.Fact 14.1.8.
If pβ‘1 (mod 4) is prime, then p can be written as a sum of two squares. (This is Theorem 13.4.5.)
Proof.
We already know, from the proof of Lemma 13.3.3 that
is a square root of \(-1\) modulo \(p\text{.}\) But now, instead of doing geometry, let's look at what that means.
By definition of
we know that \(p\mid f^2+1\text{.}\) Since \(f^2+1\) is \(f^2-i^2\text{,}\) let's factor:
Clearly \(p=p+0i\) does not divide either \(f+i\) or \(f-i\) evenly in \(\mathbb{Z}[i]\text{,}\) but it does divide their product. So (crucially!), if we assume the Fundamental Theorem of Arithmetic still holds for Gaussian integers, then \(p\) factors in \(\mathbb{Z}[i]\) and has a prime divisor of the form \(a+bi\) (in the sense of Subsection 14.1.2) dividing \(f+i\) or \(f-i\text{.}\)
Given that \(a+bi\mid p\text{,}\) it's not hard to show that then \(a-bi\) also must divide \(p\text{.}\) We'll skip this.
To finish up, combine these facts to see that
and the factor \(a^2+b^2\) is not equal to one, since \(a+bi\) was a proper divisor of \(p\text{.}\) Since \(p\) is an integer prime, the only possibility is
Remark 14.1.9.
As a final note to the complex point of view, one may note that there is a way to view primitive Pythagorean triples as Gaussian integers as well. In this case one uses Fact 13.1.7 to put a group multiplication on this set! See [C.7.29] for more details, such as the multiplication involved and the structure of the group, which an inquiring reader may wish to relate to Remark 3.4.8 and similar facts.