Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From Ireland,Rosen's Number Theory book, ex.8.12.

Let $p\equiv1\mod{4}$, then we can write $p=a^{2}+b^{2}$, where $a,b\in\mathbb{Z}$. Now, let $a$ be odd and $b$ be even and $a,b>0$. How can we show that $a$ and $b$ are uniquely determined? The hint says to use the fact that $\mathbb{Z[i]}$ is a UFD and $p=a^{2}+b^{2}\implies a+bi$ is prime in $\mathbb{Z[i]}$

share|cite|improve this question
Assume they aren't unique (up to sign change), and show that $p$ has two nonequivalent factorizations in $\mathbb{Z}[i]$ (impossible because it's a UFD). – anon Feb 23 '12 at 5:32
Remember, also, that the units in $\mathbf Z[i]$ are just $\{\pm1, \pm i\}$. – Dylan Moreland Feb 23 '12 at 5:35
up vote 4 down vote accepted

We have a natural norm $N$ on $\mathbb{Z}[i]$ given by $N(a+bi) = a^2 + b^2$, for all $a+bi \in \mathbb{Z}[x]$. One can show that w.r.t. this norm, $\mathbb{Z}[i]$ is a Euclidean domain, hence a PID, hence a UFD.

Let $p \in \mathbb{N}$ be a prime such that $p = a^2 + b^2$ for some $a,b \in \mathbb{Z}$. Now suppose $\exists c,d \in \mathbb{Z}$ such that $p = c^2 + d^2$. Then in $\mathbb{Z}[i]$ we have $N(a+bi) = p = N(c+di)$.

Suppose $a+bi = (e+fi)(e' +f'i)$ in $\mathbb{Z}[i]$. Then taking norms (our norm $N$ is multiplicative) we have $a^2+b^2 = p = (e^2+f^2)(e'^2 + f'^2)$, and so without loss of generality one can say that $e^2 + f^2 = p$. Then $e'^2 + f'^2 = 1$, and the only elements with norm 1 in $\mathbb{Z}[i]$ are $\{1,-1,i,-i\}$, which are also units. Thus, $e'+f'i$ is a unit in $\mathbb{Z}[i]$, which shows that $a+bi$ is irreducible (actually one needs to use the fact that every unit of $\mathbb{Z}[i]$ has norm 1 to conclude that $a+bi$ is not a unit in the first place, but this is easy). Since, $N(c+bi)=p$, by a similar argument $c+di$ is irreducible in $\mathbb{Z}[i]$.

Then in $Z[i]$ we have $(a+bi)(a-bi) = p = (c+di)(c-di)$ is a factorization of $p$ into irreducibles. By unique factorization, say without loss of generality that $c+di = unit \times a+bi$ (here the unit is a unit of $\mathbb{Z}[i]$). Then you are basically done (why?).

share|cite|improve this answer
Oops, Arturo must have posted an answer while I was typing. – Rankeya Feb 23 '12 at 5:55
Welcome to the club. – Gerry Myerson Feb 23 '12 at 6:25

If $p=a^2+b^2$, then $a+bi$ is a prime in $\mathbb{Z}[i]$. If we also have $p=c^2+d^2 = (c+id)(c-id)$, then $a+bi$ divides $(c+id)(c-id)$, hence $a+ib$ divides either $c+id$ or $c-id$. But, symmetrically, $c+id$ and $c-id$ are both prime, hence irreducible, so their only divisors are units and associates. Since $a+ib$ is not a unit, then it is an associate of, say, $c+id$. Hence either $a+ib = c+id$, $a+ib = -(c+id)$, $a+ib = i(c+id)$, or $a+ib = -i(c+id)$. Either way, $\{c^2,d^2\}=\{a^2,b^2\}$, so the two expressions of $p$ as sums of squares are actually identical (up to order of the summands).

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.