Linear maps and matrices #
This file defines the maps to send matrices to a linear map, and to send linear maps between modules with a finite bases to matrices. This defines a linear equivalence between linear maps between finite-dimensional vector spaces and matrices indexed by the respective bases.
It also defines the trace of an endomorphism, and the determinant of a family of vectors with respect to some basis.
Some results are proved about the linear map corresponding to a
diagonal matrix (range
, ker
and rank
).
Some results are proved for determinants of block triangular matrices.
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.
-
linear_map.to_matrix
: given basesv₁ : ι → M₁
andv₂ : κ → M₂
, theR
-linear equivalence fromM₁ →ₗ[R] M₂
tomatrix κ ι R
-
matrix.to_lin
: the inverse oflinear_map.to_matrix
-
linear_map.to_matrix'
: theR
-linear equivalence from(n → R) →ₗ[R] (m → R)
tomatrix n m R
(with the standard basis onn → R
andm → R
) -
matrix.to_lin'
: the inverse oflinear_map.to_matrix'
-
alg_equiv_matrix
: given a basis indexed byn
, theR
-algebra equivalence betweenR
-endomorphisms ofM
andmatrix n n R
-
matrix.trace
: the trace of a square matrix -
linear_map.trace
: the trace of an endomorphism -
basis.to_matrix
: the matrix whose columns are a given family of vectors in a given basis -
basis.to_matrix_equiv
: given a basis, the linear equivalence between families of vectors and matrices arising frombasis.to_matrix
-
basis.det
: the determinant of a family of vectors with respect to a basis, as a multilinear map
Tags #
linear_map, matrix, linear_equiv, diagonal, det, trace
Equations
- matrix.fintype R = _.mpr pi.fintype
Linear maps (n → R) →ₗ[R] (m → R)
are linearly equivalent to matrix m n R
.
Equations
- linear_map.to_matrix' = {to_fun := λ (f : (n → R) →ₗ[R] m → R) (i : m) (j : n), ⇑f (⇑(linear_map.std_basis R (λ (_x : n), R) j) 1) i, map_add' := _, map_smul' := _, inv_fun := matrix.mul_vec_lin _inst_4, left_inv := _, right_inv := _}
A matrix m n R
is linearly equivalent to a linear map (n → R) →ₗ[R] (m → R)
.
Equations
Linear maps (n → R) →ₗ[R] (n → R)
are algebra equivalent to matrix n n R
.
Equations
- linear_map.to_matrix_alg_equiv' = alg_equiv.of_linear_equiv linear_map.to_matrix' linear_map.to_matrix_alg_equiv'._proof_1 linear_map.to_matrix_alg_equiv'._proof_2
A matrix n n R
is algebra equivalent to a linear map (n → R) →ₗ[R] (n → R)
.
Given bases of two modules M₁
and M₂
over a commutative ring R
, we get a linear
equivalence between linear maps M₁ →ₗ M₂
and matrices over R
indexed by the bases.
Equations
- linear_map.to_matrix v₁ v₂ = (v₁.equiv_fun.arrow_congr v₂.equiv_fun).trans linear_map.to_matrix'
Given bases of two modules M₁
and M₂
over a commutative ring R
, we get a linear
equivalence between matrices over R
indexed by the bases and linear maps M₁ →ₗ M₂
.
Equations
- matrix.to_lin v₁ v₂ = (linear_map.to_matrix v₁ v₂).symm
This will be a special case of linear_map.to_matrix_id_eq_basis_to_matrix
.
Given a basis of a module M₁
over a commutative ring R
, we get an algebra
equivalence between linear maps M₁ →ₗ M₁
and square matrices over R
indexed by the basis.
Equations
Given a basis of a module M₁
over a commutative ring R
, we get an algebra
equivalence between square matrices over R
indexed by the basis and linear maps M₁ →ₗ M₁
.
Equations
From a basis e : ι → M
and a family of vectors v : ι' → M
, make the matrix whose columns
are the vectors v i
written in the basis e
.
From a basis e : ι → M
, build a linear equivalence between families of vectors v : ι → M
,
and matrices, making the matrix whose columns are the vectors v i
written in the basis e
.
A generalization of linear_map.to_matrix_id
.
A generalization of basis.to_matrix_self
, in the opposite direction.
Builds a linear equivalence from a linear map whose determinant in some bases is a unit.
Te determinant of a family of vectors with respect to some basis, as an alternating multilinear map.
The trace of a square matrix.
Equations
- matrix.trace n R M = {to_fun := λ (A : matrix n n M), ∑ (i : n), ⇑(matrix.diag n R M) A i, map_add' := _, map_smul' := _}
An invertible matrix yields a linear equivalence from the free module to itself.
See matrix.to_linear_equiv
for the same map on arbitrary modules.
Given hA : is_unit A.det
and b : basis R b
, A.to_linear_equiv b hA
is
the linear_equiv
arising from to_lin b b A
.
See matrix.to_linear_equiv'
for this result on n → R
.
The dimension of the space of finite dimensional matrices is the product of the number of rows and columns.
The natural map that reindexes a matrix's rows and columns with equivalent types,
matrix.reindex
, is a linear equivalence.
Equations
- matrix.reindex_linear_equiv eₘ eₙ = {to_fun := (matrix.reindex eₘ eₙ).to_fun, map_add' := _, map_smul' := _, inv_fun := (matrix.reindex eₘ eₙ).inv_fun, left_inv := _, right_inv := _}
For square matrices, the natural map that reindexes a matrix's rows and columns with equivalent
types, matrix.reindex
, is an equivalence of algebras.
Equations
- matrix.reindex_alg_equiv e = {to_fun := ⇑(matrix.reindex e e), inv_fun := (matrix.reindex_linear_equiv e e).inv_fun, left_inv := _, right_inv := _, map_mul' := _, map_add' := _, commutes' := _}
Reindexing both indices along the same equivalence preserves the determinant.
For the simp
version of this lemma, see det_minor_equiv_self
.
Reindexing both indices along the same equivalence preserves the determinant.
For the simp
version of this lemma, see det_minor_equiv_self
.
left_mul_matrix b x
is the matrix corresponding to the linear map λ y, x * y
.
left_mul_matrix_eq_repr_mul
gives a formula for the entries of left_mul_matrix
.
This definition is useful for doing (more) explicit computations with algebra.lmul
,
such as the trace form or norm map for algebras.
Equations
- algebra.left_mul_matrix b = {to_fun := λ (x : S), ⇑(linear_map.to_matrix b b) (⇑(algebra.lmul R S) x), map_one' := _, map_mul' := _, map_zero' := _, map_add' := _, commutes' := _}
The trace of an endomorphism given a basis.
Equations
- linear_map.trace_aux R b = (matrix.trace ι R R).comp ↑(linear_map.to_matrix b b)
Trace of an endomorphism independent of basis.
Auxiliary lemma for trace_eq_matrix_trace
.
The dimension of the space of linear transformations is the product of the dimensions of the domain and codomain.
The natural equivalence between linear endomorphisms of finite free modules and square matrices is compatible with the algebra structures.
Equations
- alg_equiv_matrix' = {to_fun := linear_map.to_matrix'.to_fun, inv_fun := linear_map.to_matrix'.inv_fun, left_inv := _, right_inv := _, map_mul' := _, map_add' := _, commutes' := _}
A linear equivalence of two modules induces an equivalence of algebras of their endomorphisms.
A basis of a module induces an equivalence of algebras from the endomorphisms of the module to square matrices.
Equations
Let b
map rows and columns of a square matrix M
to n
blocks. Then
block_triangular_matrix' M n b
says the matrix is block triangular.
Equations
- M.block_triangular_matrix' b = ∀ (i j : o), b j < b i → M i j = 0
Let b
map rows and columns of a square matrix M
to blocks indexed by ℕ
s. Then
block_triangular_matrix M n b
says the matrix is block triangular.
Equations
- M.block_triangular_matrix b = ∀ (i j : o), b j < b i → M i j = 0