15

If a prime can be expressed as sum of two squares, then prove that the representation is unique.

My attempt:
If $a^2+b^2=p$, then it is obvious that $a,b$ of different parity.
Now, I assume the contraposition that the representation is not unique, $p=a^2+b^2=c^2+d^2$. Again, $c,d$ are of different parity.

Now, let $b,d$ be even and $a,c$ be odd.

So, $a^2+b^2=c^2+d^2 \implies a^2-c^2=d^2-b^2 \implies (a+c)(a-c)=(d-b)(d+b)$.

I cannot proceed any further. Please help.

Hawk
  • 6,540
  • 1
    Nitpick corner case: $2 = 1^2 + 1^2$, so not necessarily of different parity. This would most likely be taken care of in a different case. :) – apnorton Mar 20 '14 at 12:02
  • @anorton That is definitely something I didn't think about...thanks for identification – Hawk Mar 20 '14 at 12:02

5 Answers5

18

The slickest way is via a little Algebraic Number Theory. If $p=a^2+b^2=c^2+d^2$ then $$p=(a+bi)(a-bi)=(c+di)(c-di)$$ Now ${\bf Z}[i]$ is a unique factorization domain, so these two factorizations of $p$ show that $a+bi$ can't be a prime in ${\bf Z}[i]$. We must have a non-trivial factorization $a+bi=(s+ti)(u+vi)$, whence $a-bi=(s-ti)(u-vi)$, and then $$p=(s^2+t^2)(u^2+v^2)$$ contradicting primality of $p$.

There are ways to answer your question without these advanced concepts, but I can never remember how it's done. I'm sure someone else will.

Gerry Myerson
  • 179,216
  • Thanks for the approach...I will try to do something with this. – Hawk Mar 20 '14 at 12:00
  • How do you deduce that $a+bi$ is not prime from the UFD property of $\mathbb{Z}[i]$? – user557 Sep 18 '16 at 15:59
  • 1
    @Cary, maybe it would be better to say that $a+bi$ and $c+di$ can't both be prime (in ${\bf Z}[i]$), since that would give us two different prime factorizations of $p$. Then without loss of generality we may assume $a+bi$ is not prime. – Gerry Myerson Sep 18 '16 at 22:59
  • @GerryMyerson: if $p$ is an ordinary prime, then $p$ is either a Gauss prime or the product of a Gauss prime and its conjugate. Clearly, we are in the latter case. Can't we just say that if $p=(a+bi)(a-bi)=(c+di)(c-di)$ are two prime factorizations, then $a+bi=u(c+di)$ or $a+bi=u(c-di)$ for $u$ a unit. In either case, we have $(a,b)=(\pm c, \pm d)$ or $(a,b) = (\pm d, \pm c)$, which implies $a^2+b^2=c^2+d^2$? – user557 Sep 19 '16 at 07:08
  • @Cary, I was trying to do it using just the UFD property, and not the result about how rational primes factor in the Gaussian integers. – Gerry Myerson Sep 19 '16 at 07:13
  • @GerryMyerson: sorry, I'm just trying understand your proof, and as far as I understand, the fact that I mentioned in the last comment implies that an ordinary prime $p$ cannot be written as the product of three Gaussian primes. However you represented $p$ as a product of at least 3 Gaussian primes. – user557 Sep 19 '16 at 07:22
  • @Cary, yes, under the assumption that $p$ has two distinct representations as a sum of two squares. Of course, that assumption proves to be false, so it turns out that $p$ is not a product of three (or more) Gaussian primes. – Gerry Myerson Sep 19 '16 at 07:25
10

Here's an answer without Algebraic Number Theory. I found it in Shanks, Solved and Unsolved Problems in Number Theory.

Assume $$p=a^2+b^2=c^2+d^2\tag1$$ with all variables positive integers. Then $$p^2=(a^2+b^2)(c^2+d^2)=a^2c^2+a^2d^2+b^2c^2+b^2d^2$$ and you can verify by just multiplying everything out that $$p^2=(ac+bd)^2+(ad-bc)^2\tag2$$ and $$p^2=(ac-bd)^2+(ad+bc)^2\tag3$$ By (1), we have $$(p-a^2)d^2=(p-c^2)b^2$$ which implies $$p(d^2-b^2)=(ad-bc)(ad+bc)\tag4$$ From (4), $p$ divides $ad-bc$, or $p$ divides $ad+bc$. If $p$ divides $ad-bc$, then from (2) we get $ad-bc=0$, so $d^2-b^2=0$, so $b=d$. If $p$ divides $ad+bc$, then from (3) we get $ac=bd$. Now $a$ and $b$ are relatively prime, so $a$ divides $d$, and $b$ divides $c$. Then by (1) we have $a=d$, and we have proved that the two representations of $p$ are the same.

This is probably something like what @Konstantinos was getting at in his answer.

Gerry Myerson
  • 179,216
  • 1
    Just noting that $(a^2+b^2)(c^2+d^2)=(ac+bd)^2+(ad-bc)^2=(ac-bd)^2+(ad+bc)^2$ states that if a number is the product of two sums of squares,then the number can also be written as the sum of two squares.This is the sum of squares identity of Diophantus. – rah4927 Mar 21 '14 at 09:11
0

The problem is trivialized if you are given that $x^2+y^2=n$ has $r_2(n)=4\sum_{d|n} \sin(\pi d/2) $ solutions in the integers.

The number of ways $r_2(p)=4\sum_{d|p} \sin(\frac{\pi d}{2})=4(1+\sin(\pi p/2))$.

If $\sin(\pi p /2)=1$ then there are 8 solution in the integers. Namely, $(\pm a,\pm b)$ and $(\pm b, \pm a)$ satisfy $x^2+y^2=p$ where $a\neq b$. There is another way one might imagine $8$ solutions: $(0,\pm a),(\pm a,0)$ and $(\pm b,\pm b)$ but this cannot happen because it would mean that $p$ is a perfect square and therefore not prime.

If $\sin(\pi p /2)=-1$ then we cannot write $p$ as the sum of squares.

$If \sin(\pi p /2)=0$ then $p=2$.

Mason
  • 3,792
0

This is essentially the same as Gerry Myerson's proof but employing known properties of Gaussian primes:

Suppose $p=a^2+b^2=c^2+d^2$ for some integers $a,b,c,d>0$. Assume, additionally, that $a$ and $c$ are odd whereas $b$ and $d$ are even. We must show $a=c$ and $b=d$.

We know $$p=(a+bi)(a-bi)=(c+di)(c-di),$$ where all the Gaussian integers appearing are primes. Thus, by unique factorization in $\mathbb{Z}[i]$, \begin{equation}a+bi=u\begin{cases}c+di\\ c-di\end{cases},\tag{1}\end{equation} where $u$ is a unit of $\mathbb{Z}[i]$, that is, $u\in \{1,-1,i,-i\}$. Finally, we divide into the four possible cases for $u$:

  1. $\color{blue}{u=1}$. Forces $a+bi=c+di$, and the result follows.

  2. $\color{blue}{u=-1}$. This case is impossible because RHS in $(1)$ would have negative real part, while LHS has positive real part ($a>0$).

  3. $\color{blue}{u=i}$. Then $a+bi=d+ci$ by positiveness, but this contradicts the chosen parity of $a,b,c,d$.

  4. $\color{blue}{u=-i}$. Impossible because RHS in $(1)$ would have negative imaginary part.

-1

If $p=a^2+b^2=c^2+d^2$ then $$p=\frac{(ac+bd)(ac-bd)}{(a+d)(a-d)}$$