Preply — Study more efficiently by working with a personal tutor. Get 50% off.Affiliate

Wikipedia

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 n can be represented as the sum of four squares (of integers).

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 (not just the square) is different; to illustrate, these are three of the eight different ways to represent 1:

1 2 + 0 2 + 0 2 + 0 2 0 2 + 1 2 + 0 2 + 0 2 ( − 1 ) 2 + 0 2 + 0 2 + 0 2 . {\displaystyle {\begin{aligned}1^{2}&+0^{2}+0^{2}+0^{2}\\0^{2}&+1^{2}+0^{2}+0^{2}\\(-1)^{2}&+0^{2}+0^{2}+0^{2}.\end{aligned}}}

The number of ways to represent n as the sum of four squares is eight times the sum of the divisors of n if n is odd and 24 times the sum of the odd divisors of n if n is even (see divisor function), i.e.

r 4 ( n ) = { 8 ∑ m | n m if n is odd , 24 ∑ m | n m odd m if n is even . {\displaystyle r_{4}(n)={\begin{cases}\displaystyle 8\sum _{m|n}m&{\text{if }}n{\text{ is odd}},\\[12pt]\displaystyle 24\sum _{{m|n} \atop {m{\text{ odd}}}}m&{\text{if }}n{\text{ is even}}.\end{cases}}}

Equivalently, it is eight times the sum of all its divisors which are not divisible by 4, i.e.

r 4 ( n ) = 8 ∑ m ∣ n , 4 ∤ m m . {\displaystyle r_{4}(n)=8\sum _{{m\mid n,} \atop {4\nmid m}}m.}

An immediate consequence is r 4 ( 2 n ) = r 4 ( 8 n ) {\displaystyle r_{4}(2n)=r_{4}(8n)} ; for odd n {\displaystyle n} , r 4 ( 2 ⋅ 4 a n ) = r 4 ( 2 n ) {\displaystyle r_{4}(2\cdot 4^{a}n)=r_{4}(2n)} . We may also write this as

r 4 ( n ) = 8 σ ( n ) − 32 σ ( n / 4 ) {\displaystyle r_{4}(n)=8\,\sigma (n)-32\,\sigma (n/4)}

where the second term is to be taken as zero if n is not divisible by 4. In particular, for a prime number p we have the explicit formula r4(p) = 8(p + 1). Some values of r4(n) occur infinitely often as r4(n) = r4(2mn) whenever n is even. The values of r4(n) can be arbitrarily large: indeed, r4(n) is infinitely often larger than 8 log ⁡ n . {\displaystyle 8{\sqrt {\log n}}.}

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:

Additional values may be seen at sequence A000118 in the Online Encyclopedia of Integer Sequences (OEIS).

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.

See also Lagrange's four-square theorem Lambert series Sum of squares function

Notes

References Hirschhorn, Michael D.; McGowan, James A. (2001). "Algebraic Consequences of Jacobi's Two— and Four—Square Theorems". In Garvan, F. G.; Ismail, M. E. H. (eds.). Symbolic Computation, Number Theory, Special Functions, Physics and Combinatorics. Developments in Mathematics. Vol. 4. Springer. pp. 107–132. CiteSeerX 10.1.1.26.9028. doi:10.1007/978-1-4613-0257-5_7. ISBN 978-1-4020-0101-7. {{cite book}}: Cite uses deprecated parameter |citeseerx= (help) Hirschhorn, Michael D. (1987). "A simple proof of Jacobi's four-square theorem". Proceedings of the American Mathematical Society. 101 (3): 436–438. doi:10.1090/s0002-9939-1987-0908644-9. Williams, Kenneth S. (2011). Number theory in the spirit of Liouville. London Mathematical Society Student Texts. Vol. 76. Cambridge University Press. ISBN 978-0-521-17562-3. Zbl 1227.11002.

External links Weisstein, Eric W. "Sum of Squares Function". MathWorld. OEIS Foundation Inc. (2025). "A000118: Number of ways of writing n as a sum of 4 squares". The On-Line Encyclopedia of Integer Sequences.

Tags

  • Squares in number theory
  • Theorems in number theory