Lagrange's four-square theorem

Lagrange's four-square theorem, also known as Bachet's conjecture, states that every nonnegative integer can be represented as a sum of four non-negative integer squares. That is, the squares form an additive basis of order four: where the four numbers are integers. For illustration, 3, 31, and 310 can be represented as the sum of four squares as follows:

This theorem was proven by Joseph Louis Lagrange in 1770. It is a special case of the Fermat polygonal number theorem.