Determinant of a matrix #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines the determinant of a matrix, matrix.det
, and its essential properties.
Main definitions #
matrix.det
: the determinant of a square matrix, as a sum over permutationsmatrix.det_row_alternating
: the determinant, as analternating_map
in the rows of the matrix
Main results #
det_mul
: the determinant ofA ⬝ B
is the product of determinantsdet_zero_of_row_eq
: the determinant is zero if there is a repeated rowdet_block_diagonal
: the determinant of a block diagonal matrix is a product of the blocks' determinants
Implementation notes #
It is possible to configure simp
to compute determinants. See the file
test/matrix.lean
for some examples.
det
is an alternating_map
in the rows of the matrix.
The determinant of a matrix given by the Leibniz formula.
If n
has only one element, the determinant of an n
by n
matrix is just that element.
Although unique
implies decidable_eq
and fintype
, the instances might
not be syntactically equal. Thus, we need to fill in the args explicitly.
The determinant of a matrix, as a monoid homomorphism.
Equations
- matrix.det_monoid_hom = {to_fun := matrix.det _inst_5, map_one' := _, map_mul' := _}
Permuting the columns changes the sign of the determinant.
Permuting rows and columns with the same equivalence has no effect.
Reindexing both indices along the same equivalence preserves the determinant.
For the simp
version of this lemma, see det_submatrix_equiv_self
; this one is unsuitable because
matrix.reindex_apply
unfolds reindex
first.
The determinant of a permutation matrix equals its sign.
A variant of matrix.det_neg
with scalar multiplication by units ℤ
instead of multiplication
by R
.
Multiplying each row by a fixed v i
multiplies the determinant by
the product of the v
s.
Multiplying each column by a fixed v j
multiplies the determinant by
the product of the v
s.
det_zero
section #
Prove that a matrix with a repeated column has determinant equal to zero.
det_eq
section #
Lemmas showing the determinant is invariant under a variety of operations.
If you add multiples of row B k
to other rows, the determinant doesn't change.
If you add multiples of previous rows to the next row, the determinant doesn't change.
If you add multiples of previous columns to the next columns, the determinant doesn't change.
The determinant of a 2×2 block matrix with the lower-left block equal to zero is the product of
the determinants of the diagonal blocks. For the generalization to any number of blocks, see
matrix.det_of_upper_triangular
.
The determinant of a 2×2 block matrix with the upper-right block equal to zero is the product of
the determinants of the diagonal blocks. For the generalization to any number of blocks, see
matrix.det_of_lower_triangular
.