# mathlib3documentation

linear_algebra.determinant

# Determinant of families of vectors #

THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.

This file defines the determinant of an endomorphism, and of a family of vectors with respect to some basis. For the determinant of a matrix, see the file linear_algebra.matrix.determinant.

## Main definitions #

In the list below, and in all this file, R is a commutative ring (semiring is sometimes enough), M and its variations are R-modules, ι, κ, n and m are finite types used for indexing.

• basis.det: the determinant of a family of vectors with respect to a basis, as a multilinear map
• linear_map.det: the determinant of an endomorphism f : End R M as a multiplicative homomorphism (if M does not have a finite R-basis, the result is 1 instead)
• linear_equiv.det: the determinant of an isomorphism f : M ≃ₗ[R] M as a multiplicative homomorphism (if M does not have a finite R-basis, the result is 1 instead)

## Tags #

basis, det, determinant

noncomputable def equiv_of_pi_lequiv_pi {m : Type u_6} {n : Type u_7} [fintype m] [fintype n] {R : Type u_1} [comm_ring R] [nontrivial R] (e : (m R) ≃ₗ[R] n R) :
m n

If R^m and R^n are linearly equivalent, then m and n are also equivalent.

Equations
noncomputable def matrix.index_equiv_of_inv {A : Type u_5} [comm_ring A] {m : Type u_6} {n : Type u_7} [fintype m] [fintype n] [nontrivial A] [decidable_eq m] [decidable_eq n] {M : n A} {M' : m A} (hMM' : M.mul M' = 1) (hM'M : M'.mul M = 1) :
m n

If M and M' are each other's inverse matrices, they are square matrices up to equivalence of types.

Equations
theorem matrix.det_comm {A : Type u_5} [comm_ring A] {n : Type u_7} [fintype n] [decidable_eq n] (M N : n A) :
(M.mul N).det = (N.mul M).det
theorem matrix.det_comm' {A : Type u_5} [comm_ring A] {m : Type u_6} {n : Type u_7} [fintype m] [fintype n] [decidable_eq m] [decidable_eq n] {M : m A} {N M' : n A} (hMM' : M.mul M' = 1) (hM'M : M'.mul M = 1) :
(M.mul N).det = (N.mul M).det

If there exists a two-sided inverse M' for M (indexed differently), then det (N ⬝ M) = det (M ⬝ N).

theorem matrix.det_conj_of_mul_eq_one {A : Type u_5} [comm_ring A] {m : Type u_6} {n : Type u_7} [fintype m] [fintype n] [decidable_eq m] [decidable_eq n] {M : n A} {M' : m A} {N : n A} (hMM' : M.mul M' = 1) (hM'M : M'.mul M = 1) :
((M.mul N).mul M').det = N.det

If M' is a two-sided inverse for M (indexed differently), det (M ⬝ N ⬝ M') = det N.

See matrix.det_conj and matrix.det_conj' for the case when M' = M⁻¹ or vice versa.

### Determinant of a linear map #

theorem linear_map.det_to_matrix_eq_det_to_matrix {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] {κ : Type u_6} [fintype κ] [decidable_eq κ] (b : A M) (c : A M) (f : M →ₗ[A] M) :
( b) f).det = ( c) f).det

The determinant of linear_map.to_matrix does not depend on the choice of basis.

@[irreducible]
noncomputable def linear_map.det_aux {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] :
trunc (basis ι A M) (M →ₗ[A] M) →* A

The determinant of an endomorphism given a basis.

See linear_map.det for a version that populates the basis non-computably.

Although the trunc (basis ι A M) parameter makes it slightly more convenient to switch bases, there is no good way to generalize over universe parameters, so we can't fully state in det_aux's type that it does not depend on the choice of basis. Instead you can use the det_aux_def' lemma, or avoid mentioning a basis at all using linear_map.det.

Equations
theorem linear_map.det_aux_def {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] (b : A M) (f : M →ₗ[A] M) :
f = ( b) f).det

Unfold lemma for det_aux.

See also det_aux_def' which allows you to vary the basis.

theorem linear_map.det_aux_def' {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] {ι' : Type u_1} [fintype ι'] [decidable_eq ι'] (tb : trunc (basis ι A M)) (b' : basis ι' A M) (f : M →ₗ[A] M) :
f = ( b') f).det
@[simp]
theorem linear_map.det_aux_id {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] (b : trunc (basis ι A M)) :
@[simp]
theorem linear_map.det_aux_comp {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] (b : trunc (basis ι A M)) (f g : M →ₗ[A] M) :
(f.comp g) = f * g
@[protected, irreducible]
noncomputable def linear_map.det {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] :
(M →ₗ[A] M) →* A

The determinant of an endomorphism independent of basis.

If there is no finite basis on M, the result is 1 instead.

Equations
theorem linear_map.coe_det {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] [decidable_eq M] :
linear_map.det = dite ( (s : finset M), nonempty (basis s A M)) (λ (H : (s : finset M), nonempty (basis s A M)), (linear_map.det_aux (trunc.mk (nonempty.some _)))) (λ (H : ¬ (s : finset M), nonempty (basis s A M)), 1)
theorem linear_map.det_eq_det_to_matrix_of_finset {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] [decidable_eq M] {s : finset M} (b : A M) (f : M →ₗ[A] M) :
= ( b) f).det
@[simp]
theorem linear_map.det_to_matrix {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] (b : A M) (f : M →ₗ[A] M) :
( b) f).det =
@[simp]
theorem linear_map.det_to_matrix' {A : Type u_5} [comm_ring A] {ι : Type u_1} [fintype ι] [decidable_eq ι] (f : A) →ₗ[A] ι A) :
@[simp]
theorem linear_map.det_to_lin {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (b : R M) (f : ι R) :
@[simp]
theorem linear_map.det_to_lin' {R : Type u_1} [comm_ring R] {ι : Type u_4} [decidable_eq ι] [fintype ι] (f : ι R) :
theorem linear_map.det_cases {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] [decidable_eq M] {P : A Prop} (f : M →ₗ[A] M) (hb : (s : finset M) (b : A M), P ( b) f).det) (h1 : P 1) :
P

To show P f.det it suffices to consider P (to_matrix _ _ f).det and P 1.

@[simp]
theorem linear_map.det_comp {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] (f g : M →ₗ[A] M) :
@[simp]
theorem linear_map.det_id {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] :
@[simp]
theorem linear_map.det_smul {𝕜 : Type u_1} [field 𝕜] {M : Type u_2} [ M] (c : 𝕜) (f : M →ₗ[𝕜] M) :

Multiplying a map by a scalar c multiplies its determinant by c ^ dim M.

theorem linear_map.det_zero' {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] {ι : Type u_1} [finite ι] [nonempty ι] (b : A M) :
@[simp]
theorem linear_map.det_zero {𝕜 : Type u_1} [field 𝕜] {M : Type u_2} [ M] :

In a finite-dimensional vector space, the zero map has determinant 1 in dimension 0, and 0 otherwise. We give a formula that also works in infinite dimension, where we define the determinant to be 1.

theorem linear_map.det_eq_one_of_subsingleton {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] [subsingleton M] (f : M →ₗ[R] M) :
theorem linear_map.det_eq_one_of_finrank_eq_zero {𝕜 : Type u_1} [field 𝕜] {M : Type u_2} [ M] (h : = 0) (f : M →ₗ[𝕜] M) :
@[simp]
theorem linear_map.det_conj {M : Type u_2} {A : Type u_5} [comm_ring A] [ M] {N : Type u_1} [ N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :

Conjugating a linear map by a linear equiv does not change its determinant.

theorem linear_map.is_unit_det {M : Type u_2} {A : Type u_1} [comm_ring A] [ M] (f : M →ₗ[A] M) (hf : is_unit f) :

If a linear map is invertible, so is its determinant.

theorem linear_map.finite_dimensional_of_det_ne_one {M : Type u_2} {𝕜 : Type u_1} [field 𝕜] [ M] (f : M →ₗ[𝕜] M) (hf : 1) :

If a linear map has determinant different from 1, then the space is finite-dimensional.

theorem linear_map.range_lt_top_of_det_eq_zero {M : Type u_2} {𝕜 : Type u_1} [field 𝕜] [ M] {f : M →ₗ[𝕜] M} (hf : = 0) :

If the determinant of a map vanishes, then the map is not onto.

theorem linear_map.bot_lt_ker_of_det_eq_zero {M : Type u_2} {𝕜 : Type u_1} [field 𝕜] [ M] {f : M →ₗ[𝕜] M} (hf : = 0) :

If the determinant of a map vanishes, then the map is not injective.

@[protected]
noncomputable def linear_equiv.det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] :
(M ≃ₗ[R] M) →* Rˣ

On a linear_equiv, the domain of linear_map.det can be promoted to Rˣ.

Equations
@[simp]
theorem linear_equiv.coe_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] (f : M ≃ₗ[R] M) :
@[simp]
theorem linear_equiv.coe_inv_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] (f : M ≃ₗ[R] M) :
@[simp]
theorem linear_equiv.det_refl {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] :
@[simp]
theorem linear_equiv.det_trans {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] (f g : M ≃ₗ[R] M) :
@[simp]
theorem linear_equiv.det_symm {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] (f : M ≃ₗ[R] M) :
@[simp]
theorem linear_equiv.det_conj {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] (f : M ≃ₗ[R] M) (e : M ≃ₗ[R] M') :

Conjugating a linear equiv by a linear equiv does not change its determinant.

@[simp]
theorem linear_equiv.det_mul_det_symm {M : Type u_2} {A : Type u_1} [comm_ring A] [ M] (f : M ≃ₗ[A] M) :
= 1

The determinants of a linear_equiv and its inverse multiply to 1.

@[simp]
theorem linear_equiv.det_symm_mul_det {M : Type u_2} {A : Type u_1} [comm_ring A] [ M] (f : M ≃ₗ[A] M) :
= 1

The determinants of a linear_equiv and its inverse multiply to 1.

theorem linear_equiv.is_unit_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] (f : M ≃ₗ[R] M') (v : R M) (v' : R M') :
theorem linear_equiv.is_unit_det' {M : Type u_2} {A : Type u_1} [comm_ring A] [ M] (f : M ≃ₗ[A] M) :

Specialization of linear_equiv.is_unit_det

theorem linear_equiv.det_coe_symm {M : Type u_2} {𝕜 : Type u_1} [field 𝕜] [ M] (f : M ≃ₗ[𝕜] M) :

The determinant of f.symm is the inverse of that of f when f is a linear equiv.

@[simp]
theorem linear_equiv.of_is_unit_det_apply {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] {f : M →ₗ[R] M'} {v : R M} {v' : R M'} (h : is_unit ( v') f).det) (ᾰ : M) :
= f ᾰ
@[simp]
theorem linear_equiv.of_is_unit_det_symm_apply {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] {f : M →ₗ[R] M'} {v : R M} {v' : R M'} (h : is_unit ( v') f).det) (ᾰ : M') :
= ( v) ( v') f)⁻¹)
noncomputable def linear_equiv.of_is_unit_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] {f : M →ₗ[R] M'} {v : R M} {v' : R M'} (h : is_unit ( v') f).det) :
M ≃ₗ[R] M'

Builds a linear equivalence from a linear map whose determinant in some bases is a unit.

Equations
@[simp]
theorem linear_equiv.coe_of_is_unit_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] {f : M →ₗ[R] M'} {v : R M} {v' : R M'} (h : is_unit ( v') f).det) :
@[reducible]
noncomputable def linear_map.equiv_of_det_ne_zero {𝕜 : Type u_1} [field 𝕜] {M : Type u_2} [ M] [ M] (f : M →ₗ[𝕜] M) (hf : 0) :
M ≃ₗ[𝕜] M

Builds a linear equivalence from a linear map on a finite-dimensional vector space whose determinant is nonzero.

Equations
• = have this : , from _,
theorem linear_map.associated_det_of_eq_comp {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] (e : M ≃ₗ[R] M) (f f' : M →ₗ[R] M) (h : (x : M), f x = f' (e x)) :
theorem linear_map.associated_det_comp_equiv {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {N : Type u_3} [ N] (f : N →ₗ[R] M) (e e' : M ≃ₗ[R] N) :
noncomputable def basis.det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) :
R ι

The determinant of a family of vectors with respect to some basis, as an alternating multilinear map.

Equations
theorem basis.det_apply {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) (v : ι M) :
(e.det) v = (e.to_matrix v).det
theorem basis.det_self {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) :
(e.det) e = 1
@[simp]
theorem basis.det_is_empty {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) [is_empty ι] :
e.det =
theorem basis.det_ne_zero {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) [nontrivial R] :
e.det 0

basis.det is not the zero map.

theorem is_basis_iff_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) {v : ι M} :
theorem basis.is_unit_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e e' : R M) :
theorem alternating_map.eq_smul_basis_det {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) (f : R ι) :
f = f e e.det

Any alternating map to R where ι has the cardinality of a basis equals the determinant map with respect to that basis, multiplied by the value of that alternating map on that basis.

@[simp]
theorem alternating_map.map_basis_eq_zero_iff {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_3} [finite ι] (e : R M) (f : R ι) :
f e = 0 f = 0
theorem alternating_map.map_basis_ne_zero_iff {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_3} [finite ι] (e : R M) (f : R ι) :
f e 0 f 0
@[simp]
theorem basis.det_comp {M : Type u_2} {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] (e : A M) (f : M →ₗ[A] M) (v : ι M) :
(e.det) (f v) = * (e.det) v
@[simp]
theorem basis.det_comp_basis {M : Type u_2} {M' : Type u_3} [add_comm_group M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] {A : Type u_5} [comm_ring A] [ M] [ M'] (b : A M) (b' : A M') (f : M →ₗ[A] M') :
theorem basis.det_reindex {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] {ι' : Type u_3} [fintype ι'] [decidable_eq ι'] (b : R M) (v : ι' M) (e : ι ι') :
((b.reindex e).det) v = (b.det) (v e)
theorem basis.det_reindex' {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] {ι' : Type u_3} [fintype ι'] [decidable_eq ι'] (b : R M) (e : ι ι') :
(b.reindex e).det =
theorem basis.det_reindex_symm {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] {ι' : Type u_3} [fintype ι'] [decidable_eq ι'] (b : R M) (v : ι M) (e : ι' ι) :
((b.reindex e.symm).det) (v e) = (b.det) v
@[simp]
theorem basis.det_map {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] (b : R M) (f : M ≃ₗ[R] M') (v : ι M') :
((b.map f).det) v = (b.det) ((f.symm) v)
theorem basis.det_map' {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {M' : Type u_3} [add_comm_group M'] [ M'] {ι : Type u_4} [decidable_eq ι] [fintype ι] (b : R M) (f : M ≃ₗ[R] M') :
@[simp]
theorem pi.basis_fun_det {R : Type u_1} [comm_ring R] {ι : Type u_4} [decidable_eq ι] [fintype ι] :
theorem basis.det_smul_mk_coord_eq_det_update {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) {v : ι M} (hli : v) (hsp : (set.range v)) (i : ι) :
(e.det) v (basis.mk hli hsp).coord i =

If we fix a background basis e, then for any other basis v, we can characterise the coordinates provided by v in terms of determinants relative to e.

theorem basis.det_units_smul {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) (w : ι Rˣ) :
(e.units_smul w).det = (finset.univ.prod (λ (i : ι), w i))⁻¹ e.det

If a basis is multiplied columnwise by scalars w : ι → Rˣ, then the determinant with respect to this basis is multiplied by the product of the inverse of these scalars.

@[simp]
theorem basis.det_units_smul_self {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) (w : ι Rˣ) :
(e.det) (e.units_smul w) = finset.univ.prod (λ (i : ι), (w i))

The determinant of a basis constructed by units_smul is the product of the given units.

@[simp]
theorem basis.det_is_unit_smul {R : Type u_1} [comm_ring R] {M : Type u_2} [ M] {ι : Type u_4} [decidable_eq ι] [fintype ι] (e : R M) {w : ι R} (hw : (i : ι), is_unit (w i)) :
(e.det) (e.is_unit_smul hw) = finset.univ.prod (λ (i : ι), w i)

The determinant of a basis constructed by is_unit_smul is the product of the given units.