(Non?)-uniqueness of sums of squares

Solution 1:

There are many counterexamples, of which the smallest is $$5^2 + 5^2 = 7^2 + 1^2.$$

(I earlier stated that $25$ was the smallest counterexample, since $3^2+4^2 = 0^2+5^2$, but in your terminology, it has a potency of 1, not 2, so it is not a counterexample.)

Brahmagupta's identity shows that if $x$ and $y$ are each expressible as a sum of two squares, then $xy$ is (almost always) expressible as a sum of two squares in more than one way, because $$\begin{align} (a^2 + b^2)(c^2 + d^2) & = (ac-bd)^2 + (ad+bc)^2 \\ &= (ac+bd)^2 + (ad-bc)^2 \end{align}$$

The counterexample of $50$ I gave above illustrates this, since $50 = 5\cdot 10 = (1^2+2^2)(1^2+3^2)$; you can use the Brahmagupta identity to find many similar counterexamples such as $(1^2+2^2)\cdot (2^2+3^2) = 1^2+8^2 = 4^2+7^2, $ etc. By repeating this process, one can find numbers like $50\cdot 65 = 1^2 + 57^2 = 15^2+55^2 = 21^2 + 53^2 = 35^2 + 45^2 $ that have a potency of $2$ and are expressible as $a^2+b^2$ in arbitrarily many ways.

As André Nicolas points out, Lagrange proved that every positive integer has a potency of at most 4; the example of $7$ shows that this bound is attained. The number 28 is the smallest number with a potency of 4 that can be expressed as a sum of four positive squares in multiple ways:

$$\begin{align} 28 & = 5^2 + 1^2 + 1^2 + 1^2 \\ & = 3^2 + 3^2 + 3^2 + 1^2 \\ & = 4^2 + 2^2 + 2^2 + 2^2 \end{align}$$

Other small examples include $31, 39, 47, 55, 60, $ and $63$, which is a sum of four positive squares in four ways.

Solution 2:

To expand on some of the other comments:

Any number can be written as a sum of $4$ squares. In fact, the number of ways to write the number $n$ as a sum of $4$ squares (more precisely, the number of tuples $(x,y,z,w)\in \mathbb{Z}^4$ with $x^2 + y^2 + z^2 + w^2 = n$) is $$8\sum_{d\mid n,\, 4\not\mid d}d$$ (I don't know of a nice reference for this fact, nor a proof that does not use modular forms unfortunately).

Now note that these numbers tend to be much larger than they would be if all such ways were rearrangements of each other (the above sum tends to grow with $n$, and there are infinitely many numbers which are not the sum of $3$ squares).