Euler's four-square identity for quadratic maps #
Mathlib's euler_four_squares says that the product of two sums of four squares in a commutative
ring is again a sum of four squares, the four new terms being the coordinates of a product of
quaternions. The same identity holds with the squares of the second factor replaced by the values
of an arbitrary quadratic map Q : M → N: multiplying a quadruple (x, y, z, w) of vectors by
the quaternion a + bi + cj + dk multiplies Q x + Q y + Q z + Q w by a² + b² + c² + d².
The reason is that the matrix of left multiplication by a quaternion has orthogonal columns of
squared length a² + b² + c² + d². So when Q of each new coordinate is expanded through the
polar form, the coefficients of Q x, …, Q w add up to that norm, and the coefficients of the
cross terms polar Q x y, … cancel. No inverse of 2 is needed. This is the identity used to
show that the fourth power of the Gauss sum of a finite quadratic module is real.
Main declarations #
QuadraticMap.euler_four_squares: Euler's four-square identity for a quadratic map.
Euler's four-square identity for a quadratic map. Multiplying (x, y, z, w) by the
quaternion a + bi + cj + dk multiplies Q x + Q y + Q z + Q w by a² + b² + c² + d². For
Q = x ↦ x² on a commutative ring this is euler_four_squares.