The areas / V07. Linear algebra
Mathlib.LinearAlgebra.Matrix.Block
56 declarations and 4 deprecated aliases. Mathlib docs · Source
Block matrices and their determinant
This file defines a predicate Matrix.BlockTriangular saying a matrix
is block triangular, and proves the value of the determinant for various
matrices built out of blocks.
Main definitions
Matrix.BlockTriangularexpresses that anobyomatrix is block triangular, if the rows and columns are ordered according to some orderb : o → αMatrix.IsUpperTriangularandMatrix.IsLowerTriangular, as abbreviations forMatrix.BlockTriangularwith the identity and the dual order, respectively.
Main results
Matrix.BlockTriangular.det: the determinant of a block triangular matrix is equal to the product of the determinants of all the blocksMatrix.det_of_isUpperTriangularandMatrix.det_of_isLowerTriangular: the determinant of a triangular matrix is the product of the entries along the diagonal
Tags
matrix, diagonal, det, block triangular
Determinant
Invertible
def Matrix.BlockTriangular E3 #
{α : Type u_1} → {m : Type u_2} → {R : Type v} → [LT α] → [Zero R] → Matrix m m R → (m → α) → Prop
Let b map rows and columns of a square matrix M to blocks indexed by αs. Then
BlockTriangular M n b says the matrix is block triangular.
abbrev Matrix.IsUpperTriangular E3 #
{m : Type u_2} → {R : Type v} → [Zero R] → [LT m] → Matrix m m R → Prop
M is upper triangular: entries below the diagonal vanish.
abbrev Matrix.IsLowerTriangular E3 #
{m : Type u_2} → {R : Type v} → [Zero R] → [LT m] → Matrix m m R → Prop
M is lower triangular: entries above the diagonal vanish.
def Matrix.IsIndecomposable E1 #
{m : Type u_2} → {R : Type v} → [Zero R] → Matrix m m R → Prop
A matrix is indecomposable if it cannot be reindexed to block-triangular form.
theorem Matrix.BlockTriangular.submatrix E0 #
∀ {α : Type u_1} {m : Type u_2} {n : Type u_3} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : LT α]
[inst_1 : Zero R] {f : n → m}, M.BlockTriangular b → (M.submatrix f f).BlockTriangular (b ∘ f)
theorem Matrix.blockTriangular_reindex_iff E0 #
∀ {α : Type u_1} {m : Type u_2} {n : Type u_3} {R : Type v} {M : Matrix m m R} [inst : LT α] [inst_1 : Zero R]
{b : n → α} {e : m ≃ n}, ((Matrix.reindex e e) M).BlockTriangular b ↔ M.BlockTriangular (b ∘ ⇑e)
theorem Matrix.BlockTriangular.transpose E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : LT α] [inst_1 : Zero R],
M.BlockTriangular b → M.transpose.BlockTriangular (⇑OrderDual.toDual ∘ b)
theorem Matrix.blockTriangular_transpose_iff E0 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} [inst : LT α] [inst_1 : Zero R] {b : m → αᵒᵈ},
M.transpose.BlockTriangular b ↔ M.BlockTriangular (⇑OrderDual.ofDual ∘ b)
theorem Matrix.blockTriangular_zero E0 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : LT α] [inst_1 : Zero R], Matrix.BlockTriangular 0 b
instance Matrix.decidableBlockTriangular E0 #
{α : Type u_1} →
{m : Type u_2} →
{R : Type v} →
{M : Matrix m m R} →
{b : m → α} →
[inst : LT α] →
[inst_1 : Zero R] → [DecidableEq R] → [Fintype m] → [DecidableLT α] → Decidable (M.BlockTriangular b)
theorem Matrix.BlockTriangular.neg E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : LT α] [inst_1 : NegZeroClass R] {M : Matrix m m R},
M.BlockTriangular b → (-M).BlockTriangular b
theorem Matrix.BlockTriangular.add E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M N : Matrix m m R} {b : m → α} [inst : LT α] [inst_1 : AddZeroClass R],
M.BlockTriangular b → N.BlockTriangular b → (M + N).BlockTriangular b
theorem Matrix.BlockTriangular.sub E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M N : Matrix m m R} {b : m → α} [inst : LT α]
[inst_1 : SubNegZeroMonoid R], M.BlockTriangular b → N.BlockTriangular b → (M - N).BlockTriangular b
theorem Matrix.BlockTriangular.add_iff_right E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M N : Matrix m m R} {b : m → α} [inst : LT α] [inst_1 : AddGroup R],
M.BlockTriangular b → ((M + N).BlockTriangular b ↔ N.BlockTriangular b)
theorem Matrix.BlockTriangular.add_iff_left E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M N : Matrix m m R} {b : m → α} [inst : LT α] [inst_1 : AddGroup R],
N.BlockTriangular b → ((M + N).BlockTriangular b ↔ M.BlockTriangular b)
theorem Matrix.BlockTriangular.sub_iff_right E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M N : Matrix m m R} {b : m → α} [inst : LT α] [inst_1 : AddGroup R],
M.BlockTriangular b → ((M - N).BlockTriangular b ↔ N.BlockTriangular b)
theorem Matrix.BlockTriangular.sub_iff_left E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M N : Matrix m m R} {b : m → α} [inst : LT α] [inst_1 : AddGroup R],
N.BlockTriangular b → ((M - N).BlockTriangular b ↔ M.BlockTriangular b)
theorem Matrix.BlockTriangular.map E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : LT α] {S : Type u_6} {F : Type u_7}
[inst_1 : FunLike F R S] [inst_2 : Zero R] [inst_3 : Zero S] [ZeroHomClass F R S] (f : F),
M.BlockTriangular b → (M.map ⇑f).BlockTriangular b
theorem Matrix.BlockTriangular.comp E1 #
∀ {α : Type u_1} {m : Type u_2} {n : Type u_3} {R : Type v} {b : m → α} [inst : LT α] [inst_1 : Zero R]
{M : Matrix m m (Matrix n n R)}, M.BlockTriangular b → ((Matrix.comp m m n n R) M).BlockTriangular fun i ↦ b i.1
theorem Matrix.blockTriangular_diagonal E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : Preorder α] [inst_1 : Zero R] [inst_2 : DecidableEq m]
(d : m → R), (Matrix.diagonal d).BlockTriangular b
theorem Matrix.blockTriangular_blockDiagonal' E1 #
∀ {α : Type u_1} {m' : α → Type u_4} {R : Type v} [inst : Preorder α] [inst_1 : Zero R] [inst_2 : DecidableEq α]
(d : (i : α) → Matrix (m' i) (m' i) R), (Matrix.blockDiagonal' d).BlockTriangular Sigma.fst
theorem Matrix.blockTriangular_blockDiagonal E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} [inst : Preorder α] [inst_1 : Zero R] [inst_2 : DecidableEq α]
(d : α → Matrix m m R), (Matrix.blockDiagonal d).BlockTriangular Prod.snd
theorem Matrix.blockTriangular_one E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : Preorder α] [inst_1 : Zero R] [inst_2 : DecidableEq m]
[inst_3 : One R], Matrix.BlockTriangular 1 b
theorem Matrix.blockTriangular_single E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : Preorder α] [inst_1 : Zero R] [inst_2 : DecidableEq m]
{i j : m}, b i ≤ b j → ∀ (c : R), (Matrix.single i j c).BlockTriangular b
theorem Matrix.blockTriangular_single' E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : Preorder α] [inst_1 : Zero R] [inst_2 : DecidableEq m]
{i j : m}, b j ≤ b i → ∀ (c : R), (Matrix.single i j c).BlockTriangular (⇑OrderDual.toDual ∘ b)
theorem Matrix.blockTriangular_transvection E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : Preorder α] [inst_1 : CommRing R]
[inst_2 : DecidableEq m] {i j : m}, b i ≤ b j → ∀ (c : R), (Matrix.transvection i j c).BlockTriangular b
theorem Matrix.blockTriangular_transvection' E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : Preorder α] [inst_1 : CommRing R]
[inst_2 : DecidableEq m] {i j : m},
b j ≤ b i → ∀ (c : R), (Matrix.transvection i j c).BlockTriangular (⇑OrderDual.toDual ∘ b)
theorem Matrix.BlockTriangular.mul E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : LinearOrder α] [inst_1 : Fintype m]
[inst_2 : NonUnitalNonAssocSemiring R] {M N : Matrix m m R},
M.BlockTriangular b → N.BlockTriangular b → (M * N).BlockTriangular b
def Matrix.blockTriangularSubsemiring E1 #
{α : Type u_1} →
{m : Type u_2} →
(R : Type v) →
(m → α) →
[LinearOrder α] →
[inst : DecidableEq m] → [inst_1 : Fintype m] → [inst_2 : Semiring R] → Subsemiring (Matrix m m R)
BlockTriangular matrices form a subsemiring.
theorem Matrix.coe_blockTriangularSubsemiring E0 #
∀ {α : Type u_1} {m : Type u_2} (R : Type v) (b : m → α) [inst : LinearOrder α] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : Semiring R], ↑(Matrix.blockTriangularSubsemiring R b) = {M | M.BlockTriangular b}
theorem Matrix.mem_blockTriangularSubsemiring E0 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {b : m → α} [inst : LinearOrder α] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : Semiring R] {M : Matrix m m R},
M ∈ Matrix.blockTriangularSubsemiring R b ↔ M.BlockTriangular b
theorem Matrix.BlockTriangular.pow E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : LinearOrder α]
[inst_1 : DecidableEq m] [inst_2 : Fintype m] [inst_3 : Semiring R],
M.BlockTriangular b → ∀ (n : ℕ), (M ^ n).BlockTriangular b
theorem Matrix.blockTriangular_algebraMap E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {A : Type u_5} {b : m → α} [inst : LinearOrder α] [inst_1 : CommSemiring R]
[inst_2 : Semiring A] [inst_3 : Algebra R A] [inst_4 : DecidableEq m] [inst_5 : Fintype m] (r : R),
((algebraMap R (Matrix m m A)) r).BlockTriangular b
def Matrix.blockTriangularSubalgebra E1 #
{α : Type u_1} →
{m : Type u_2} →
(R : Type v) →
(A : Type u_5) →
(m → α) →
[LinearOrder α] →
[inst : CommSemiring R] →
[inst_1 : Semiring A] →
[inst_2 : Algebra R A] → [inst_3 : DecidableEq m] → [inst_4 : Fintype m] → Subalgebra R (Matrix m m A)
BlockTriangular matrices form a subalgebra.
theorem Matrix.mem_blockTriangularSubalgebra E0 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {A : Type u_5} {b : m → α} [inst : LinearOrder α] [inst_1 : CommSemiring R]
[inst_2 : Semiring A] [inst_3 : Algebra R A] [inst_4 : DecidableEq m] [inst_5 : Fintype m] {M : Matrix m m A},
M ∈ Matrix.blockTriangularSubalgebra R A b ↔ M.BlockTriangular b
theorem Matrix.isIndecomposable_iff_blockTriangular_const E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} [inst : LinearOrder α] [Nontrivial α] [Finite m] [inst_3 : Zero R]
(M : Matrix m m R), M.IsIndecomposable ↔ ∀ (b : m → α), M.BlockTriangular b → ∃ a, b = Function.const m a
theorem Matrix.isIndecomposable_iff_reflTransGen E1 #
∀ {m : Type u_2} {R : Type v} [Finite m] [inst : Zero R] (M : Matrix m m R),
M.IsIndecomposable ↔ ∀ (i j : m), Relation.ReflTransGen (fun i j ↦ M i j ≠ 0) i j
theorem Matrix.upper_two_blockTriangular E1 #
∀ {α : Type u_1} {m : Type u_2} {n : Type u_3} {R : Type v} [inst : Zero R] [inst_1 : Preorder α] (A : Matrix m m R)
(B : Matrix m n R) (D : Matrix n n R) {a b : α},
a < b → (Matrix.fromBlocks A B 0 D).BlockTriangular (Sum.elim (fun x ↦ a) fun x ↦ b)
theorem Matrix.equiv_block_det E1 #
∀ {m : Type u_2} {R : Type v} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m] (M : Matrix m m R)
{p q : m → Prop} [inst_3 : DecidablePred p] [inst_4 : DecidablePred q],
(∀ (x : m), q x ↔ p x) → (M.toSquareBlockProp p).det = (M.toSquareBlockProp q).det
theorem Matrix.det_toSquareBlock_id E1 #
∀ {m : Type u_2} {R : Type v} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m] (M : Matrix m m R)
(i : m), (M.toSquareBlock id i).det = M i i
theorem Matrix.det_toBlock E1 #
∀ {m : Type u_2} {R : Type v} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m] (M : Matrix m m R)
(p : m → Prop) [inst_3 : DecidablePred p],
M.det =
(Matrix.fromBlocks (M.toBlock p p) (M.toBlock p fun j ↦ ¬p j) (M.toBlock (fun j ↦ ¬p j) p)
(M.toBlock (fun j ↦ ¬p j) fun j ↦ ¬p j)).det
theorem Matrix.twoBlockTriangular_det E1 #
∀ {m : Type u_2} {R : Type v} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m] (M : Matrix m m R)
(p : m → Prop) [inst_3 : DecidablePred p],
(∀ (i : m), ¬p i → ∀ (j : m), p j → M i j = 0) →
M.det = (M.toSquareBlockProp p).det * (M.toSquareBlockProp fun i ↦ ¬p i).det
theorem Matrix.twoBlockTriangular_det' E1 #
∀ {m : Type u_2} {R : Type v} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m] (M : Matrix m m R)
(p : m → Prop) [inst_3 : DecidablePred p],
(∀ (i : m), p i → ∀ (j : m), ¬p j → M i j = 0) →
M.det = (M.toSquareBlockProp p).det * (M.toSquareBlockProp fun i ↦ ¬p i).det
theorem Matrix.BlockTriangular.det E3 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : CommRing R] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : DecidableEq α] [inst_4 : LinearOrder α],
M.BlockTriangular b → M.det = ∏ a ∈ Finset.image b Finset.univ, (M.toSquareBlock b a).det
theorem Matrix.BlockTriangular.det_fintype E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : CommRing R] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : DecidableEq α] [inst_4 : Fintype α] [inst_5 : LinearOrder α],
M.BlockTriangular b → M.det = ∏ k, (M.toSquareBlock b k).det
theorem Matrix.det_of_isUpperTriangular E3 #
∀ {m : Type u_2} {R : Type v} {M : Matrix m m R} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m]
[inst_3 : LinearOrder m], M.IsUpperTriangular → M.det = ∏ i, M i i
theorem Matrix.det_of_isLowerTriangular E3 #
∀ {m : Type u_2} {R : Type v} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m] [inst_3 : LinearOrder m]
(M : Matrix m m R), M.IsLowerTriangular → M.det = ∏ i, M i i
theorem Matrix.IsUpperTriangular.det_ne_zero_iff E0 #
∀ {m : Type u_2} {R : Type v} {M : Matrix m m R} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m]
[inst_3 : LinearOrder m] [IsDomain R], M.IsUpperTriangular → (M.det ≠ 0 ↔ ∀ (i : m), M.diag i ≠ 0)
theorem Matrix.IsLowerTriangular.det_ne_zero_iff E0 #
∀ {m : Type u_2} {R : Type v} {M : Matrix m m R} [inst : CommRing R] [inst_1 : DecidableEq m] [inst_2 : Fintype m]
[inst_3 : LinearOrder m] [IsDomain R], M.IsLowerTriangular → (M.det ≠ 0 ↔ ∀ (i : m), M.diag i ≠ 0)
theorem Matrix.matrixOfPolynomials_isUpperTriangular E1 #
∀ {R : Type u_6} [inst : Semiring R] {n : ℕ} (p : Fin n → Polynomial R),
(∀ (i : Fin n), (p i).natDegree ≤ ↑i) → (Matrix.of fun i j ↦ (p j).coeff ↑i).IsUpperTriangular
theorem Matrix.det_matrixOfPolynomials E1 #
∀ {R : Type v} [inst : CommRing R] {n : ℕ} (p : Fin n → Polynomial R),
(∀ (i : Fin n), (p i).natDegree = ↑i) → (∀ (i : Fin n), (p i).Monic) → (Matrix.of fun i j ↦ (p j).coeff ↑i).det = 1
theorem Matrix.BlockTriangular.toBlock_inverse_mul_toBlock_eq_one E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : CommRing R] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : LinearOrder α] [Invertible M],
M.BlockTriangular b →
∀ (k : α), ((M⁻¹.toBlock (fun i ↦ b i < k) fun i ↦ b i < k) * M.toBlock (fun i ↦ b i < k) fun i ↦ b i < k) = 1
theorem Matrix.BlockTriangular.inv_toBlock E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : CommRing R] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : LinearOrder α] [Invertible M],
M.BlockTriangular b →
∀ (k : α), (M.toBlock (fun i ↦ b i < k) fun i ↦ b i < k)⁻¹ = M⁻¹.toBlock (fun i ↦ b i < k) fun i ↦ b i < k
The inverse of an upper-left subblock of a block-triangular matrix M is the upper-left
subblock of M⁻¹.
def Matrix.BlockTriangular.invertibleToBlock E1 #
{α : Type u_1} →
{m : Type u_2} →
{R : Type v} →
{M : Matrix m m R} →
{b : m → α} →
[inst : CommRing R] →
[inst_1 : DecidableEq m] →
[inst_2 : Fintype m] →
[inst_3 : LinearOrder α] →
[Invertible M] →
M.BlockTriangular b → (k : α) → Invertible (M.toBlock (fun i ↦ b i < k) fun i ↦ b i < k)
An upper-left subblock of an invertible block-triangular matrix is invertible.
theorem Matrix.toBlock_inverse_eq_zero E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : CommRing R] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : LinearOrder α] [Invertible M],
M.BlockTriangular b → ∀ (k : α), (M⁻¹.toBlock (fun i ↦ k ≤ b i) fun i ↦ b i < k) = 0
A lower-left subblock of the inverse of a block-triangular matrix is zero. This is a first step
towards BlockTriangular.inv_toBlock below.
theorem Matrix.blockTriangular_inv_of_blockTriangular E1 #
∀ {α : Type u_1} {m : Type u_2} {R : Type v} {M : Matrix m m R} {b : m → α} [inst : CommRing R] [inst_1 : DecidableEq m]
[inst_2 : Fintype m] [inst_3 : LinearOrder α] [Invertible M], M.BlockTriangular b → M⁻¹.BlockTriangular b
The inverse of a block-triangular matrix is block-triangular.
Deprecated aliases
| Name | New name | Since |
|---|---|---|
Matrix.det_of_blockTriangular | Matrix.BlockTriangular.det | 2026-08-31 |
Matrix.det_of_lowerTriangular | Matrix.det_of_isLowerTriangular | 2026-07-30 |
Matrix.det_of_upperTriangular | Matrix.det_of_isUpperTriangular | 2026-07-30 |
Matrix.matrixOfPolynomials_blockTriangular | Matrix.matrixOfPolynomials_isUpperTriangular | 2026-08-31 |