A few questions on the Gaussian integers

I think all four of your questions can be answered by looking at the following question:

Which prime numbers $p$ can be written as a sum of two squares?

i.e. when do there exist integers $a,b$ such that $$p = a^2+b^2.$$

This is certainly a natural, number theoretic question to ask. And the answer relies heavily on the Gaussian integers. Indeed, if $p$ can be expressed in the above form, then, as an element of $\mathbb Z[i]$, $$p=(a+bi)(a-bi),$$ so we can rephrase our question as follows:

For which prime numbers $p\in\mathbb Z$ does $p$ split as a product of two elements in $\mathbb Z[i]$?

It turns out that the answer to your questions $3$ and $4$ is yes:

  • An element $P\in \mathbb Z[i]$ is prime if whenever $x,y\in\mathbb Z[i]$ and $P\mid xy$, then $P\mid x$ or $P\mid y$.
  • It turns out that this condition is equivalent to saying that whenever $P=xy$, then one of $x$ or $y$ is a unit - i.e. $\pm1,\pm i$.
  • It also turns out that $\mathbb Z[i]$ is a unique factorisation domain - i.e. every element can be expressed uniquely as a product of primes (up to ordering and multiplication by units).

In particular, we can rephrase our question once more:

For which prime numbers $p\in \mathbb Z$ is $p$ no longer prime in $\mathbb Z[i]$?

It turns out that this is a question we can answer using the arithmetic of $\mathbb Z[i]$. It is possible (but not easy) to show that $$p\text{ is no longer prime in }\mathbb Z[i]\iff X^2+1\text{ is reducible modulo }p.$$ Note that $X^2+1$ is the minimal polynomial of $i$. Using facts from elementary number theory, $-1$ is a square mod $p$ if and only if $p=2$ or $p\equiv 1 \pmod 4$. This gives an answer to our question.

However, the story doesn't stop here. Let's say instead, we wanted to know which prime numbers $p$ can be written in the form $$p=a^2+5b^2?$$

If we were to play the same game as before, we might want to consider the ring $\mathbb Z[\sqrt{-5}]$. However, in this setting we have a problem: we no longer have unique factorisation, since, for example, $$6 = (1+\sqrt{-5})(1-\sqrt{-5})=2\cdot 3.$$ It is problems like this which the field of algebraic number theory comes to answer.


$1$ It can be viewed as a lattice in the $xy$-plane.

$2$ Addition and multiplication is like in $\mathbb C$

$3$ Yes, $1+i$ , for example. The definition is analogue to the usual primes. A Gaussian number is prime if it cannot be written as a product of two Gaussian numbers, both of which are neither $\pm1$ nor $\pm i$.

$4$ Yes, prime factorization is unique.

Addition : $$(a+bi) + (c+di) = (a+c) + (b+d)i$$

Multiplication : $$(a+bi)\cdot (c+di)=(ac-bd) + (ad+bc)i$$

Units : $1,i,-1,-i$

If $a^2+b^2$ is prime (in $\mathbb N$) , then $a+bi$ is prime as well. The converse is not necessarily true.


At the time I posted my comment, I couldn't give a fleshed out answer. In the interest of brevity, I assumed a lot of prior knowledge, some of which I learned long ago, some of which I learned just in the past year or so. At the other extreme, an entire book could be written to answer your $4$-part question. I will now give an answer that is longer than the previous ones, but still well short of a full length book.

It is important to understand how the familiar integers fit into the larger domain of algebraic integers. The positive integers $1, 2, 3, \ldots$, the negative integers $-1, -2, -3, \ldots$ and $0$ make up the set of familiar integers which we call $\mathbb{Z}$ for short. If $a, b \in \mathbb{Z}$, $b \neq 0$ and $$r = \frac{a}{b},$$ then $r$ is a rational number. We call the set of all such rational numbers $\mathbb{Q}$ for short.

If $x$ is a positive integer, then it is a solution to the equation $x - N = 0$, where $N$ is also a positive integer. And if $x$ is a negative integer, then it is a solution to the equation $x + N = 0$, where $N$ is a positive integer. These are perfectly obvious and boring facts, but it's necessary to go over them in order to explain that the positive and negative integers are algebraic integers of degree $1$.

Now consider the number $x = 2 + i$. This is clearly not one of our familiar integers of $\mathbb{Z}$, but it is an algebraic integer, since it is a solution to the equation $x^2 - 4x + 5 = 0$. It is an algebraic integer of degree $2$ because the $x^2$ part of it has an implied coefficient of $1$, and $4$ and $5$ are both integers.

In fact, if $a, b \in \mathbb{Z}$, then $x = a + bi$ is an algebraic integer, as it satisfies the equation $x^2 - 2ax + (a^2 + b^2) = 0$.

This is not necessarily the case if $a$ and $b$ are both rational but one or both of them are not integers. For example, if $$x = \frac{1}{2} + \frac{i}{2},$$ we don't have an algebraic integer, since the relevant equation is $2x^2 - 2x + 1$, in which the leading coefficient (the one attached to $x^2$) is not $1$, but $2$. This example would work out differently if we had $\sqrt{-3}$ or $\sqrt{-7}$ or $\sqrt{-11}$, etc., instead of $i$.

Hopefully this is all the necessary background information to explain my first point, that if $a, b \in \mathbb{Z}$, then $a + bi$ is an algebraic integer, but if either $a$ or $b$ or both is any real number other than an integer, then $a + bi$ is not algebraic integer. If you care about the set of all algebraic integers of the form $a + b \theta$ where $\theta$ is some algebraic number like $i$, then you care about the Gaussian integers.

Arithmetic in $\mathbb{Z}[i]$ is not that different than the algebraic arithmetic you were taught before you even knew about imaginary numbers. To add up two Gaussian integers $a + bi$ and $c + di$, you just have to line up the real parts, add them up, line up the imaginary parts, add them up, and there you have it. Thus $(a + bi) + (c + di) = (a + c) + (b + d)i$.

For multiplication you just need to remember the mnemonic FOIL (First, Outer, Inner, Last). Thus $$(a + bi)(c + di) = ac + adi + bci + bdi^2.$$ But since, as you already know, $i^2 = -1$, $bdi^2 = -bd$ and therefore $$(a + bi)(c + di) = (ac - bd) + (ad + bc)i.$$

To answer the third and fourth points, let's backtrack to $\mathbb{Z}$. Factorize the integer $-10$. Valid answers include $(-1) \times 2 \times 5$ and $-2 \times 5$ and $2 \times -5$. These are not distinct because the only distinction is multiplication by units ($-1$ is one of the units of $\mathbb{Z}$, and $1$ is the other one). Nor do we care about order: $-5 \times 2$ is just a different ordering of $2 \times -5$. If $p$ is a positive prime, then is divisible only by $-p$, the two units, and itself.

In $\mathbb{Z}[i]$, the units, "clockwise," are $i, 1, -i, -1$. The way that you know whether an algebraic integer of degree $2$ is a unit is if in the equation $x^2 - 2Tx + N$ we have $|N| = 1$. $N$ will depend on $\theta$, but since here $\theta = i$, we have $N = a^2 + b^2$.

A number like $2 + i$ is divisible only by the units of $\mathbb{Z}[i]$, and by itself multiplied by the units, but by no other numbers of $\mathbb{Z}[i]$. This means that $2 + i$ is prime (or at least irreducible, though in this domain the distinction is not as relevant as in say, $\mathbb{Z}[\sqrt{-5}]$. So there are primes in $\mathbb{Z}[i]$.

Do they factor uniquely? Yes, they do. I might come back later and elaborate further on this point, giving a proof, or at least a link to a proof. For now, before I have to log off, I will just remind you to be aware of units. Hence $$5 = (2 - i)(2 + i) = (1 - 2i)(1 + 2i)$$ does not present two distinct factorizations. For instance, calculate $(2 - i) \times i$.