Gram–Schmidt and QR for Lattice Bases
Compute an orthogonal projection, read a QR factorization, and see why the Gram–Schmidt lengths multiply to the lattice covolume.
Gram–Schmidt resolves each basis vector into projections onto earlier directions and a new perpendicular component. QR stores the normalized directions as columns of and the projection coefficients in an upper triangular matrix .
Compute the projections
For columns and , the projection coefficient is 2. Subtracting leaves . The two perpendicular vectors have squared lengths 2 and 2.
Here the projection coefficient is an integer, so the perpendicular vector lies in the lattice. For a fractional projection coefficient, subtracting that fraction of a basis vector can leave the lattice. For example, with columns , the perpendicular vector is outside.
Read the matrices
Normalize the perpendicular vectors to get . Entry has row index and column index . In particular .
Multiply the factors to recover both original columns. The Gram–Schmidt length profile is . Its product is 2, equal to .
Volume and basis changes
For a full-column-rank rectangular basis, thin QR gives , so the covolume in the span is the product of the positive diagonal entries of . The profile can change under a unimodular basis change. Its product stays fixed.
For the shared rectangular and skew bases, is the identity and the profile is in either case. The off-diagonal entry changes from 0 to 6. See Gauss reduction for the integer subtraction that removes it.