NLA-lib Explorer

NLAlib.IsLeastSquaresSolution.norm_sub_mulVec_sq

Library · theorem

The squared residual of a least-squares solution is \|\mathbf{b} - \mathbf{A}\mathbf{x}\|^2 = \|\mathbf{b}\|^2 - \|\mathbf{A}\mathbf{x}\|^2.

NLAlib.IsLeastSquaresSolution.norm_sub_mulVec_sq.{u_1, u_3, u_4} {𝕜 : Type u_1} [RCLike 𝕜]
  {m : Type u_3} {n : Type u_4} [Fintype m] [Fintype n] {A : Matrix m n 𝕜} {b : m → 𝕜} {x : n → 𝕜}
  (h : IsLeastSquaresSolution A b x) :
  ‖WithLp.toLp 2 (b - A *ᵥ x)‖ ^ 2 = ‖WithLp.toLp 2 b‖ ^ 2 - ‖WithLp.toLp 2 (A *ᵥ x)‖ ^ 2

Full source on GitHub

Import NLAlib.Matrix.Pseudoinverse.LeastSquares.