NLA-lib Explorer

NLAlib.isBestRankApprox_iff_exists_isSVD

Library · theorem

Every best approximation is a truncated SVD: \mathbf{Y} is a best approximation of \mathbf{C} of rank at most k if and only if, for some thin singular value decomposition \mathbf{C} = \mathbf{U}\operatorname{diag}(\sigma_0(\mathbf{C}), \dots, \sigma_{r-1}(\mathbf{C}))\mathbf{V}^{\mathsf{H}} with r = \min(\lvert m\rvert, \lvert n\rvert) orthonormal columns and the singular values in non-increasing order, \mathbf{Y} = \mathbf{U}\operatorname{diag}\bigl(\sigma_0(\mathbf{C}), \dots, \sigma_{k-1}(\mathbf{C}), 0, \dots, 0\bigr)\mathbf{V}^{\mathsf{H}}\,. So the best approximations are exactly the truncations of the SVDs of \mathbf{C}, in the shape of NLAlib.truncatedSVD, which is the one built from the chosen SVD (NLAlib.svdU, NLAlib.svdV). It holds under ties \sigma_{k-1}(\mathbf{C}) = \sigma_k(\mathbf{C}), where there are many, and for k \ge \operatorname{rank}\mathbf{C}, where \mathbf{Y} = \mathbf{C}. [GolubVanLoan2013, Theorem 2.4.8]; [HornJohnson2013, §7.4.9]; there that the truncation of an SVD is a best approximation, here also the converse, the equality case of Eckart–Young.

NLAlib.isBestRankApprox_iff_exists_isSVD.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜] {m : Type u_2}
  {n : Type u_3} [Fintype m] [Fintype n] {C Y : Matrix m n 𝕜} {k : ℕ} :
  IsBestRankApprox C k Y ↔
    ∃ U V,
      IsSVD C U (fun i ↦ singularValues C ↑i) V ∧
        Y = (U * diagonal fun i ↦ if ↑i < k then ↑(singularValues C ↑i) else 0) * Vᴴ

Full source on GitHub

Import NLAlib.Matrix.Spectral.BestRankApprox.