NLA-lib Explorer

Pseudoinverses

Moore–Penrose pseudoinverses, least-squares solutions, and range conditions. The introductory exposition is incomplete; available library statements are listed below.

Background

Results

Theorem (Albert's criterion).

The block matrix \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{B}^{\mathsf{H}} & \mathbf{C} \end{bmatrix} is positive semidefinite exactly when \mathbf{A} is, the equation \mathbf{A}\mathbf{X} = \mathbf{B} has a solution, and \mathbf{C} - \mathbf{X}^{\mathsf{H}}\mathbf{A}\mathbf{X} is positive semidefinite for one such solution (equivalently for all, Matrix.IsHermitian.conjTranspose_mul_mul_eq_of_mul_eq). [HornJohnson2013, Theorem 7.7.9]; stated there with the pseudoinverse solution \mathbf{X} = \mathbf{A}^{+}\mathbf{B} and the range condition \mathbf{A}\mathbf{A}^{+}\mathbf{B} = \mathbf{B}, here with any solution, so that no pseudoinverse is needed.

Lean statement and details
NLAlib.posSemidef_fromBlocks_iff_exists.{u_1, u_2, u_3} {š•œ : Type u_1} [RCLike š•œ] {m : Type u_2}
  {n : Type u_3} [Fintype m] [Finite n] {A : Matrix m m š•œ} {B : Matrix m n š•œ} {C : Matrix n n š•œ} :
  (fromBlocks A B Bį““ C).PosSemidef ↔ A.PosSemidef ∧ ∃ X, A * X = B ∧ (C - Xį““ * A * X).PosSemidef

Full source on GitHub

Copy link

Theorem (Singularity and the spectral condition number).

A real or complex square matrix has infinite spectral condition number exactly when it is singular. [GolubVanLoan2013, §2.6.2].

Lean statement and details
NLAlib.spectralConditionNumber_eq_top_iff.{u_1, u_4} {š•œ : Type u_1} [RCLike š•œ] {n : Type u_4}
  [Fintype n] [DecidableEq n] (A : Matrix n n š•œ) : spectralConditionNumber A = āˆž ↔ ¬IsUnit A

Full source on GitHub

Copy link

Theorem (Reciprocal condition number and distance to singularity).

For every nonzero square matrix \mathbf{A}, \min_{\mathbf{A}+\mathbf{E}\ \mathrm{singular}} \frac{\|\mathbf{E}\|_2}{\|\mathbf{A}\|_2} = \kappa_2(\mathbf{A})^{-1}. For singular \mathbf{A} the zero perturbation attains the minimum, with 1/\infty=0. [GolubVanLoan2013, §2.6.2].

Lean statement and details
NLAlib.isLeast_specNorm_div_not_isUnit_add_of_ne_zero.{u_1, u_4} {š•œ : Type u_1} [RCLike š•œ]
  {n : Type u_4} [Fintype n] [DecidableEq n] {A : Matrix n n š•œ} (hA : A ≠ 0) :
  IsLeast ((fun E ↦ specNorm E / specNorm A) '' {E | ¬IsUnit (A + E)})
    (spectralConditionNumber A)⁻¹.toReal

Full source on GitHub

Copy link

Theorem (Uniqueness on the penalty kernel).

For normalized GSVD coordinates and trivial common kernel, every best data fit on the penalty kernel is the infinite-parameter endpoint. Neither matrix individually needs full column rank; empty dimensions are included. Derived here using strict convexity of the Euclidean norm; no printed source for this formulation.

Lean statement and details
NLAlib.IsGSVD.eq_gsvdPenaltyKernelSolution_of_isMinOn.{u_1, u_2, u_3, u_4} {š•œ : Type u_1} [RCLike š•œ]
  {m : Type u_2} {n : Type u_3} {p : Type u_4} [Fintype m] [Fintype n] [Fintype p] [DecidableEq n]
  {A : Matrix m n š•œ} {L : Matrix p n š•œ} {X : Matrix n n š•œ} {c s : n → ā„} (h : IsGSVD A L X c s)
  (hker : A.mulVecLin.ker āŠ“ L.mulVecLin.ker = ⊄) (b : m → š•œ) {x : n → š•œ} (hx : L *ᵄ x = 0)
  (hmin : IsMinOn (fun y ↦ ‖WithLp.toLp 2 (b - A *ᵄ y)‖) (↑L.mulVecLin.ker) x) :
  x = gsvdPenaltyKernelSolution A X c s b

Full source on GitHub

Copy link

Theorem (The pseudoinverse solves least squares).

\mathbf{A}^{+}\mathbf{b} is a least-squares solution. [GolubVanLoan2013, §5.5.2].

Lean statement and details
NLAlib.isLeastSquaresSolution_pinv_mulVec.{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 → š•œ) :
  IsLeastSquaresSolution A b (pinv A *ᵄ b)

Full source on GitHub

Copy link

Theorem (The pseudoinverse solution has the smallest norm).

among least-squares solutions: \|\mathbf{A}^{+}\mathbf{b}\| \le \|\mathbf{x}\| for every least-squares solution \mathbf{x}. [GolubVanLoan2013, §5.5.2].

Lean statement and details
NLAlib.IsLeastSquaresSolution.norm_pinv_mulVec_le.{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 (pinv A *ᵄ b)‖ ≤ ‖WithLp.toLp 2 x‖

Full source on GitHub

Copy link

Theorem (Existence of the pseudoinverse).

Every matrix \mathbf{A}, of any shape and rank, has a Moore–Penrose pseudoinverse: some \mathbf{B} satisfies the four Penrose identities \mathbf{A}\mathbf{B}\mathbf{A} = \mathbf{A}, \quad \mathbf{B}\mathbf{A}\mathbf{B} = \mathbf{B}, \quad (\mathbf{A}\mathbf{B})^{\mathsf{H}} = \mathbf{A}\mathbf{B}, \quad (\mathbf{B}\mathbf{A})^{\mathsf{H}} = \mathbf{B}\mathbf{A}\,. [GolubVanLoan2013, §5.5.2].

Lean statement and details
NLAlib.exists_isPinv.{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, IsPinv A B

Full source on GitHub

Copy link

Theorem (Uniqueness of the pseudoinverse).

A matrix has at most one Moore–Penrose pseudoinverse: if \mathbf{B} and \mathbf{C} both satisfy the four Penrose identities for \mathbf{A}, then \mathbf{B} = \mathbf{C}. [HornJohnson2013, Problem 7.3.P7].

Lean statement and details
NLAlib.IsPinv.unique.{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 C : Matrix n m š•œ} (hB : IsPinv A B)
  (hC : IsPinv A C) : B = C

Full source on GitHub

Copy link

Theorem (The normal equations).

\mathbf{x} is a least-squares solution exactly when \mathbf{A}^{\mathsf{H}}\mathbf{A}\mathbf{x} = \mathbf{A}^{\mathsf{H}}\mathbf{b}. [GolubVanLoan2013, §5.3.1].

Lean statement and details
NLAlib.isLeastSquaresSolution_iff_normal_equations.{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 → š•œ} :
  IsLeastSquaresSolution A b x ↔ Aį““ *ᵄ A *ᵄ x = Aį““ *ᵄ b

Full source on GitHub

Copy link

Theorem (The generalized Schur complement as a partial minimum).

In a positive semidefinite block matrix \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{B}^{\mathsf{H}} & \mathbf{C} \end{bmatrix}, the real part of the quadratic form of \mathbf{C} - \mathbf{B}^{\mathsf{H}}\mathbf{A}^{+}\mathbf{B} at \mathbf{x} is the least value, over \mathbf{y}, of the real part of the quadratic form of the block matrix at the stacked vector \begin{bmatrix} \mathbf{y} \\ \mathbf{x} \end{bmatrix}. [HornJohnson2013, §7.7].

Lean statement and details
Matrix.PosSemidef.isLeast_re_quadForm_fromBlocks.{u_1, u_2, u_3} {š•œ : Type u_1} [RCLike š•œ]
  {m : Type u_2} {n : Type u_3} [Fintype m] [Fintype n] {A : Matrix m m š•œ} {B : Matrix m n š•œ}
  {C : Matrix n n š•œ} (h : (fromBlocks A B Bį““ C).PosSemidef) (x : n → š•œ) :
  IsLeast (Set.range fun y ↦ RCLike.re (quadForm (fromBlocks A B Bį““ C) (y āŠ•įµ„ x)))
    (RCLike.re (quadForm (C - Bį““ * pinv A * B) x))

Full source on GitHub

Copy link

Theorem (Core noise).

for \mathbf{Q} with orthonormal columns and \operatorname{rank}(\mathbf{S}\mathbf{Q}) = \operatorname{rank}\mathbf{Q} (full column rank of \mathbf{S}\mathbf{Q}), the sketched core is the exact core plus noise, \mathsf{sketchAndSolve}(\mathbf{Q}, \mathbf{S}, \mathbf{B}) = \mathbf{Q}^{\mathsf{H}}\mathbf{B} + \mathsf{sketchAndSolve}(\mathbf{Q}, \mathbf{S}, (\mathbf{I}-\mathbf{Q}\mathbf{Q}^{\mathsf{H}})\mathbf{B})\,. [TroppYurtseverUdellCevher2017, Lemma A.4]; [CamanoEpperlyMeyerTropp2025, Lemma 2.6]; there with a complement frame.

Lean statement and details
NLAlib.HasOrthonormalCols.sketchAndSolve_eq_add.{u_1, u_3, u_5, u_6, u_7} {š•œ : Type u_1} [RCLike š•œ]
  {m : Type u_3} [Fintype m] {k : Type u_5} {p : Type u_6} {q : Type u_7} [Fintype k]
  {S : Matrix k m š•œ} [Fintype q] [DecidableEq m] [DecidableEq q] {Q : Matrix m q š•œ}
  (hQ : HasOrthonormalCols Q) (h : (S * Q).rank = Q.rank) (B : Matrix m p š•œ) :
  sketchAndSolve Q S B = Qį““ * B + sketchAndSolve Q S ((1 - Q * Qį““) * B)

Full source on GitHub

Copy link

Theorem (Tikhonov spectral filter).

For any SVD \mathbf{A} = \mathbf{U}\operatorname{diag}(\boldsymbol{\sigma})\mathbf{V}^{\mathsf{H}} over \Bbbk and \beta > 0, the standard regularized inverse is \mathbf{V}\operatorname{diag}\!\left(\frac{\sigma_i}{\sigma_i^2 + \beta}\right) \mathbf{U}^{\mathsf{H}}. Zero singular values and arbitrary rectangular dimensions are included. [FesslerNadakuditi2024, §5.6.5, equations (5.44)–(5.48)].

Lean statement and details
NLAlib.IsSVD.tikhonovInverse_one_eq.{u_1, u_2, u_3, u_4} {š•œ : Type u_1} [RCLike š•œ] {m : Type u_2}
  {n : Type u_3} [Fintype m] [Fintype n] [DecidableEq n] {r : Type u_4} [Fintype r] [DecidableEq r]
  {A : Matrix m n š•œ} {U : Matrix m r š•œ} {V : Matrix n r š•œ} {σ : r → ā„} (h : IsSVD A U σ V) {β : ā„}
  (hβ : 0 < β) : tikhonovInverse A 1 β = (V * diagonal fun i ↦ ↑(σ i / (σ i ^ 2 + β))) * Uį““

Full source on GitHub

Copy link

Theorem (Total least squares infimum).

For augmented data \mathbf{C}, the infimum of the squared Frobenius norms of feasible corrections is the least eigenvalue of its full domain Gram matrix. This allows nonattainment and repeated minimum eigenvalues. [GolubVanLoan2013, §6.3]. The statement also covers wide and empty-row data.

General form: sizes are index types

Lean statement and details
NLAlib.isGLB_totalLeastSquaresCosts.{u_1, u_2, u_3} {š•œ : Type u_1} [RCLike š•œ] {m : Type u_2}
  {n : Type u_3} [Fintype m] [Fintype n] (C : Matrix m (n āŠ• Unit) š•œ) :
  IsGLB (totalLeastSquaresCosts C) (eigenvalue (Cį““ * C) (Fintype.card n))

Full source on GitHub

Copy link

Theorem (Uniqueness of restricted least squares).

For a fixed split SVD whose retained singular values are positive, every residual minimizer in the retained right singular space equals the retained pseudoinverse solution. Empty retained spaces are included. [FesslerNadakuditi2024, §§5.6.1–5.6.4].

Lean statement and details
NLAlib.IsSVD.eq_pinv_mulVec_of_isMinOn.{u_1, u_2, u_3, u_4, u_5} {š•œ : Type u_1} [RCLike š•œ]
  {m : Type u_2} {n : Type u_3} {r : Type u_4} {s : Type u_5} [Fintype m] [Fintype n] [Fintype r]
  [Fintype s] [DecidableEq r] [DecidableEq s] {A : Matrix m n š•œ} {U₁ : Matrix m r š•œ}
  {Uā‚‚ : Matrix m s š•œ} {V₁ : Matrix n r š•œ} {Vā‚‚ : Matrix n s š•œ} {Ļƒā‚ : r → ā„} {Ļƒā‚‚ : s → ā„}
  (h : IsSVD A (U₁.fromCols Uā‚‚) (Ļƒā‚ āŠ•įµ„ Ļƒā‚‚) (V₁.fromCols Vā‚‚)) (hσ : āˆ€ (i : r), 0 < Ļƒā‚ i) (b : m → š•œ)
  {x : n → š•œ} (hx : x ∈ V₁.mulVecLin.range)
  (hmin : IsMinOn (fun y ↦ ‖WithLp.toLp 2 (b - A *ᵄ y)‖) (↑V₁.mulVecLin.range) x) :
  x = pinv ((U₁ * diagonal fun i ↦ ↑(Ļƒā‚ i)) * V₁ᓓ) *ᵄ b

Full source on GitHub

Copy link

Formal definitions

Used by algorithms

Broader topics