NLA-lib Explorer

Rank, determinants, and Schur complements

Rank describes the image of a linear map; determinants and minors detect invertibility and volume. A Schur complement eliminates a block and relates the resulting matrix to rank, positivity, and determinant identities. These are reusable algebraic statements rather than algorithms for performing elimination.

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 (Multiplicativity of compound matrices).

Writing C_k(\mathbf{A}) for the k-th compound matrix (compound k A), C_k(\mathbf{A}\mathbf{B}) = C_k(\mathbf{A}) C_k(\mathbf{B}), the Cauchy–Binet formula for every k \times k minor of a product. [HornJohnson2013, §0.8.1 and §0.8.7].

Lean statement and details
Matrix.compound_mul.{u_1, u_2, u_3, u_4} {R : Type u_1} [CommRing R] {l : Type u_2} {m : Type u_3}
  {n : Type u_4} [LinearOrder l] [LinearOrder m] [LinearOrder n] [Fintype m] (k : ℕ)
  (A : Matrix l m R) (B : Matrix m n R) : compound k (A * B) = compound k A * compound k B

Full source on GitHub

Copy link

Theorem (Complementary nullities).

For an invertible \mathbf{A} and sets of indices r (rows) and c (columns), the block of \mathbf{A} on rows r and columns c and the block of \mathbf{A}^{-1} on rows outside c and columns outside r have kernels of the same dimension. The blocks need not be square. [HornJohnson2013, §0.7.5]; here over any field.

Lean statement and details
Matrix.finrank_ker_toBlock_eq_finrank_ker_inv_toBlock_not.{u_1, u_4} {K : Type u_1} [Field K]
  {n : Type u_4} [Fintype n] [DecidableEq n] (A : Matrix n n K) (hA : IsUnit A) (r c : n → Prop)
  [DecidablePred r] [DecidablePred c] :
  Module.finrank K ↥(A.toBlock r c).mulVecLin.ker =
    Module.finrank K ↥(A⁻¹.toBlock (fun i ↦ ¬c i) fun i ↦ ¬r i).mulVecLin.ker

Full source on GitHub

Copy link

Theorem (Frobenius's rank inequality).

\operatorname{rank}(\mathbf{A}\mathbf{B}) + \operatorname{rank}(\mathbf{B}\mathbf{C}) \le \operatorname{rank} \mathbf{B} + \operatorname{rank}(\mathbf{A}\mathbf{B}\mathbf{C}). [HornJohnson2013, §0.4.5]; here over any field and any finite index types.

Lean statement and details
Matrix.rank_mul_add_rank_mul_le.{u_1, u_2, u_3, u_4, u_5} {K : Type u_1} [Field K] {l : Type u_2}
  {m : Type u_3} {n : Type u_4} {p : Type u_5} [Fintype n] [Fintype m] [Fintype p]
  (A : Matrix l m K) (B : Matrix m n K) (C : Matrix n p K) :
  (A * B).rank + (B * C).rank ≤ B.rank + (A * B * C).rank

Full source on GitHub

Copy link

Theorem (Jacobi's complementary minor formula).

Let the bijections e_r, e_c : p \oplus q \simeq n split the index type of an invertible \mathbf{A} into a selected part p and its complement q, for rows and for columns. The minor of \mathbf{A}^{-1} on rows e_c(q) and columns e_r(q) is the minor of \mathbf{A} on rows e_r(p) and columns e_c(p), times the sign of the permutation e_r^{-1} \circ e_c (ec.trans er.symm), divided by \det \mathbf{A}. [HornJohnson2013, §0.8.4]; stated there for increasing index sets with the sign (-1)^s, s the sum of the selected indices, here for any finite index types over any field.

Lean statement and details
Matrix.det_inv_submatrix_inr.{u_1, u_2, u_3, u_4} {K : Type u_1} [Field K] {n : Type u_2}
  {p : Type u_3} {q : Type u_4} [Fintype n] [Fintype p] [Fintype q] [DecidableEq n] [DecidableEq p]
  [DecidableEq q] (A : Matrix n n K) (hA : IsUnit A) (er ec : p ⊕ q ≃ n) :
  (A⁻¹.submatrix (fun i ↦ ec (Sum.inr i)) fun j ↦ er (Sum.inr j)).det =
    ↑↑(Equiv.Perm.sign (ec.trans er.symm)) *
        (A.submatrix (fun i ↦ er (Sum.inl i)) fun j ↦ ec (Sum.inl j)).det /
      A.det

Full source on GitHub

Copy link

Theorem (Self-duality of the positive semidefinite cone).

A Hermitian matrix is positive semidefinite exactly when its trace pairing with every positive semidefinite matrix is nonnegative: \mathbf{0} \preceq \mathbf{A} iff 0 \le \operatorname{tr}(\mathbf{A}\mathbf{B}) for all \mathbf{0} \preceq \mathbf{B}. [HornJohnson2013, Theorem 7.5.4].

Lean statement and details
Matrix.IsHermitian.posSemidef_iff_trace_mul_nonneg.{u_1, u_2} {𝕜 : Type u_1} [RCLike 𝕜]
  {n : Type u_2} [Fintype n] {A : Matrix n n 𝕜} (hA : A.IsHermitian) :
  A.PosSemidef ↔ ∀ (B : Matrix n n 𝕜), B.PosSemidef → 0 ≤ (A * B).trace

Full source on GitHub

Copy link

Theorem (Subadditivity of rank).

The rank of a sum is at most the sum of the ranks: \operatorname{rank}(\mathbf{A} + \mathbf{B}) \le \operatorname{rank} \mathbf{A} + \operatorname{rank} \mathbf{B}. [HornJohnson2013, §0.4.5]; stated there for complex matrices, here over any field and any finite index types.

Lean statement and details
Matrix.rank_add_le.{u_1, u_3, u_4} {K : Type u_1} [Field K] {m : Type u_3} {n : Type u_4}
  [Fintype n] (A B : Matrix m n K) : (A + B).rank ≤ A.rank + B.rank

Full source on GitHub

Copy link

Theorem (Rouché–Capelli).

Adjoining the column \mathbf{b} to \mathbf{A} leaves the rank unchanged exactly when \mathbf{A}\mathbf{x} = \mathbf{b} has a solution. [HornJohnson2013, §0.4.2].

Lean statement and details
Matrix.rank_fromCols_replicateCol_eq_iff.{u_1, u_3, u_4} {K : Type u_1} [Field K] {m : Type u_3}
  {n : Type u_4} [Fintype n] (A : Matrix m n K) (b : m → K) :
  (A.fromCols (replicateCol Unit b)).rank = A.rank ↔ ∃ x, A *ᵥ x = b

Full source on GitHub

Copy link

Theorem (Positive definite block matrices).

\begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{B}^{\mathsf{H}} & \mathbf{C} \end{bmatrix} is positive definite exactly when \mathbf{A} and the Schur complement \mathbf{C} - \mathbf{B}^{\mathsf{H}}\mathbf{A}^{-1}\mathbf{B} are. [HornJohnson2013, Theorem 7.7.7].

Lean statement and details
NLAlib.posDef_fromBlocks_iff.{u_1, u_2, u_3} {𝕜 : Type u_1} [RCLike 𝕜] {m : Type u_2} {n : Type u_3}
  [Fintype m] [Finite n] [DecidableEq m] {A : Matrix m m 𝕜} {B : Matrix m n 𝕜} {C : Matrix n n 𝕜} :
  (fromBlocks A B Bᴴ C).PosDef ↔ A.PosDef ∧ (C - Bᴴ * A⁻¹ * B).PosDef

Full source on GitHub

Copy link

Theorem (Rank additivity of the Schur complement).

With an invertible leading block \mathbf{A} indexed by m, \operatorname{rank} \begin{bmatrix} \mathbf{A} & \mathbf{B} \\ \mathbf{C} & \mathbf{D} \end{bmatrix} = \lvert m \rvert + \operatorname{rank}(\mathbf{D} - \mathbf{C}\mathbf{A}^{-1}\mathbf{B}) \,. The trailing blocks may be rectangular. [HornJohnson2013, §0.8.5]; here over any field.

General form: sizes are index types

Lean statement and details
Matrix.rank_fromBlocks₁₁.{u_1, u_2, u_3, u_4} {K : Type u_1} [Field K] {l : Type u_2} {m : Type u_3}
  {n : Type u_4} [Fintype n] [Finite l] [Fintype m] [DecidableEq m] (A : Matrix m m K)
  (B : Matrix m n K) (C : Matrix l m K) (D : Matrix l n K) [Invertible A] :
  (fromBlocks A B C D).rank = Fintype.card m + (D - C * ⅟A * B).rank

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 (Sylvester's rank inequality).

For \mathbf{A} with column index n and \mathbf{B} with row index n, \operatorname{rank} \mathbf{A} + \operatorname{rank} \mathbf{B} \le \lvert n \rvert + \operatorname{rank}(\mathbf{A}\mathbf{B}). [HornJohnson2013, §0.4.5]; stated there as \operatorname{rank} \mathbf{A} + \operatorname{rank} \mathbf{B} - n \le \operatorname{rank}(\mathbf{A}\mathbf{B}), here additively and over any field.

General form: sizes are index types

Lean statement and details
Matrix.rank_add_rank_le_card_add_rank_mul.{u_1, u_3, u_4, u_5} {K : Type u_1} [Field K]
  {m : Type u_3} {n : Type u_4} {p : Type u_5} [Fintype n] [Fintype p] (A : Matrix m n K)
  (B : Matrix n p K) : A.rank + B.rank ≤ Fintype.card n + (A * B).rank

Full source on GitHub

Copy link

Formal definitions

Broader topics