Residual of a standard Gaussian vector against a fixed -dimensional row space is
ProvedGaussianMatrix.residual_lawLet be a fixed real matrix of full row rank, (so and is invertible), and let be a standard Gaussian vector in (independent coordinates). Define the squared residual
the squared length of the component of orthogonal to the row space of . Then has the chi-square distribution with degrees of freedom:
This is the probabilistic step in the computation of : conditionally on the other rows of a Gaussian matrix, the residual of one row has a law whose degrees of freedom do not depend on those rows. It follows from rotation invariance of the standard Gaussian: if the columns of form an orthonormal basis of , then and .
Formalization Note. Both laws are expressed as push-forward measures on (Measure.map) of the product measures Measure.pi fun _ => gaussianReal 0 1; the subtraction is natural-number subtraction, which is exact because forces .
import Definitions.Def_GaussianMatrix_basic open MeasureTheory ProbabilityTheory open scoped Matrix
namespace GaussianMatrix
theorem residual_law {n k : ℕ} (H : Matrix (Fin n) (Fin k) ℝ) (hH : H.rank = n) :
Measure.map (fun g : Fin k → ℝ => g ⬝ᵥ g - (H *ᵥ g) ⬝ᵥ ((H * Hᵀ)⁻¹ *ᵥ (H *ᵥ g)))
(Measure.pi fun _ : Fin k => gaussianReal 0 1)
= Measure.map (fun x : Fin (k - n) → ℝ => ∑ j, x j ^ 2)
(Measure.pi fun _ : Fin (k - n) => gaussianReal 0 1) := by sorry
end GaussianMatrix