= Jacobi's four-square theorem
{c}
For $n\ge1$, let $r_4(n)$ count the <integer> quadruples $(a,b,c,d)$ with $a^2+b^2+c^2+d^2=n$, counting order, signs, and zeros. <Jacobi's four-square theorem> gives
$$
r_4(n)=8\sum_{\substack{d\mid n\\4\nmid d}}d.
$$
The right side is positive, so this also implies that every positive <integer> is a sum of four squares.
For $n=1$, the formula gives eight representations: choose the position of $\pm1$. For $n=2$, it gives $8(1+2)=24$, matching the six choices of two nonzero positions and four sign choices. Specifying the counting convention matters: unordered nonnegative representations have a different count.
Back to article page