# Two Squares and Four Squares

Diophantus of Alexandria wrote a collection of books called Arithmetica in the 3rd century AD.  He noted that natural numbers of the form $$4n + 3$$ cannot be expressed as the sum of two square numbers.  He also seemed aware that all natural numbers can be expressed as the sum of four squares.

Fermat (1607 – 1665) owned a copy of a Latin translation (from Ancient Greek) of Arithmetica made by Bachet in 1621.

Fermat claimed that an odd prime, $$p$$, can be expressed as the sum of two integer squares, if and only if, $$p$$ has the form $$4n + 1$$.

$$p = n^2 + m^2,$$ iff,

$$p \equiv 1 \pmod 4$$

For example, $$5 = 2^2 + 1^2$$ and $$13 = 3^2 + 2^2$$.

He also made the claim that all natural numbers, $$n$$, can be expressed as the sum of four squares (as noted by Bachet).

Euler (1707 – 1783) gave the first proof of the sum of two squares in 1749; it is a proof by infinite descent which utilises an identity due to Diophantus.

The product of two numbers, each of which is the sum of two squares, is itself a sum of two squares :

$$(a^2 + b^2)(c^2 + d^2) = (ac + bd)^2 + (ad-bc)^2$$

For example,

$$65 = 5\cdot13 = (2^2 + 1^2)(3^2 + 2^2)\\ = (2\cdot3 + 1\cdot2)^2 + (2\cdot2-1\cdot3)^2\\ = (6 + 2)^2 + (4-3)^2 = 8^2 + 1^2$$

Fibonacci (1170 – 1240) had found another identity :

$$(a^2 + b^2)(c^2 + d^2) = (ac-bd)^2 + (ad +bc)^2$$

$$65 = 5\cdot13 = (2^2 + 1^2)(3^2 + 2^2)\\ = (2\cdot3-1\cdot2)^2 + (2\cdot2 + 1\cdot3)^2\\ =(6-2)^2 + (4 + 3)^2 = 4^2 + 7^2$$

Other proofs have since followed.

Theorem 1.  An odd prime can be represented as a sum of two squares, if and only if, $$p$$ has the form $$4n + 1$$.  Moreover, this representation is unique.

Euler made many efforts to prove the claim that every natural number is the sum of four squares but failed.  However, he did discover the following identity :

$$(a^2 + b^2 + c^2 + d^2)(e^2 + f^2 + g^2 + h^2)\\ = (ae + bf + cg + dh)^2\\ + (af-be-ch + dg)^2\\ + (ag + bh-ce-df)^2\\ + (ah-bg + cf-de)^2$$

The importance of this identity (as in the last one) is that it reduces a proof of showing that all natural numbers are the sums of four squares to a proof of showing that all primes can be written as the sums of four squares (descent).

For example,

$$7 = 2^2 + 1^2 + 1^2 + 1^2$$ and

$$11 = 3^2 + 1^2 + 1^2 + 0^2$$

Using the identity, we have :

$$77 = 7\cdot11 = 8^2 + 0^2 + 2^2 + 3^2$$

Primes of the form $$4n + 1$$ are written as $$n^2 + m^2 + 0^2 + 0^2$$ and primes of the form $$4n + 3$$  are either $$n^2 + m^2 + l^2 + 0^2$$ or $$n^2 + m^2 + l^2 + k^2$$.

The proof that every natural number is the sum of four squares came from Lagrange (1736 – 1813) in 1770.

Again, it is a proof by infinite descent and uses Euler’s four-square identity and the theorem of quadratic residues.

Quadratic residues are used in acoustics and cryptography; the theorem states that if $$p$$ is an odd prime, then the congruence $$n^2 + m^2 \equiv -1 \pmod p$$ has a solution.

Theorem 2.  Every natural number can be written as a sum of four squares.

More modern proofs of Lagrange’s four squares theorem make use of quaternions.

© OldTrout $$2019$$

No Audio file – Does not translate well