Jacobi's four-square theorem


In number theory, Jacobi's four-square theorem gives a formula for the number of ways that a given positive integer can be represented as the sum of four squares.

History

The theorem was proved in 1834 by Carl Gustav Jakob Jacobi.

Theorem

Two representations are considered different if their terms are in different order or if the integer being squared is different; to illustrate, these are three of the eight different ways to represent 1:
The number of ways to represent as the sum of four squares is eight times the sum of the divisors of if is odd and 24 times the sum of the odd divisors of if is even, i.e.
Equivalently, it is eight times the sum of all its divisors which are not divisible by 4, i.e.
An immediate consequence is ; for odd,.
We may also write this as
where the second term is to be taken as zero if is not divisible by 4. In particular, for a prime number we have the explicit formula.
Some values of occur infinitely often as whenever is even. The values of can be arbitrarily large: indeed, is infinitely often larger than

Proof

The theorem can be proved by elementary means starting with the Jacobi triple product.
The proof shows that the Theta series for the lattice Z4 is a modular form of a certain level, and hence equals a linear combination of Eisenstein series.

Values

The first few values of the formula are as follows:
012345678910
1824322448966424104144

Additional values may be seen at in the Online Encyclopedia of Integer Sequences.

Generalizations

The number of representations of n as the sum of k squares is known as the sum of squares function.
Jacobi's four-square theorem gives an analytic formula for the case k = 4.