18 #19 The four-square theorem
Lagrange's four-square theorem: every natural number is a sum of four squares.
18.1 Euler's four-square identity
A product of sums of four squares is again a sum of four squares (the product of norms of quaternions).
E4 …
\(a , b , c , d , w , x , y , z \in \mathbb{Z} \Longrightarrow ( a \cdot a + b \cdot b + ( c \cdot c + d \cdot d ) ) \cdot ( w \cdot w + x \cdot x + ( y \cdot y + z \cdot z ) ) = ( a \cdot w - b \cdot x - c \cdot y - d \cdot z ) \cdot ( a \cdot w - b \cdot x - c \cdot y - d \cdot z ) + ( a \cdot x + b \cdot w + c \cdot z - d \cdot y ) \cdot ( a \cdot x + b \cdot w + c \cdot z - d \cdot y ) + ( ( a \cdot y - b \cdot z + c \cdot w + d \cdot x ) \cdot ( a \cdot y - b \cdot z + c \cdot w + d \cdot x ) + ( a \cdot z + b \cdot y - c \cdot x + d \cdot w ) \cdot ( a \cdot z + b \cdot y - c \cdot x + d \cdot w ) )\) \(\blacktriangleleft\) \(\mathbb{W}.\) ,AxℤRA product of sums of four squares is again a sum of four squares.
C4 …
\(m , n \in \mathbb{Z} , \exists a , b , c , d \in \mathbb{Z} . m = a \cdot a + b \cdot b + ( c \cdot c + d \cdot d ) , \exists a , b , c , d \in \mathbb{Z} . n = a \cdot a + b \cdot b + ( c \cdot c + d \cdot d ) \Longrightarrow \exists a , b , c , d \in \mathbb{Z} . m \cdot n = a \cdot a + b \cdot b + ( c \cdot c + d \cdot d )\) \(\blacktriangleleft\) E4 ,\(\mathbb{W}.\) ,AxℤR18.2 Division of integers
Dividing an integer \(a\) by a positive \(m\) gives a remainder \(r\) (\(0 \le r < m\)).
The remainder can be taken in the range \(-m < 2A \le m\) (if \(2r > m\), replace it by \(r - m\)).
18.3 Tools for descent
A square is a natural number. An integer that becomes a natural number when multiplied by a positive \(m\) is a natural number.
If \(-m < 2A \le m\), then \((2A)^2 \le m^2\), with equality only when \(2A = m\).
If the sum of four natural numbers is 0, each is 0.
We can cancel a nonzero integer.
A prime \(p\) is not a multiple of any \(1 < m < p\).
The computation for descent (a ring identity).
Descent: if \(1 < m < p\) and \(mp = \sum a^2\), then the sum of squares of the remainders of \(a\) divided by \(m\), \(A\) (\(-m < 2A \le m\)) is \(m r\) (\(0 < r < m\)), and by the four-square identity \(rp\) is also a sum of four squares.
One step of descent: if \(1 < m < p\) and \(mp\) is a sum of four squares, then for a smaller \(r\) (\(0 < r < m\)), \(rp\) is also a sum of four squares.
Repeat this (by strong induction on \(m\)).
18.4 The pigeonhole principle: \(x^2 + y^2 + 1\) is divisible by \(p\)
A natural number that is a multiple of \(p\) and less than \(p\) is 0. The remainder is uniquely determined.
For \(0 \le x, y \le h\) (\(p = 2h + 1\)), if \(x^2 \equiv y^2\) then \(x = y\) (by \(y^2 - x^2 = (y - x)(y + x)\) and Euclid's lemma).
A lemma on intervals, and taking remainders in \(0..2h\).
Computation with congruences: the same remainder means the difference is a multiple of \(p\). Since \(p = 2h + 1\), \(2h \equiv -1\).
The pigeonhole principle: to \(x \in 0..h\), assign the remainder of \(x^2\) and the remainder of \(2h(1 + x^2) \equiv -(1 + x^2)\) (from \(p + 1\) elements to \(p\) elements). If there is no pair with \(x^2 + y^2 + 1\) a multiple of \(p\), the map is an injection, and the sizes do not match.
18.5 The case of a prime
For an odd prime \(p = 2h + 1\), in \(x^2 + y^2 + 1 = mp\) from the pigeonhole principle, \(0 < m < p\) (since \(x, y \le h\), \(mp \le 2h^2 + 1 < p^2\)). Descent lowers it to \(m = 1\).
18.6 The four-square theorem
With a prime factor \(p\), split \(n = pk\) (\(k < n\)), and multiply the representations of \(p\) and \(k\) (strong induction) by the four-square identity.
The square of an integer is the square of a natural number. Hence every natural number is a sum of four squares of natural numbers.
\(n \in \mathbb{M} \Longrightarrow \exists a , b , c , d \in \mathbb{M} . n = a ^ 2 + b ^ 2 + c ^ 2 + d ^ 2\) \(\blacktriangleleft\) Sq4 ,Lab ,↑∈𝕄 ,\(\mathbb{W}.\) ,\(0 \in \mathbb{M}\) ,𝕄0 ,INDC ,ℤ+ ,ℤCRing ,⋅0X