# Determinant of families of vectors #

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 LinearAlgebra.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
• LinearMap.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)
• LinearEquiv.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

def equivOfPiLEquivPi {m : Type u_6} {n : Type u_7} {R : Type u_8} [] [] [] [] (e : (mR) ≃ₗ[R] nR) :
m n

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

Equations
Instances For
def Matrix.indexEquivOfInv {A : Type u_5} [] {m : Type u_6} {n : Type u_7} [] [] [] [] [] {M : Matrix m n A} {M' : Matrix n m A} (hMM' : M * M' = 1) (hM'M : M' * M = 1) :
m n

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

Equations
Instances For
theorem Matrix.det_comm {A : Type u_5} [] {n : Type u_7} [] [] (M : Matrix n n A) (N : Matrix n n A) :
(M * N).det = (N * M).det
theorem Matrix.det_comm' {A : Type u_5} [] {m : Type u_6} {n : Type u_7} [] [] [] [] {M : Matrix n m A} {N : Matrix m n A} {M' : Matrix m n A} (hMM' : M * M' = 1) (hM'M : M' * M = 1) :
(M * N).det = (N * 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} [] {m : Type u_6} {n : Type u_7} [] [] [] [] {M : Matrix m n A} {M' : Matrix n m A} {N : Matrix n n A} (hMM' : M * M' = 1) (hM'M : M' * M = 1) :
(M * N * 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 LinearMap.det_toMatrix_eq_det_toMatrix {M : Type u_2} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] {κ : Type u_6} [] [] (b : Basis ι A M) (c : Basis κ A M) (f : M →ₗ[A] M) :
(() f).det = (() f).det

The determinant of LinearMap.toMatrix does not depend on the choice of basis.

theorem LinearMap.detAux_def {M : Type u_7} [] {ι : Type u_8} [] [] {A : Type u_9} [] [Module A M] :
LinearMap.detAux = Trunc.lift (fun (b : Basis ι A M) => Matrix.detMonoidHom.comp )
@[irreducible]
def LinearMap.detAux {M : Type u_7} [] {ι : Type u_8} [] [] {A : Type u_9} [] [Module A M] :
Trunc (Basis ι A M)(M →ₗ[A] M) →* A

The determinant of an endomorphism given a basis.

See LinearMap.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 detAux's type that it does not depend on the choice of basis. Instead you can use the detAux_def'' lemma, or avoid mentioning a basis at all using LinearMap.det.

Equations
Instances For
theorem LinearMap.detAux_def' {M : Type u_2} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] (b : Basis ι A M) (f : M →ₗ[A] M) :
() f = (() f).det

Unfold lemma for detAux.

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

theorem LinearMap.detAux_def'' {M : Type u_2} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] {ι' : Type u_7} [Fintype ι'] [] (tb : Trunc (Basis ι A M)) (b' : Basis ι' A M) (f : M →ₗ[A] M) :
() f = (() f).det
@[simp]
theorem LinearMap.detAux_id {M : Type u_2} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] (b : Trunc (Basis ι A M)) :
() LinearMap.id = 1
@[simp]
theorem LinearMap.detAux_comp {M : Type u_2} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] (b : Trunc (Basis ι A M)) (f : M →ₗ[A] M) (g : M →ₗ[A] M) :
() (f ∘ₗ g) = () f * () g
theorem LinearMap.det_def {M : Type u_7} [] {A : Type u_8} [] [Module A M] :
LinearMap.det = if H : ∃ (s : ), Nonempty (Basis { x : M // x s } A M) then LinearMap.detAux (Trunc.mk .some) else 1
@[irreducible]
def LinearMap.det {M : Type u_7} [] {A : Type u_8} [] [Module 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
Instances For
theorem LinearMap.coe_det {M : Type u_2} [] {A : Type u_5} [] [Module A M] [] :
LinearMap.det = (if H : ∃ (s : ), Nonempty (Basis { x : M // x s } A M) then LinearMap.detAux (Trunc.mk .some) else 1)
theorem LinearMap.det_eq_det_toMatrix_of_finset {M : Type u_2} [] {A : Type u_5} [] [Module A M] [] {s : } (b : Basis { x : M // x s } A M) (f : M →ₗ[A] M) :
LinearMap.det f = (() f).det
@[simp]
theorem LinearMap.det_toMatrix {M : Type u_2} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] (b : Basis ι A M) (f : M →ₗ[A] M) :
(() f).det = LinearMap.det f
@[simp]
theorem LinearMap.det_toMatrix' {A : Type u_5} [] {ι : Type u_7} [] [] (f : (ιA) →ₗ[A] ιA) :
(LinearMap.toMatrix' f).det = LinearMap.det f
@[simp]
theorem LinearMap.det_toLin {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (b : Basis ι R M) (f : Matrix ι ι R) :
LinearMap.det (() f) = f.det
@[simp]
theorem LinearMap.det_toLin' {R : Type u_1} [] {ι : Type u_4} [] [] (f : Matrix ι ι R) :
LinearMap.det (Matrix.toLin' f) = f.det
theorem LinearMap.det_cases {M : Type u_2} [] {A : Type u_5} [] [Module A M] [] {P : AProp} (f : M →ₗ[A] M) (hb : ∀ (s : ) (b : Basis { x : M // x s } A M), P (() f).det) (h1 : P 1) :
P (LinearMap.det f)

To show P (LinearMap.det f) it suffices to consider P (Matrix.det (toMatrix _ _ f)) and P 1.

@[simp]
theorem LinearMap.det_comp {M : Type u_2} [] {A : Type u_5} [] [Module A M] (f : M →ₗ[A] M) (g : M →ₗ[A] M) :
LinearMap.det (f ∘ₗ g) = LinearMap.det f * LinearMap.det g
@[simp]
theorem LinearMap.det_id {M : Type u_2} [] {A : Type u_5} [] [Module A M] :
LinearMap.det LinearMap.id = 1
@[simp]
theorem LinearMap.det_smul {𝕜 : Type u_7} [] {M : Type u_8} [] [Module 𝕜 M] (c : 𝕜) (f : M →ₗ[𝕜] M) :
LinearMap.det (c f) = * LinearMap.det f

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

theorem LinearMap.det_zero' {M : Type u_2} [] {A : Type u_5} [] [Module A M] {ι : Type u_7} [] [] (b : Basis ι A M) :
LinearMap.det 0 = 0
@[simp]
theorem LinearMap.det_zero {𝕜 : Type u_7} [] {M : Type u_8} [] [Module 𝕜 M] :
LinearMap.det 0 =

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 LinearMap.det_eq_one_of_subsingleton {R : Type u_1} [] {M : Type u_2} [] [Module R M] [] (f : M →ₗ[R] M) :
LinearMap.det f = 1
theorem LinearMap.det_eq_one_of_finrank_eq_zero {𝕜 : Type u_7} [] {M : Type u_8} [] [Module 𝕜 M] (h : ) (f : M →ₗ[𝕜] M) :
LinearMap.det f = 1
@[simp]
theorem LinearMap.det_conj {M : Type u_2} [] {A : Type u_5} [] [Module A M] {N : Type u_7} [] [Module A N] (f : M →ₗ[A] M) (e : M ≃ₗ[A] N) :
LinearMap.det (e ∘ₗ f ∘ₗ e.symm) = LinearMap.det f

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

theorem LinearMap.isUnit_det {M : Type u_2} [] {A : Type u_7} [] [Module A M] (f : M →ₗ[A] M) (hf : ) :
IsUnit (LinearMap.det f)

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

theorem LinearMap.finiteDimensional_of_det_ne_one {M : Type u_2} [] {𝕜 : Type u_7} [] [Module 𝕜 M] (f : M →ₗ[𝕜] M) (hf : LinearMap.det f 1) :

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

theorem LinearMap.range_lt_top_of_det_eq_zero {M : Type u_2} [] {𝕜 : Type u_7} [] [Module 𝕜 M] {f : M →ₗ[𝕜] M} (hf : LinearMap.det f = 0) :

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

theorem LinearMap.bot_lt_ker_of_det_eq_zero {M : Type u_2} [] {𝕜 : Type u_7} [] [Module 𝕜 M] {f : M →ₗ[𝕜] M} (hf : LinearMap.det f = 0) :

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

@[irreducible]
def LinearEquiv.det {R : Type u_1} [] {M : Type u_2} [] [Module R M] :
(M ≃ₗ[R] M) →* Rˣ

On a LinearEquiv, the domain of LinearMap.det can be promoted to Rˣ.

Equations
• LinearEquiv.det = (Units.map LinearMap.det).comp .toMonoidHom
Instances For
@[simp]
theorem LinearEquiv.coe_det {R : Type u_1} [] {M : Type u_2} [] [Module R M] (f : M ≃ₗ[R] M) :
(LinearEquiv.det f) = LinearMap.det f
@[simp]
theorem LinearEquiv.coe_inv_det {R : Type u_1} [] {M : Type u_2} [] [Module R M] (f : M ≃ₗ[R] M) :
(LinearEquiv.det f)⁻¹ = LinearMap.det f.symm
@[simp]
theorem LinearEquiv.det_refl {R : Type u_1} [] {M : Type u_2} [] [Module R M] :
LinearEquiv.det () = 1
@[simp]
theorem LinearEquiv.det_trans {R : Type u_1} [] {M : Type u_2} [] [Module R M] (f : M ≃ₗ[R] M) (g : M ≃ₗ[R] M) :
LinearEquiv.det (f ≪≫ₗ g) = LinearEquiv.det g * LinearEquiv.det f
@[simp]
theorem LinearEquiv.det_symm {R : Type u_1} [] {M : Type u_2} [] [Module R M] (f : M ≃ₗ[R] M) :
LinearEquiv.det f.symm = LinearEquiv.det f⁻¹
@[simp]
theorem LinearEquiv.det_conj {R : Type u_1} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] (f : M ≃ₗ[R] M) (e : M ≃ₗ[R] M') :
LinearEquiv.det (e.symm ≪≫ₗ f ≪≫ₗ e) = LinearEquiv.det f

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

@[simp]
theorem LinearEquiv.det_mul_det_symm {M : Type u_2} [] {A : Type u_5} [] [Module A M] (f : M ≃ₗ[A] M) :
LinearMap.det f * LinearMap.det f.symm = 1

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

@[simp]
theorem LinearEquiv.det_symm_mul_det {M : Type u_2} [] {A : Type u_5} [] [Module A M] (f : M ≃ₗ[A] M) :
LinearMap.det f.symm * LinearMap.det f = 1

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

theorem LinearEquiv.isUnit_det {R : Type u_1} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] {ι : Type u_4} [] [] (f : M ≃ₗ[R] M') (v : Basis ι R M) (v' : Basis ι R M') :
IsUnit (() f).det
theorem LinearEquiv.isUnit_det' {M : Type u_2} [] {A : Type u_5} [] [Module A M] (f : M ≃ₗ[A] M) :
IsUnit (LinearMap.det f)

Specialization of LinearEquiv.isUnit_det

theorem LinearEquiv.det_coe_symm {M : Type u_2} [] {𝕜 : Type u_5} [] [Module 𝕜 M] (f : M ≃ₗ[𝕜] M) :
LinearMap.det f.symm = (LinearMap.det f)⁻¹

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

@[simp]
theorem LinearEquiv.ofIsUnitDet_apply {R : Type u_1} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] {ι : Type u_4} [] [] {f : M →ₗ[R] M'} {v : Basis ι R M} {v' : Basis ι R M'} (h : IsUnit (() f).det) (a : M) :
= f a
@[simp]
theorem LinearEquiv.ofIsUnitDet_symm_apply {R : Type u_1} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] {ι : Type u_4} [] [] {f : M →ₗ[R] M'} {v : Basis ι R M} {v' : Basis ι R M'} (h : IsUnit (() f).det) (a : M') :
.symm a = ((Matrix.toLin v' v) (() f)⁻¹) a
def LinearEquiv.ofIsUnitDet {R : Type u_1} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] {ι : Type u_4} [] [] {f : M →ₗ[R] M'} {v : Basis ι R M} {v' : Basis ι R M'} (h : IsUnit (() f).det) :
M ≃ₗ[R] M'

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

Equations
• = { toFun := f, map_add' := , map_smul' := , invFun := ((Matrix.toLin v' v) (() f)⁻¹), left_inv := , right_inv := }
Instances For
@[simp]
theorem LinearEquiv.coe_ofIsUnitDet {R : Type u_1} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] {ι : Type u_4} [] [] {f : M →ₗ[R] M'} {v : Basis ι R M} {v' : Basis ι R M'} (h : IsUnit (() f).det) :
= f
@[reducible, inline]
abbrev LinearMap.equivOfDetNeZero {𝕜 : Type u_5} [] {M : Type u_6} [] [Module 𝕜 M] [] (f : M →ₗ[𝕜] M) (hf : LinearMap.det f 0) :
M ≃ₗ[𝕜] M

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

Equations
• f.equivOfDetNeZero hf = let_fun this := ;
Instances For
theorem LinearMap.associated_det_of_eq_comp {R : Type u_1} [] {M : Type u_2} [] [Module R M] (e : M ≃ₗ[R] M) (f : M →ₗ[R] M) (f' : M →ₗ[R] M) (h : ∀ (x : M), f x = f' (e x)) :
Associated (LinearMap.det f) (LinearMap.det f')
theorem LinearMap.associated_det_comp_equiv {R : Type u_1} [] {M : Type u_2} [] [Module R M] {N : Type u_5} [] [Module R N] (f : N →ₗ[R] M) (e : M ≃ₗ[R] N) (e' : M ≃ₗ[R] N) :
Associated (LinearMap.det (f ∘ₗ e)) (LinearMap.det (f ∘ₗ e'))
def Basis.det {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) :

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

Equations
• e.det = { toFun := fun (v : ιM) => (e.toMatrix v).det, map_add' := , map_smul' := , map_eq_zero_of_eq' := }
Instances For
theorem Basis.det_apply {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) (v : ιM) :
e.det v = (e.toMatrix v).det
theorem Basis.det_self {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) :
e.det e = 1
@[simp]
theorem Basis.det_isEmpty {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) [] :
e.det =
theorem Basis.det_ne_zero {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) [] :
e.det 0

Basis.det is not the zero map.

theorem is_basis_iff_det {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) {v : ιM} :
= IsUnit (e.det v)
theorem Basis.isUnit_det {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) (e' : Basis ι R M) :
IsUnit (e.det e')
theorem AlternatingMap.eq_smul_basis_det {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) (f : M [⋀^ι]→ₗ[R] 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 AlternatingMap.map_basis_eq_zero_iff {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_5} [] (e : Basis ι R M) (f : M [⋀^ι]→ₗ[R] R) :
f e = 0 f = 0
theorem AlternatingMap.map_basis_ne_zero_iff {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_5} [] (e : Basis ι R M) (f : M [⋀^ι]→ₗ[R] R) :
f e 0 f 0
@[simp]
theorem Basis.det_comp {M : Type u_2} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] (e : Basis ι A M) (f : M →ₗ[A] M) (v : ιM) :
e.det (f v) = LinearMap.det f * e.det v
@[simp]
theorem Basis.det_comp_basis {M : Type u_2} [] {M' : Type u_3} [] {ι : Type u_4} [] [] {A : Type u_5} [] [Module A M] [Module A M'] (b : Basis ι A M) (b' : Basis ι A M') (f : M →ₗ[A] M') :
b'.det (f b) = LinearMap.det (f ∘ₗ (b'.equiv b ()))
theorem Basis.det_reindex {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] {ι' : Type u_6} [Fintype ι'] [] (b : Basis ι R M) (v : ι'M) (e : ι ι') :
(b.reindex e).det v = b.det (v e)
theorem Basis.det_reindex' {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] {ι' : Type u_6} [Fintype ι'] [] (b : Basis ι R M) (e : ι ι') :
(b.reindex e).det =
theorem Basis.det_reindex_symm {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] {ι' : Type u_6} [Fintype ι'] [] (b : Basis ι R M) (v : ιM) (e : ι' ι) :
(b.reindex e.symm).det (v e) = b.det v
@[simp]
theorem Basis.det_map {R : Type u_1} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] {ι : Type u_4} [] [] (b : Basis ι 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} [] {M : Type u_2} [] [Module R M] {M' : Type u_3} [] [Module R M'] {ι : Type u_4} [] [] (b : Basis ι R M) (f : M ≃ₗ[R] M') :
(b.map f).det = b.det.compLinearMap f.symm
@[simp]
theorem Pi.basisFun_det {R : Type u_1} [] {ι : Type u_4} [] [] :
().det = Matrix.detRowAlternating
theorem Basis.det_smul_mk_coord_eq_det_update {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) {v : ιM} (hli : ) (hsp : ) (i : ι) :
e.det v (Basis.mk hli hsp).coord i = (e.det).toLinearMap v 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_unitsSMul {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) (w : ιRˣ) :
(e.unitsSMul w).det = (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_unitsSMul_self {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) (w : ιRˣ) :
e.det (e.unitsSMul w) = i : ι, (w i)

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

@[simp]
theorem Basis.det_isUnitSMul {R : Type u_1} [] {M : Type u_2} [] [Module R M] {ι : Type u_4} [] [] (e : Basis ι R M) {w : ιR} (hw : ∀ (i : ι), IsUnit (w i)) :
e.det (e.isUnitSMul hw) = i : ι, w i

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