Lagrange's Four-Square Theorem, also known as Bachet's Conjecture, was proved in 1770 by Joseph Louis Lagrange.

It states that every positive integer can be expressed as the sum of at most four squares.

More formally, for every positive integer n there exist non-negative integers a,b,c,d such that n = a2 + b2 + c2 + d2

Adrien-Marie Legendre improved on the theorem in 1798 by stating that a positive integer can be expressed as the sum of at most three squares if and only if it is not of the form (4k)(8l-7). His proof was incomplete, leaving a gap which was later filled by Karl Friedrich Gauss.