The best-known sum of two squares is the sum of the squared legs of a right triangle.
Which integers can be represented as a sum of two squares? This is a classical question in number theory. In the seventeenth century, Pierre de Fermat formulated an important special result: every prime of the form 4k+1 is a sum of two squares.
A remarkable algebraic identity helps us investigate such sums and has many other mathematical uses. A product of two sums of squares can itself be written as a sum of squares. Two formulas give such a representation, and their results can coincide:
(a^2+b^2)(c^2+d^2)
=(ac-bd)^2+(ad+bc)^2
=(ac+bd)^2+(ad-bc)^2.
Example
(1^2+2^2)(3^2+4^2)=125=5^2+10^2=11^2+2^2.
This is called the Brahmagupta–Fibonacci identity, or Diophantus’s identity. Diophantus uses a numerical case in Arithmetica, III.19 (T. Heath’s translation, pp. 166–167). Brahmagupta gives a more general composition rule in the Brāhmasphuṭasiddhānta (628, verses 18.64–65). In modern notation, the sum-of-squares identity is the case with coefficient −1. Fibonacci uses both formulas in Proposition 6 of his Book of Squares (Liber quadratorum, 1225, B. Boncompagni’s edition, vol. II, pp. 257–260).
Try representing the following product of sums of squares:
(5^2+6^2)(7^2+8^2).
Notes
How does the identity arise in complex-number theory? Let a+bi and c+di be complex numbers. Then the Brahmagupta–Fibonacci identity is equivalent to the familiar multiplicative property of the complex modulus:
\lvert a+bi\rvert\lvert c+di\rvert=\lvert(a+bi)(c+di)\rvert.
Indeed, squaring both sides gives:
(a^2+b^2)(c^2+d^2)=(ac-bd)^2+(ad+bc)^2.
Here is another application of the Brahmagupta–Fibonacci identity. Fermat’s remarkable “Christmas theorem” states that every prime of the form 4k+1 can be represented as a sum of two squares.
Fermat stated the theorem in a letter to Marin Mersenne dated 25 December 1640 (Œuvres de Fermat, vol. II, letter XLV, p. 213). Many proofs have appeared since.
