Theorem (IsQR.isLeastSquaresSolution_iff). Least squares through QR. When the diagonal of \mathbf{R} has no zero (full column rank), \mathbf{x} minimises \|\mathbf{A}\mathbf{x} - \mathbf{b}\| exactly when \mathbf{R}\mathbf{x} = \mathbf{Q}^{\mathsf{H}}\mathbf{b}. [GolubVanLoan2013, §5.3.3]; [TrefethenBau1997, Lecture 11].
Headline
Lean statement and details
NLAlib.IsQR.isLeastSquaresSolution_iff.{u_1, u_3, u_4} {𝕜 : Type u_1} [RCLike 𝕜] {m : Type u_3}
{n : Type u_4} [Fintype m] [Fintype n] [LinearOrder n] [DecidableEq n] {A Q : Matrix m n 𝕜}
{R : Matrix n n 𝕜} (h : IsQR A Q R) (hR : ∀ (i : n), R i i ≠ 0) {b : m → 𝕜} {x : n → 𝕜} :
IsLeastSquaresSolution A b x ↔ R *ᵥ x = Qᴴ *ᵥ b