The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V07. Linear algebra

Mathlib.LinearAlgebra.Matrix.SchurComplement

34 declarations. Mathlib docs · Source

2×2 block matrices and the Schur complement

This file proves properties of 2×2 block matrices [A B; C D] that relate to the Schur complement D - C*A⁻¹*B.

Some of the results here generalize to 2×2 matrices in a category, rather than just a ring. A few results in this direction can be found in Mathlib/CategoryTheory/Preadditive/Biproducts.lean, especially the declarations CategoryTheory.Biprod.gaussian and CategoryTheory.Biprod.isoElim. Compare with Matrix.invertibleOfFromBlocks₁₁Invertible.

Main results

  • Matrix.det_fromBlocks₁₁, Matrix.det_fromBlocks₂₂: determinant of a block matrix in terms of the Schur complement.
  • Matrix.invOf_fromBlocks_zero₂₁_eq, Matrix.invOf_fromBlocks_zero₁₂_eq: the inverse of a block triangular matrix.
  • Matrix.isUnit_fromBlocks_zero₂₁, Matrix.isUnit_fromBlocks_zero₁₂: invertibility of a block triangular matrix.
  • Matrix.det_one_add_mul_comm: the Weinstein–Aronszajn identity.

Block triangular matrices

2×2 block matrices

General 2×2 block matrices

Lemmas about Matrix.det

theorem Matrix.fromBlocks_eq_of_invertible₁₁ E1 #

∀ {l : Type u_1} {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype l] [inst_1 : Fintype m]
  [inst_2 : Fintype n] [inst_3 : DecidableEq l] [inst_4 : DecidableEq m] [inst_5 : DecidableEq n] [inst_6 : CommRing α]
  (A : Matrix m m α) (B : Matrix m n α) (C : Matrix l m α) (D : Matrix l n α) [inst_7 : Invertible A],
  Matrix.fromBlocks A B C D =
    Matrix.fromBlocks 1 0 (C * ⅟A) 1 * Matrix.fromBlocks A 0 0 (D - C * ⅟A * B) * Matrix.fromBlocks 1 (⅟A * B) 0 1

LDU decomposition of a block matrix with an invertible top-left corner, using the Schur complement.

theorem Matrix.fromBlocks_eq_of_invertible₂₂ E1 #

∀ {l : Type u_1} {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype l] [inst_1 : Fintype m]
  [inst_2 : Fintype n] [inst_3 : DecidableEq l] [inst_4 : DecidableEq m] [inst_5 : DecidableEq n] [inst_6 : CommRing α]
  (A : Matrix l m α) (B : Matrix l n α) (C : Matrix n m α) (D : Matrix n n α) [inst_7 : Invertible D],
  Matrix.fromBlocks A B C D =
    Matrix.fromBlocks 1 (B * ⅟D) 0 1 * Matrix.fromBlocks (A - B * ⅟D * C) 0 0 D * Matrix.fromBlocks 1 0 (⅟D * C) 1

LDU decomposition of a block matrix with an invertible bottom-right corner, using the Schur complement.

def Matrix.fromBlocksZero₂₁Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (D : Matrix n n α) → [Invertible A] → [Invertible D] → Invertible (Matrix.fromBlocks A B 0 D)

An upper-block-triangular matrix is invertible if its diagonal is.

def Matrix.fromBlocksZero₁₂Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (C : Matrix n m α) →
                    (D : Matrix n n α) → [Invertible A] → [Invertible D] → Invertible (Matrix.fromBlocks A 0 C D)

A lower-block-triangular matrix is invertible if its diagonal is.

theorem Matrix.invOf_fromBlocks_zero₂₁_eq E3 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (B : Matrix m n α) (D : Matrix n n α)
  [inst_5 : Invertible A] [inst_6 : Invertible D] [inst_7 : Invertible (Matrix.fromBlocks A B 0 D)],
  ⅟(Matrix.fromBlocks A B 0 D) = Matrix.fromBlocks (⅟A) (-(⅟A * B * ⅟D)) 0 ⅟D

theorem Matrix.invOf_fromBlocks_zero₁₂_eq E3 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (C : Matrix n m α) (D : Matrix n n α)
  [inst_5 : Invertible A] [inst_6 : Invertible D] [inst_7 : Invertible (Matrix.fromBlocks A 0 C D)],
  ⅟(Matrix.fromBlocks A 0 C D) = Matrix.fromBlocks (⅟A) 0 (-(⅟D * C * ⅟A)) ⅟D

def Matrix.invertibleOfFromBlocksZero₂₁Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (D : Matrix n n α) → [Invertible (Matrix.fromBlocks A B 0 D)] → Invertible A × Invertible D

Both diagonal entries of an invertible upper-block-triangular matrix are invertible (by reading off the diagonal entries of the inverse).

def Matrix.invertibleOfFromBlocksZero₁₂Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (C : Matrix n m α) →
                    (D : Matrix n n α) → [Invertible (Matrix.fromBlocks A 0 C D)] → Invertible A × Invertible D

Both diagonal entries of an invertible lower-block-triangular matrix are invertible (by reading off the diagonal entries of the inverse).

def Matrix.fromBlocksZero₂₁InvertibleEquiv E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (D : Matrix n n α) → Invertible (Matrix.fromBlocks A B 0 D) ≃ Invertible A × Invertible D

invertibleOfFromBlocksZero₂₁Invertible and Matrix.fromBlocksZero₂₁Invertible form an equivalence.

def Matrix.fromBlocksZero₁₂InvertibleEquiv E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (C : Matrix n m α) →
                    (D : Matrix n n α) → Invertible (Matrix.fromBlocks A 0 C D) ≃ Invertible A × Invertible D

invertibleOfFromBlocksZero₁₂Invertible and Matrix.fromBlocksZero₁₂Invertible form an equivalence.

theorem Matrix.isUnit_fromBlocks_zero₂₁ E3 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] {A : Matrix m m α} {B : Matrix m n α} {D : Matrix n n α},
  IsUnit (Matrix.fromBlocks A B 0 D) ↔ IsUnit A ∧ IsUnit D

An upper block-triangular matrix is invertible iff both elements of its diagonal are.

This is a propositional form of Matrix.fromBlocksZero₂₁InvertibleEquiv.

theorem Matrix.isUnit_fromBlocks_zero₁₂ E3 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] {A : Matrix m m α} {C : Matrix n m α} {D : Matrix n n α},
  IsUnit (Matrix.fromBlocks A 0 C D) ↔ IsUnit A ∧ IsUnit D

A lower block-triangular matrix is invertible iff both elements of its diagonal are.

This is a propositional form of Matrix.fromBlocksZero₁₂InvertibleEquiv forms an iff.

theorem Matrix.inv_fromBlocks_zero₂₁_of_isUnit_iff E0 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (B : Matrix m n α) (D : Matrix n n α),
  (IsUnit A ↔ IsUnit D) → (Matrix.fromBlocks A B 0 D)⁻¹ = Matrix.fromBlocks A⁻¹ (-(A⁻¹ * B * D⁻¹)) 0 D⁻¹

An expression for the inverse of an upper block-triangular matrix, when either both elements of diagonal are invertible, or both are not.

theorem Matrix.inv_fromBlocks_zero₁₂_of_isUnit_iff E0 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (C : Matrix n m α) (D : Matrix n n α),
  (IsUnit A ↔ IsUnit D) → (Matrix.fromBlocks A 0 C D)⁻¹ = Matrix.fromBlocks A⁻¹ 0 (-(D⁻¹ * C * A⁻¹)) D⁻¹

An expression for the inverse of a lower block-triangular matrix, when either both elements of diagonal are invertible, or both are not.

def Matrix.fromBlocks₂₂Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (C : Matrix n m α) →
                      (D : Matrix n n α) →
                        [inst_5 : Invertible D] → [Invertible (A - B * ⅟D * C)] → Invertible (Matrix.fromBlocks A B C D)

A block matrix is invertible if the bottom right corner and the corresponding Schur complement is.

def Matrix.fromBlocks₁₁Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (C : Matrix n m α) →
                      (D : Matrix n n α) →
                        [inst_5 : Invertible A] → [Invertible (D - C * ⅟A * B)] → Invertible (Matrix.fromBlocks A B C D)

A block matrix is invertible if the top left corner and the corresponding Schur complement is.

theorem Matrix.invOf_fromBlocks₂₂_eq E0 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
  (D : Matrix n n α) [inst_5 : Invertible D] [inst_6 : Invertible (A - B * ⅟D * C)]
  [inst_7 : Invertible (Matrix.fromBlocks A B C D)],
  ⅟(Matrix.fromBlocks A B C D) =
    Matrix.fromBlocks (⅟(A - B * ⅟D * C)) (-(⅟(A - B * ⅟D * C) * B * ⅟D)) (-(⅟D * C * ⅟(A - B * ⅟D * C)))
      (⅟D + ⅟D * C * ⅟(A - B * ⅟D * C) * B * ⅟D)

theorem Matrix.invOf_fromBlocks₁₁_eq E0 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
  (D : Matrix n n α) [inst_5 : Invertible A] [inst_6 : Invertible (D - C * ⅟A * B)]
  [inst_7 : Invertible (Matrix.fromBlocks A B C D)],
  ⅟(Matrix.fromBlocks A B C D) =
    Matrix.fromBlocks (⅟A + ⅟A * B * ⅟(D - C * ⅟A * B) * C * ⅟A) (-(⅟A * B * ⅟(D - C * ⅟A * B)))
      (-(⅟(D - C * ⅟A * B) * C * ⅟A)) ⅟(D - C * ⅟A * B)

def Matrix.invertibleOfFromBlocks₂₂Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (C : Matrix n m α) →
                      (D : Matrix n n α) →
                        [inst_5 : Invertible D] → [Invertible (Matrix.fromBlocks A B C D)] → Invertible (A - B * ⅟D * C)

If a block matrix is invertible and so is its bottom left element, then so is the corresponding Schur complement.

def Matrix.invertibleOfFromBlocks₁₁Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (C : Matrix n m α) →
                      (D : Matrix n n α) →
                        [inst_5 : Invertible A] → [Invertible (Matrix.fromBlocks A B C D)] → Invertible (D - C * ⅟A * B)

If a block matrix is invertible and so is its bottom left element, then so is the corresponding Schur complement.

def Matrix.invertibleEquivFromBlocks₂₂Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (C : Matrix n m α) →
                      (D : Matrix n n α) →
                        [inst_5 : Invertible D] → Invertible (Matrix.fromBlocks A B C D) ≃ Invertible (A - B * ⅟D * C)

Matrix.invertibleOfFromBlocks₂₂Invertible and Matrix.fromBlocks₂₂Invertible as an equivalence.

def Matrix.invertibleEquivFromBlocks₁₁Invertible E1 #

{m : Type u_2} →
  {n : Type u_3} →
    {α : Type u_4} →
      [inst : Fintype m] →
        [inst_1 : Fintype n] →
          [inst_2 : DecidableEq m] →
            [inst_3 : DecidableEq n] →
              [inst_4 : CommRing α] →
                (A : Matrix m m α) →
                  (B : Matrix m n α) →
                    (C : Matrix n m α) →
                      (D : Matrix n n α) →
                        [inst_5 : Invertible A] → Invertible (Matrix.fromBlocks A B C D) ≃ Invertible (D - C * ⅟A * B)

Matrix.invertibleOfFromBlocks₁₁Invertible and Matrix.fromBlocks₁₁Invertible as an equivalence.

theorem Matrix.isUnit_fromBlocks_iff_of_invertible₂₂ E1 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] {A : Matrix m m α} {B : Matrix m n α} {C : Matrix n m α}
  {D : Matrix n n α} [inst_5 : Invertible D], IsUnit (Matrix.fromBlocks A B C D) ↔ IsUnit (A - B * ⅟D * C)

If the bottom-left element of a block matrix is invertible, then the whole matrix is invertible iff the corresponding Schur complement is.

theorem Matrix.isUnit_fromBlocks_iff_of_invertible₁₁ E1 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] {A : Matrix m m α} {B : Matrix m n α} {C : Matrix n m α}
  {D : Matrix n n α} [inst_5 : Invertible A], IsUnit (Matrix.fromBlocks A B C D) ↔ IsUnit (D - C * ⅟A * B)

If the top-right element of a block matrix is invertible, then the whole matrix is invertible iff the corresponding Schur complement is.

theorem Matrix.det_fromBlocks₁₁ E3 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
  (D : Matrix n n α) [inst_5 : Invertible A], (Matrix.fromBlocks A B C D).det = A.det * (D - C * ⅟A * B).det

Determinant of a 2×2 block matrix, expanded around an invertible top left element in terms of the Schur complement.

theorem Matrix.det_fromBlocks_one₁₁ E0 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (B : Matrix m n α) (C : Matrix n m α) (D : Matrix n n α),
  (Matrix.fromBlocks 1 B C D).det = (D - C * B).det

theorem Matrix.det_fromBlocks₂₂ E3 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α)
  (D : Matrix n n α) [inst_5 : Invertible D], (Matrix.fromBlocks A B C D).det = D.det * (A - B * ⅟D * C).det

Determinant of a 2×2 block matrix, expanded around an invertible bottom right element in terms of the Schur complement.

theorem Matrix.det_fromBlocks_one₂₂ E0 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m m α) (B : Matrix m n α) (C : Matrix n m α),
  (Matrix.fromBlocks A B C 1).det = (A - B * C).det

theorem Matrix.det_one_add_mul_comm E3 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m n α) (B : Matrix n m α),
  (1 + A * B).det = (1 + B * A).det

The Weinstein–Aronszajn identity. Note the 1 on the LHS is of shape m×m, while the 1 on the RHS is of shape n×n.

theorem Matrix.det_mul_add_one_comm E2 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m n α) (B : Matrix n m α),
  (A * B + 1).det = (B * A + 1).det

Alternate statement of the Weinstein–Aronszajn identity

theorem Matrix.det_one_sub_mul_comm E1 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] (A : Matrix m n α) (B : Matrix n m α),
  (1 - A * B).det = (1 - B * A).det

theorem Matrix.det_one_add_replicateCol_mul_replicateRow E1 #

∀ {m : Type u_2} {α : Type u_4} [inst : Fintype m] [inst_1 : DecidableEq m] [inst_2 : CommRing α] {ι : Type u_5}
  [inst_3 : Unique ι] (u v : m → α), (1 + Matrix.replicateCol ι u * Matrix.replicateRow ι v).det = 1 + v ⬝ᵥ u

A special case of the Matrix determinant lemma for when A = I.

theorem Matrix.det_add_replicateCol_mul_replicateRow E1 #

∀ {m : Type u_2} {α : Type u_4} [inst : Fintype m] [inst_1 : DecidableEq m] [inst_2 : CommRing α] {ι : Type u_5}
  [inst_3 : Unique ι] {A : Matrix m m α},
  IsUnit A.det →
    ∀ (u v : m → α),
      (A + Matrix.replicateCol ι u * Matrix.replicateRow ι v).det =
        A.det * (1 + Matrix.replicateRow ι v * A⁻¹ * Matrix.replicateCol ι u).det

The Matrix determinant lemma

TODO: show the more general version without hA : IsUnit A.det as (A + replicateCol u * replicateRow v).det = A.det + v ⬝ᵥ (adjugate A) *ᵥ u.

theorem Matrix.det_add_mul E1 #

∀ {m : Type u_2} {n : Type u_3} {α : Type u_4} [inst : Fintype m] [inst_1 : Fintype n] [inst_2 : DecidableEq m]
  [inst_3 : DecidableEq n] [inst_4 : CommRing α] {A : Matrix m m α} (U : Matrix m n α) (V : Matrix n m α),
  IsUnit A.det → (A + U * V).det = A.det * (1 + V * A⁻¹ * U).det

A generalization of the Matrix determinant lemma