Example14.1.1
For instance, we could factor the prime number thirteen!!!
Let's see another to interpret sums of squares. Suppose first that, as before, \begin{equation*}n=a^2+b^2\; .\end{equation*} Then, if we let the symbol \(i\) stand for a (putative) square root of negative one, so that \(-1=i^2\), we could legitimately factor the equation: \begin{equation*}n=a^2-(i^2b^2)=(a+bi)(a-bi)\end{equation*}
For instance, we could factor the prime number thirteen!!!
It turns out that there is a beautiful connection between the theory of numbers representable as a sum of two squares and the following beautiful definition.
The Gaussian Integers \(\mathbb{Z}[i]\) may be defined as the set \begin{equation*}\mathbb{Z}[i]=\{a+bi\mid a,b\in\mathbb{Z}\}\end{equation*} This does assume that we can have such a symbol \(i\) with \(i^2=-1\).
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!
If we bring back our lattice of integer points, we can think of such numbers as being points on the lattice, where the coordinate point \((3,2)\) corresponds to \(3+2i\), one of the ‘factors’ of 13. I'll plot both ‘factors’ below.
There are many amazing questions to ask about this, and wonderful connections to abstract algebra. For example, the factorization of \(a^2+b^2\) yielding \(i\), a “square root of negative one” over the integers, should mean we aren't surprised that there is a connection with “square roots modulo \(n\)”. More to our purposes, there is a direct connection to writing numbers as a sum of squares, and we will show that it can be done more directly in the next section.
How can we decide whether the verb “factor” becomes the legitimate word factor in such a number system? The reason we can is because prime numbers can be defined for this new system as well.
Prime numbers in the Gaussian integers are of the following three possible forms:
The form \(p=4n+3\) for a (normal) integer prime
The form \(pi\) for \(p\) of the same form
The factors with respect to \(i\) of the (normal) primes of the form \(p=4n+1\) and \(p=2\)
We know the latter exist because we can write them as the sum of two squares.
Viewing these so-called Gaussian primes is fun. Many authors have created beatiful graphics such as this.
The basic reason this even makes sense is that we can use the Euclidean algorithm here. First, let's use the same definition of norm as we used earlier for the points, so that \(N(x+iy)=x^2+y^2\).
The norm of \(3+2i\) is \(3^2+2^2=13\) while the norm of \(13=13+0i\) is \(169\).
The difference is that instead of saying simply that \(a=bq+r\) for \(r< b\), we will need to compare the norms of \(r\) and \(b\). Namely, you can write two Gaussian integers \(a\) and \(b\) as \(a=bq+r\), where \(0\leq N(r)<N(b)\). Continue this process just as in Euclidean algorithm, and it ends by the Well-Ordering Principle to define \(\gcd(a,b)\). In this case \(\pm 1\) and \(\pm i\) are all possible stopping points if \(a\) and \(b\) don't share a factor.
Further, if \(g\) and \(h\) are “relatively prime” Gaussian integers (\(\gcd(g,h)=\pm 1\) or \(\pm i\)), then there are other such integers \(x\) and \(y\) such that \(gx+hy=1\). So we have a Bezout identity as well to play with.
Computing with Gaussian integers this way is possible in Sage.
Crucially, I am skipping whether we actually have unique factorization in \(\mathbb{Z}[i]\); this is true, and used below in Fact 14.1.6, but properly belongs in an algebra course.
This allows 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. 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.
If \(p\equiv 1\text{ (mod }4)\), then \(p\) can be written as a sum of two squares. (This is Theorem 13.4.3.)