# Topics in Algebra, Chapter 3.8

###### 2013-01-28

This page covers section 3.8 (“A Particular Euclidean Ring”).

### Topics covered: 3.8

• $\mathbb{Z}\left[i\right]$, the Gaussian integers, is the set of complex numbers $a+bi$ where $a,b\in \mathbb{Z}$. The proof of each result in this chapter is very clever.

• Theorem 3.8.1: $\mathbb{Z}\left[i\right]$ is a Euclidean ring. The distance function is $d\left(a+bi\right)={a}^{2}+{b}^{2}$.

• Lemma 3.8.1: Let $c,p\in \mathbb{Z}$ with $p$ prime and $\left(c,p\right)=1$ such that there exist $x,y\in \mathbb{Z}$ with ${x}^{2}+{y}^{2}=cp$. Then there exist integers $a,b\in \mathbb{Z}$ such that $p={a}^{2}+{b}^{2}$.

• Lemma 3.8.2: If $p\in \mathbb{Z}$ is a prime of the form $4n+1$, $n$ an integer, then there exists $x\in \mathbb{Z}$ such that ${x}^{2}\equiv -1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p$.

• Theorem 3.8.2 (Fermat): If $p\in \mathbb{Z}$ is a prime of the form $4n+1$, $n$ an integer, then there exist $a,b\in \mathbb{Z}$ such that $p={a}^{2}+{b}^{2}$.

The problems below are paraphrased from/inspired by those given in Topics in Algebra by Herstein. The solutions are my own unless otherwise noted. I will generally try, in my solutions, to stick to the development in the text. This means that problems will not be solved using ideas and theorems presented further on in the book.

### Herstein 3.8.1: Find all the units in $\mathbb{Z}\left[i\right]$.

Suppose $a+bi\in \mathbb{Z}\left[i\right]$ is a unit, so there exists $r+si\in \mathbb{Z}\left[i\right]$ with $1=\left(a+bi\right)\left(r+si\right)\mathrm{.}$

We have that $1=d\left(1\right)=d\left(a+bi\right)d\left(r+si\right)$ and $d$ maps into the non-negative integers. This forces the norm of a unit to be $1$. Then we have $d\left(a+bi\right)={a}^{2}+{b}^{2}=1$, and we easily enumerate the solutions as $±1,±i$. These are the four units of $\mathbb{Z}\left[i\right]$.

### Herstein 3.8.2: Prove that if $a+bi\in \mathbb{Z}\left[i\right]$ is non-zero and is not a unit, then ${a}^{2}+{b}^{2}>1$.

Lemma 3.7.3, states that, in a Euclidean ring, multiplication by a non-zero unit always increases the norm of an element. That is, with $r,s$ elements of Euclidean ring $R$ and $s\mathrm{\ne }0$, we have that $d\left(r\right). In particular, here we may say that $1=d\left(1\right)

### (b) $11+7i$ and $18-i$.

We remark that the greatest common divisor is only unique up to association (multiplication by unit). As proven in problem 3.7.4, the prescription given there will produce greatest common divisors. Still, how does one pick out the quotients ${q}_{i}$?

(a) We will try to divide $4-3i$ into $3+4i$. We need to find a quotient that gives us a remainder small enough to be acceptable in the algorithm. That is, we seek ${q}_{0}$ such that $3+4i={q}_{0}\left(4-3i\right)+{r}_{1}$ with $d\left({r}_{1}\right). Drawing the two points on the complex plane gives a hint. $4-3i$ can be brought near to $3+4i$ by a rotation of $\pi \mathrm{/}2$ about the origin, which is equivalent to a multiplication by $i$. Then we take ${q}_{0}=i$.

But, oops! $i\left(4-3i\right)=3+4i$ so we are already done. Their greatest common divisor is $4-3i$ (or $3+4i$, which we have just seen is its associate).

(b) This time we may have a less trivial situation. Again drawing the picture on the complex plane we see that $18-i$ may be brought somewhat near to $11+7i$ if it is rotated by $\pi \mathrm{/}2$, or equivalently, multiplied by $i$. A rotation by something like $\pi \mathrm{/}6$ might be even better, but our choice should be fine. Thus we take ${q}_{0}=i$ and write $11+7i=i\left(18-i\right)+10-11i$

so that ${r}_{1}=10-11i$. This is okay because $d\left({r}_{1}\right)=221<325=d\left(18-i\right)$. Drawing out the points $18-i$ and $10-11i$, we really think a rotation by $\pi \mathrm{/}4$ of $10-11i$ would be helpful in this case. Of course, we can’t multiply by ${e}^{i\pi \mathrm{/}4}$ because there is nothing like $\sqrt{2}$ in our ring. Taking the next best thing, we will try ${q}_{1}=1+i$. Thus, we write $18-i=\left(1+i\right)\left(10-11i\right)-3.$

Then ${r}_{2}=-3$ and $d\left({r}_{2}\right)=9<221=d\left({r}_{1}\right)$, so we have improved considerably.

Now a glance at $10-11i={q}_{2}\left(-3\right)+{r}_{3}$ suggests ${q}_{2}=-3+4i$ and therefore ${r}_{3}=1+i$. We have $d\left({r}_{3}\right)=2<9=d\left({r}_{2}\right)$. Continuing, we can write $-3=\left(1+i\right)\left(i-1\right)-1,$

which puts ${q}_{3}=i-1$ and ${r}_{4}=-1$. At last, we are done, because ${r}_{3}=-\left(1+i\right){r}_{4}$. Therefore the greatest common divisor of $11+7i$ and $18-i$ is $-1$, or equivalently $1$: they are relatively prime. We can exhibit two Gaussian integers $x,y$ such that $\left(11+7i\right)x+\left(18-i\right)y=1$. They may be found by tracing backwards all of the steps of the algorithm, whereupon we find ${r}_{4}=\left(1+{q}_{0}{q}_{1}+{q}_{0}{q}_{3}+{q}_{2}{q}_{3}+{q}_{0}{q}_{1}{q}_{2}{q}_{3}\right)\left(18-i\right)-\left({q}_{1}+{q}_{3}+{q}_{1}{q}_{2}{q}_{3}\right)\left(11+7i\right)\mathrm{.}$

Plugging in values, $\left(-6+i\right)\cdot \left(18-i\right)+\left(6-6i\right)\cdot \left(11+7i\right)=1.$

### Herstein 3.8.4: Let $p$ be a prime integer of the form $4k+3$ with $k\in \mathbb{Z}$. Prove that there can not be an $x\in \mathbb{Z}$ with ${x}^{2}\equiv -1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p$.

Suppose that such an $x$ existed, with ${x}^{2}+1=cp$ for some $c\in \mathbb{Z}$. Then we fall into the case of Lemma 3.8.1 which says that $p$ may be expressed as a sum of two squares, $p={a}^{2}+{b}^{2}$. Looking at this equation modulo $4$, we find that it has no solutions: $p\equiv 3\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$ while squares modulo $4$ can be only $0$ or $1$ so that ${a}^{2}+{b}^{2}$ can only take the values $\left\{0,1,2\right\}$. This contradiction forces us to conclude that no such $x$ may exist.

It is easy to see that the only quadratic residues modulo $4$ are $0$ and $1$. If $k\in \mathbb{Z}$ then $\left(2k{\right)}^{2}=4{k}^{2}\equiv 0\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$, so even numbers will always square to zero modulo $4$. On the other hand, $\left(2k+1{\right)}^{2}=4{k}^{2}+4k+1\equiv 1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$, so odd numbers will always square to $1$ modulo $4$.

Alternate solution: In light of problem 3.8.5, which suggests that my method (invoking Lemma 3.8.1) is too heavy-handed, here is another solution. Fermat’s little theorem says that such an $x$ would have ${x}^{p-1}\equiv 1\phantom{\rule{0ex}{0ex}}\phantom{\rule{1em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p,$

where we have used the fact that $p\mid x$. Now, this may be rewritten as ${x}^{4k+2}\equiv 1\phantom{\rule{0ex}{0ex}}\phantom{\rule{1em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p\mathrm{.}$

On the other hand, from ${x}^{2}\equiv -1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p$, we have that ${x}^{4k+2}\equiv {x}^{2\left(2k+1\right)}\equiv \left(-1{\right)}^{2k+1}\equiv -1\phantom{\rule{0ex}{0ex}}\phantom{\rule{1em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p,$

which is a contradiction. Hence no such $x$ exists.

### Herstein 3.8.5: Let $p$ be a prime integer of the form $4k+3$ with $k\in \mathbb{Z}$. Prove that there do not exist $a,b\in \mathbb{Z}$ with $p={a}^{2}+{b}^{2}$.

This was proven in the course of solving problem 3.8.4, where we consider the equation $p={a}^{2}+{b}^{2}$ modulo $4$.

### Herstein 3.8.6: Prove that there are infinitely many primes of the form $4k+3$ with $k\in \mathbb{Z}$.

First let us recall Euclid’s proof that there are infinitely many prime numbers. Suppose to the contrary that there was only a finite set of prime numbers, $\left\{{p}_{1},\dots ,{p}_{N}\right\}$. Then construct $P={p}_{1}\cdots {p}_{N}$ and $Q=P+1$. Because any integer can be factored into primes, we know that $Q$ has some prime divisor $p$. If $p$ were to belong to the supposed set, however, then we would have $p\mid Q$ and $p\mid P$, so that $p\mid \left(Q-P\right)=1$ which is not possible. Therefore $Q$ necessarily has a prime divisor which does not belong to our list, so the list is incomplete whenever it is finite. Note that $Q$ itself is not necessarily a prime (though it sometimes is), but rather that its prime divisors are all “new” — none belonged to the old list. For instance, $2\cdot 3\cdots 11\cdot 13+1=59\cdot 509$.

Now we turn to the problem of primes of the form $4k+3$. It is natural to consider things like $Q=\left(4{k}_{1}+3\right)\cdots \left(4{k}_{N}+3\right)±1$

but quick numerical investigations show that these do not work. We would like to produce some $Q$ which has a “new” prime divisor of the form $4k+3$, and these do not necessarily. For instance, $3\cdot 7\cdot 11+1={2}^{3}\cdot 29$ and $29\equiv 1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$. Similarly, $3\cdot 7-1={2}^{2}\cdot 5$. Perhaps the plus and minus $1$ cases can switch off, each providing a new prime in its turn… but no, $3\cdot 7\cdot 11\cdot 19\cdot 23+1={2}^{2}\cdot 25237$

(with $25237\equiv 1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$) while $3\cdot 7\cdot 11\cdot 19\cdot 23-1=2\cdot 17\cdot 2969$

(with $2969\equiv 1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$).

Sticking to this general Euclidean train of logic, we might hope that there is some sort of $Q$ that is useful in this argument. We want a $Q$ which grants us a prime divisor of the form $4k+3$, so somehow it must be impossible for all the prime divisors be of the form $4k+1$ (if we can avoid divisibility by $2$, all the better). Were it to be the case that all the prime divisors of $Q$ had the form $4k+1$, then $Q=\left(4{k}_{1}+1\right)\cdots \left(4{k}_{M}+1\right)=4\left(\dots \right)+1,$

i.e. $Q$ must be of the form $4K+1$. We can choose a form for $Q$ which explicitly forbids this possibility. If we enumerate the, assumedly finite, set of $4k+3$ primes as $\left\{{p}_{1},\dots ,{p}_{N}\right\}$, with ${p}_{1}=3$, ${p}_{2}=7$, ${p}_{3}=11$, …, then we may try $Q=4{p}_{1}\cdots {p}_{N}+3.$

If we take $Q$ in this form, then it has two beneficial features: (1) $Q$ is odd, so $2\nmid Q$, and (2) $Q\equiv 3\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$, so not all prime divisors of $Q$ may be of the form $4k+1$.

Therefore $Q$ looks like what we need, but does it actually provide us with new $4k+3$ primes when we factor it? Well… no. $4{p}_{1}+3=3\cdot 5$, so it gives us nothing new there: it repeats $3$ from the list and $5$ is not of the $4k+3$ form. Will it happen in general that a prime divisor $Q$ will be repeated from the list? Suppose $p$ is a $4k+3$ prime which divides $Q$ but also belongs to the finite list. Then $p\mid \left(Q-4{p}_{1}\cdots {p}_{N}\right)=3,$

which means that this can only happen if the prime in question is $3$. Still, that is enough to destroy the argument, because we do not necessarily produce a new $4k+3$ prime. There is a way out, which is to just skip $3$ in the product of the known-prime set. In that case, we will never get $3\mid Q$ because if $Q=4{p}_{2}\cdots {p}_{N}+3,$

then a prime $p$ dividing $Q$ must also divide $Q-3=4{p}_{2}\cdots {p}_{N}$. We have omitted $3$ from the product, though, so $p$ cannot be $3$. This, therefore, is the desired form for $Q$.

Summing up: Suppose there are only finitely many primes of the form $4k+3$, and enumerate them as $\left\{{p}_{1},\dots ,{p}_{N}\right\}$ where ${p}_{1}=3$, ${p}_{2}=7$, ${p}_{3}=11$, and so on. Consider the quantity $Q=4{p}_{2}\cdots {p}_{N}+3,$

where we intentionally omit ${p}_{1}$ from the product. We see that $Q$ is odd, so that $2\nmid Q$ and all prime divisors of $Q$ must be of the form $4k+1$ or $4k+3$ for some integer $k$. It is impossible that all of the prime divisors of $Q$ be of the form $4k+1$, because their product would be $1$ modulo $4$, whereas $Q$ is clearly $3$ modulo $4$. Hence there exists a prime divisor $p\mid Q$ with $p\equiv 3\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$. Suppose that $p$ also belongs to the set $\left\{{p}_{1},\dots ,{p}_{N}\right\}$, then we must have $p\mid \left(Q-4{p}_{2}\cdots {p}_{N}\right)=3,$

i.e. $p=3$. This is impossible, because if $3\mid Q$, then $3\mid \left(Q-3\right)=4{p}_{2}\cdots {p}_{N}$ which we know to be false (we purposely omitted ${p}_{1}=3$ for just this purpose). Hence $p$ does not belong to the list of “known” $4k+3$ primes, so it is a new one and the finite list is incomplete. Therefore there are infinitely many primes of the form $4k+3$, $k\in \mathbb{Z}$.

### Herstein 3.8.7*: Prove that there are infinitely many primes of the form $4k+1$ with $k\in \mathbb{Z}$.

We have a couple of results from the chapter on primes of the form $4k+1$. For instance, we know from Lemma 3.8.2 that if $p$ is a prime of the form $4k+1$, then there exists $x\in \mathbb{Z}$ with ${x}^{2}\equiv -1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p$. On the other hand, in problem 3.8.4 we showed that this is not true for primes of the form $4k+3$. Of course, all odd primes fall into one of the two classes, so for $p>2$ prime, $p$ has the form $4k+1$ if and only if there is a solution $x$ to ${x}^{2}\equiv -1\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p$.

We would like to make use of the Euclidean approach again, somehow exploiting the property just described. One way to do this is to suppose there are only finitely many $4k+1$ primes, say $\left\{{p}_{1},\dots ,{p}_{N}\right\}$ with ${p}_{1}=5$, ${p}_{2}=13$, etc., and to construct $Q=\left({p}_{1}\cdots {p}_{N}{\right)}^{2}+1.$

We note immediately that $Q$ is even, so it will always have a factor of $2$ which is not of interest to us. Of course, $Q$ is larger than two, so it will also have odd prime divisors. Let $p$ be an odd prime divisor of $Q$. Working in the same way as before, we say that $p$ may not belong to the old list, because if it did then $p\mid \left(Q-\left({p}_{1}\cdots {p}_{N}{\right)}^{2}\right)=1,$

which is no good. Therefore $p$ is an odd prime which does not belong to the list. Moreover, we see that $x={p}_{1}\cdots {p}_{N}$ is an integer such that ${x}^{2}=Q-1\equiv -1\phantom{\rule{0ex}{0ex}}\phantom{\rule{1em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}p,$

so that $p$ must be of the form $4k+1$. Thus we have exhibited a new $4k+1$ prime and there must be infinitely many.

### Herstein 3.8.8*: Determine all of the prime elements in $\mathbb{Z}\left[i\right]$.

A prime element $p\in \mathbb{Z}\left[i\right]$ is one such that if $a,b\in \mathbb{Z}\left[i\right]$ satisfy $p=ab$, then one of $a$ or $b$ is a unit. We showed in problem 3.8.1 that the units of $\mathbb{Z}\left[i\right]$ are $±1$ and $±i$. We may restrict attention to the first quadrant of the complex plane (including the positive real axis), because Gaussian integers in the other quadrants are all associates of Gaussian integers in the restricted set.

First consider the elements of $\mathbb{Z}$. Of course, if $n$ is composite in $\mathbb{Z}$, then it is still composite in $\mathbb{Z}\left[i\right]$. Turning to prime integers, we have that $2=\left(1+i\right)\left(1-i\right),$

so $2$ is not prime in $\mathbb{Z}\left[i\right]$. Similarly, if $k\in \mathbb{Z}$ and $p=4k+1$ is a prime in $\mathbb{Z}$, then by Theorem 3.8.2 there exist $a,b\in \mathbb{Z}$ such that $p={a}^{2}+{b}^{2}$. Then we have $p=\left(a+bi\right)\left(a-bi\right)$ and so $4k+1$ primes are composite in $\mathbb{Z}\left[i\right]$. On the other hand, $4k+3$ primes are prime in $\mathbb{Z}\left[i\right]$: Suppose that $k\in \mathbb{Z}$ and $p=4k+3$ is a prime in $\mathbb{Z}$ but that it factors as $p=\left(a+bi\right)\left(c+di\right)$

in $\mathbb{Z}\left[i\right]$. Then, considering the norm of the equation, we have ${p}^{2}=\left({a}^{2}+{b}^{2}\right)\left({c}^{2}+{d}^{2}\right)$

which gives three possibilities for the value of ${a}^{2}+{b}^{2}$. If ${a}^{2}+{b}^{2}=1$, then $a+bi$ is a unit; if ${a}^{2}+{b}^{2}={p}^{2}$, then ${c}^{2}+{d}^{2}=1$ so $c+di$ is a unit. Otherwise ${a}^{2}+{b}^{2}=p$, but we know from problem 3.8.5 that this is impossible because $p\equiv 3\phantom{\rule{0ex}{0ex}}\phantom{\rule{0.6666666666666666em}{0ex}}\mathrm{m}\mathrm{o}\mathrm{d}\text{\hspace{0.17em}}\text{\hspace{0.17em}}4$. Therefore one of $a+bi$ or $c+di$ is a unit, so a $4k+3$ prime is again prime in the Gaussian integers. Of course, $-p$, $ip$ and $-ip$ are Gaussian primes as well.

Now we consider the primality of $a+bi$ with $a,b>0$. It’s not immediately clear what the condition should be, although it is pretty clear that primes of this type exist — for instance, $1+i$ is of such small norm that we can easily see it is prime. Consider a factorization $a+bi=\left(r+si\right)\left(t+ui\right)$ whose norm gives ${a}^{2}+{b}^{2}=\left({r}^{2}+{s}^{2}\right)\left({t}^{2}+{u}^{2}\right)\mathrm{.}$

One case jumping out at us here is that where ${a}^{2}+{b}^{2}$ is prime. If ${a}^{2}+{b}^{2}$ is prime, then one of the factors must be a unit because it will have a norm of $1$. In other words, if the norm of $a+bi$ is prime in $\mathbb{Z}$, then $a+bi$ is prime in $\mathbb{Z}\left[i\right]$ (we still require $a,b>0$). Playing around with Gaussian integers (and Mathematica’s handy ability to factor them and check their primality), one can easily be convinced that this condition is not only sufficient but also necessary.

The conjecture is then: if $a,b>0$, then $a+bi$ is prime in $\mathbb{Z}\left[i\right]$ if and only if ${a}^{2}+{b}^{2}$ is prime in $\mathbb{Z}$. Half of this result was proven in the preceding paragraph. We now seek to prove that if $a+bi$ is prime in $\mathbb{Z}\left[i\right]$, then ${a}^{2}+{b}^{2}$ is a prime integer. We have $\left(a+bi\right)\left(a-bi\right)={a}^{2}+{b}^{2}={p}_{1}\cdots {p}_{N},$

where we have factored ${a}^{2}+{b}^{2}$ into primes in $\mathbb{Z}$. By Lemma 3.7.6, there is a prime $p\in \left\{{p}_{1},\dots ,{p}_{N}\right\}$ with $\left(a+bi\right)\mid p$. Notice that we must be very careful here. It is tempting to say the opposite, that one of the $p$’s must divide $\left(a+bi\right)$, but this is not true because $p$ may not be prime in $\mathbb{Z}\left[i\right]$. Carrying on, we have that $\left(a+bi\right)\mid p$, so there are $x,y\in \mathbb{Z}$ with $\left(a+bi\right)\left(x+yi\right)=p\mathrm{.}$

Taking the complex conjugate, we also see that $\left(a-bi\right)\mid p$. Therefore ${a}^{2}+{b}^{2}=\left(a+bi\right)\left(a-bi\right)\mid {p}^{2}$

which forces ${a}^{2}+{b}^{2}=1$, $p$ or ${p}^{2}$. The condition $a,b>0$ forbids the first choice. If ${a}^{2}+{b}^{2}={p}^{2}$, then we can consider $p\cdot p=\left(a+bi\right)\left(x+yi\right)\left(a-bi\right)\left(x-yi\right)={p}^{2}\left({x}^{2}+{y}^{2}\right)$

which forces $x+yi$ to be a unit. In that case, $\left(a+bi\right)\left(x+yi\right)=p$ forces $a+bi$ to lie along an axis, contradicting the supposition that $a,b>0$. Therefore ${a}^{2}+{b}^{2}\mathrm{\ne }{p}^{2}$ and we are left with the conclusion that ${a}^{2}+{b}^{2}$ is a prime.

Summing up: We have restricted attention to the first quadrant and the positive real axis, all the while understanding that the results in that quadrant will be mirrored to the other three quadrants (because they are related to the first by multiplication by the units $i$, ${i}^{2}$, ${i}^{3}$). The general conditions resulting from the analysis may be stated:

The Gaussian integer $a+bi$ is prime if and only if

• $ab=0$ and $a+b$ is a $4k+3$ prime (i.e. a $4k+3$ prime along any axis), or
• $ab\mathrm{\ne }0$ and ${a}^{2}+{b}^{2}$ is prime in $\mathbb{Z}$ (so it can be $2$ or a $4k+1$ prime).

### Herstein 3.8.9*: Which positive integers can be written as a sum of two squares?

Let $a,x,y\in \mathbb{Z}$ be such that $a={x}^{2}+{y}^{2}$. We can then consider the Gaussian integer $x+yi$ which has norm equal to $a$. By Theorem 3.7.2 (Euclidean rings are unique factorization domains), we can factor $x+yi$ as a product of Gaussian primes $\left\{{\pi }_{i}\right\}$, $x+yi={\pi }_{1}\cdots {\pi }_{N}\mathrm{.}$

Now, having classified the primes in problem 3.8.8, we can say that each ${\pi }_{i}$ can have a norm equal to either $2$, a $4k+1$ prime, or to the square of a $4k+3$ prime. Therefore, the integer $a$ will be some product of twos, $4k+1$ primes and squares of $4k+3$ primes. Of course, $a$ always has a prime factorization, so the only true restriction here is that the $4k+3$ primes must come in as even powers. Now we have seen that any $a$ expressible as a sum of two squares can be written in this form, but we still would like to show that every such product gives rise to something like $a$.

Let $\left\{{p}_{1},\dots ,{p}_{M}\right\}$ be a collection of twos and $4k+1$ primes and let $\left\{{q}_{1},\dots ,{q}_{N}\right\}$ be a collection of $4k+3$ primes. The integer $A={p}_{1}\cdots {p}_{M}{q}_{1}^{2}\cdots {q}_{N}^{2}$

can easily be translated into the norm of a certain Gaussian integer: for each ${p}_{i}$, there exist ${r}_{i},{s}_{i}\in \mathbb{Z}$ with ${p}_{i}={r}_{i}^{2}+{s}_{i}^{2}$, so consider $z=\left({r}_{1}+i{s}_{1}\right)\cdots \left({r}_{M}+i{s}_{M}\right){q}_{1}\cdots {q}_{N}\mathrm{.}$

We have that the norm of $z$ is $A$, so that $A$ is expressible as the sum of two squares.

Therefore, the positive integers expressible as a sum of two squares are exactly those for which $4k+3$ primes come into the prime factorization with only even powers.