# Sum of Three Squares

### Problem

If an integer is a sum of squares of three positive integers, so is its square.

### Hint

Square the sum of squares and see if you can rearrange the terms.

### Solution

Let $n=p^{2}+q^{2}+r^{2}.$ Then

\( \begin{align} (p^{2}+q^{2}+r^{2})^{2} &= p^{4}+q^{4}+r^{4}+2p^{2}q^{2}+2p^{2}r^{2}+2q^{2}r^{2} \\ &= (p^{4}+q^{4}+r^{4}+2p^{2}q^{2}-2p^{2}r^{2}-2q^{2}r^{2})+4q^{2}r^{2}+4p^{2}r^{2} \\ &= (p^{2}+q^{2}-r^{2})^{2}+(2qr)^{2}+(2pr)^{2}. \end{align} \)

If $p^{2}+q^{2}-r^{2}\lt 0,$ take instead $r^{2}-p^{2}-q^{2},$ for which the same identity holds.

The identity we just proved is ingenious, but does it solve the problem? It leads to a solution, with one caveat.

To see what the problem might be, let $n=3^{2}+4^{2}+5^{2}.$ The formula then tells us that

$(3^{2}+4^{2}+5^{2})^{2}=(3^{2}+4^{2}-5^{2})^{2}+(2\cdot 3\cdot 5)^{2}+(2\cdot 4\cdot 5)^{2}.$

It is easy to check that this is indeed so: $50^{2}=30^{2}+40^{2}.$ The problem is of cause in that $50^{2}$ is represented as the sum of two, not the required three, squares. To eliminate the mishap, suffice it to assume that $r$ is the least of the three numbers so that $p^{2}+q^{2}-r^{2}$ will always come out positive.

### Extension

The problem shows that being a sum of three squares is a *square-hereditary* property: if a number possesses it, so does its square. Being the sum of two squares is not quite hereditary. The basic identity does hold:

$(p^{2}+q^{2})^{2}=(p^{2}-q^{2})^{2}+(2pq)^{2}.$

But it is of no use if $p=q.$ It does show, however, that the property of being "the sum of two distinct squares" might be hereditary. To establish that it is one only has to demonstrate that $p^{2}-q^{2}$ is never equal to $2pq,$ for integer $p$ and $q.$

Legendre and then Gauss proved that a positive integer can be expressed as the sum of three squares if and only if it is not of the form $4^{k}(8m + 7).$ A theorem by Lagrange (1770) settled what was known as *Bachet's conjecture*: every positive integer is the sum of four integer squares, but some may be $0.$ For example, $3=1^{2}+1^{2}+1^{2}+0^{2}.$ Still, the original problem admits an extension: if an integer is a sum of squares of $n$ positive integers, so is its square. We just generalize the identity for $n\gt 3:$

$\displaystyle (\sum_{k=1}^{n}p_{k}^{2})^{2}=(\sum_{k=1}^{n-1}p_{k}^{2}-p_{n}^{2})^{2}+\sum_{k=1}^{n-1}(2p_{k}p_{n})^{2}.$

### Acknowledgment

This is problem #2 from the 1993 Moscow Mathematical Olympiad for grade 8.

### References

- R. Fedorov et al,
*Moscow Mathematical Olympiads*, 1993-1999, MSRI/AMS, 2011

|Contact| |Front page| |Contents| |Algebra|

Copyright © 1996-2018 Alexander Bogomolny64979524 |