The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V07. Linear algebra

Mathlib.LinearAlgebra.Matrix.Basis

31 declarations. Mathlib docs · Source

def Module.Basis.toMatrix E1 #

{ι : Type u_1} →
  {ι' : Type u_2} →
    {R : Type u_5} →
      {M : Type u_6} →
        [inst : CommSemiring R] →
          [inst_1 : AddCommMonoid M] → [inst_2 : Module R M] → Module.Basis ι R M → (ι' → M) → Matrix ι ι' R

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.

theorem Module.Basis.toMatrix_apply E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (e : Module.Basis ι R M) (v : ι' → M) (i : ι) (j : ι'), e.toMatrix v i j = (e.repr (v j)) i

theorem Module.Basis.toMatrix_transpose_apply E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (e : Module.Basis ι R M) (v : ι' → M) (j : ι'), (e.toMatrix v).transpose j = ⇑(e.repr (v j))

theorem Module.Basis.toMatrix_eq_toMatrix_constr E1 #

∀ {ι : Type u_1} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M] [inst_2 : Module R M]
  (e : Module.Basis ι R M) [inst_3 : Fintype ι] [inst_4 : DecidableEq ι] (v : ι → M),
  e.toMatrix v = (LinearMap.toMatrix e e) ((e.constr ℕ) v)

theorem Module.Basis.coePiBasisFun.toMatrix_eq_transpose E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} [inst : CommSemiring R] [inst_1 : Finite ι],
  (Pi.basisFun R ι).toMatrix = Matrix.transpose

theorem Module.Basis.toMatrix_self E0 #

∀ {ι : Type u_1} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M] [inst_2 : Module R M]
  (e : Module.Basis ι R M) [inst_3 : DecidableEq ι], e.toMatrix ⇑e = 1

theorem Module.Basis.toMatrix_update E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (e : Module.Basis ι R M) (v : ι' → M) (j : ι') [inst_3 : DecidableEq ι'] (x : M),
  e.toMatrix (Function.update v j x) = (e.toMatrix v).updateCol j ⇑(e.repr x)

theorem Module.Basis.toMatrix_unitsSMul E0 #

∀ {ι : Type u_1} {R₂ : Type u_7} {M₂ : Type u_8} [inst : CommRing R₂] [inst_1 : AddCommGroup M₂] [inst_2 : Module R₂ M₂]
  [inst_3 : DecidableEq ι] (e : Module.Basis ι R₂ M₂) (w : ι → R₂ˣ),
  e.toMatrix ⇑(e.unitsSMul w) = Matrix.diagonal (Units.val ∘ w)

The basis constructed by unitsSMul has vectors given by a diagonal matrix.

theorem Module.Basis.toMatrix_isUnitSMul E0 #

∀ {ι : Type u_1} {R₂ : Type u_7} {M₂ : Type u_8} [inst : CommRing R₂] [inst_1 : AddCommGroup M₂] [inst_2 : Module R₂ M₂]
  [inst_3 : DecidableEq ι] (e : Module.Basis ι R₂ M₂) {w : ι → R₂} (hw : ∀ (i : ι), IsUnit (w i)),
  e.toMatrix ⇑(e.isUnitSMul hw) = Matrix.diagonal w

The basis constructed by isUnitSMul has vectors given by a diagonal matrix.

theorem Module.Basis.toMatrix_smul_left E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (e : Module.Basis ι R M) (v : ι' → M) {G : Type u_9} [inst_3 : Group G]
  [inst_4 : DistribMulAction G M] [inst_5 : SMulCommClass G R M] (g : G), (g • e).toMatrix v = e.toMatrix (g⁻¹ • v)

theorem Module.Basis.sum_toMatrix_smul_self E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (e : Module.Basis ι R M) (v : ι' → M) (j : ι') [inst_3 : Fintype ι],
  ∑ i, e.toMatrix v i j • e i = v j

theorem Module.Basis.toMatrix_smul E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {R₁ : Type u_9} {S : Type u_10} [inst : CommSemiring R₁] [inst_1 : Semiring S]
  [inst_2 : Algebra R₁ S] [inst_3 : Fintype ι] [inst_4 : DecidableEq ι] (x : S) (b : Module.Basis ι R₁ S) (w : ι' → S),
  b.toMatrix (x • w) = (Algebra.leftMulMatrix b) x * b.toMatrix w

theorem Module.Basis.toMatrix_map_vecMul E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} [inst : CommSemiring R] {S : Type u_9} [inst_1 : Semiring S]
  [inst_2 : Algebra R S] [inst_3 : Fintype ι] (b : Module.Basis ι R S) (v : ι' → S),
  Matrix.vecMul (⇑b) ((b.toMatrix v).map ⇑(algebraMap R S)) = v

theorem Module.Basis.toLin_toMatrix E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (e : Module.Basis ι R M) [inst_3 : Finite ι] [inst_4 : Fintype ι'] [inst_5 : DecidableEq ι']
  (v : Module.Basis ι' R M), (Matrix.toLin v e) (e.toMatrix ⇑v) = LinearMap.id

def Module.Basis.toMatrixEquiv E1 #

{ι : Type u_1} →
  {R : Type u_5} →
    {M : Type u_6} →
      [inst : CommSemiring R] →
        [inst_1 : AddCommMonoid M] →
          [inst_2 : Module R M] → [Fintype ι] → Module.Basis ι R M → (ι → M) ≃ₗ[R] Matrix ι ι R

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.

theorem Module.Basis.restrictScalars_toMatrix E1 #

∀ {ι : Type u_1} (R₂ : Type u_7) {M₂ : Type u_8} [inst : CommRing R₂] [inst_1 : AddCommGroup M₂] [inst_2 : Module R₂ M₂]
  [inst_3 : Fintype ι] [inst_4 : DecidableEq ι] {S : Type u_9} [inst_5 : CommRing S] [inst_6 : Nontrivial S]
  [inst_7 : Algebra R₂ S] [inst_8 : Module S M₂] [inst_9 : IsScalarTower R₂ S M₂] [inst_10 : IsDomain R₂]
  [inst_11 : Module.IsTorsionFree R₂ S] (b : Module.Basis ι S M₂) (v : ι → ↥(Submodule.span R₂ (Set.range ⇑b))),
  (algebraMap R₂ S).mapMatrix ((Module.Basis.restrictScalars R₂ b).toMatrix v) = b.toMatrix fun i ↦ ↑(v i)

theorem LinearMap.toMatrix_id_eq_basis_toMatrix E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (b : Module.Basis ι R M) (b' : Module.Basis ι' R M) [inst_3 : Fintype ι]
  [inst_4 : DecidableEq ι] [inst_5 : Finite ι'], (LinearMap.toMatrix b b') LinearMap.id = b'.toMatrix ⇑b

A generalization of LinearMap.toMatrix_id.

theorem basis_toMatrix_mul_linearMap_toMatrix E0 #

∀ {ι' : Type u_2} {κ : Type u_3} {κ' : Type u_4} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R]
  [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {N : Type u_9} [inst_3 : AddCommMonoid N] [inst_4 : Module R N]
  (b' : Module.Basis ι' R M) (c : Module.Basis κ R N) (c' : Module.Basis κ' R N) (f : M →ₗ[R] N) [inst_5 : Fintype ι']
  [inst_6 : Finite κ] [inst_7 : Fintype κ'] [inst_8 : DecidableEq ι'],
  c.toMatrix ⇑c' * (LinearMap.toMatrix b' c') f = (LinearMap.toMatrix b' c) f

theorem basis_toMatrix_mul E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {κ : Type u_3} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R]
  [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {N : Type u_9} [inst_3 : AddCommMonoid N] [inst_4 : Module R N]
  [inst_5 : Fintype ι'] [inst_6 : Fintype κ] [inst_7 : Finite ι] [inst_8 : DecidableEq κ] (b₁ : Module.Basis ι R M)
  (b₂ : Module.Basis ι' R M) (b₃ : Module.Basis κ R N) (A : Matrix ι' κ R),
  b₁.toMatrix ⇑b₂ * A = (LinearMap.toMatrix b₃ b₁) ((Matrix.toLin b₃ b₂) A)

theorem linearMap_toMatrix_mul_basis_toMatrix E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {κ' : Type u_4} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R]
  [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {N : Type u_9} [inst_3 : AddCommMonoid N] [inst_4 : Module R N]
  (b : Module.Basis ι R M) (b' : Module.Basis ι' R M) (c' : Module.Basis κ' R N) (f : M →ₗ[R] N) [inst_5 : Fintype ι']
  [inst_6 : Fintype ι] [inst_7 : Finite κ'] [inst_8 : DecidableEq ι] [inst_9 : DecidableEq ι'],
  (LinearMap.toMatrix b' c') f * b'.toMatrix ⇑b = (LinearMap.toMatrix b c') f

theorem basis_toMatrix_mul_linearMap_toMatrix_mul_basis_toMatrix E3 #

∀ {ι : Type u_1} {ι' : Type u_2} {κ : Type u_3} {κ' : Type u_4} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R]
  [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {N : Type u_9} [inst_3 : AddCommMonoid N] [inst_4 : Module R N]
  (b : Module.Basis ι R M) (b' : Module.Basis ι' R M) (c : Module.Basis κ R N) (c' : Module.Basis κ' R N)
  (f : M →ₗ[R] N) [inst_5 : Fintype ι'] [inst_6 : Finite κ] [inst_7 : Fintype ι] [inst_8 : Fintype κ']
  [inst_9 : DecidableEq ι] [inst_10 : DecidableEq ι'],
  c.toMatrix ⇑c' * (LinearMap.toMatrix b' c') f * b'.toMatrix ⇑b = (LinearMap.toMatrix b c) f

theorem mul_basis_toMatrix E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {κ : Type u_3} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R]
  [inst_1 : AddCommMonoid M] [inst_2 : Module R M] {N : Type u_9} [inst_3 : AddCommMonoid N] [inst_4 : Module R N]
  [inst_5 : Fintype ι'] [inst_6 : Finite κ] [inst_7 : Fintype ι] [inst_8 : DecidableEq ι] [inst_9 : DecidableEq ι']
  (b₁ : Module.Basis ι R M) (b₂ : Module.Basis ι' R M) (b₃ : Module.Basis κ R N) (A : Matrix κ ι R),
  A * b₁.toMatrix ⇑b₂ = (LinearMap.toMatrix b₂ b₃) ((Matrix.toLin b₁ b₃) A)

theorem basis_toMatrix_basisFun_mul E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {κ : Type u_3} {R : Type u_5} [inst : CommSemiring R] [inst_1 : Fintype ι]
  (b : Module.Basis ι' R (ι → R)) (A : Matrix ι κ R),
  b.toMatrix ⇑(Pi.basisFun R ι) * A = Matrix.of fun i j ↦ (b.repr (A.col j)) i

theorem Module.Basis.toMatrix_reindex' E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] [inst_3 : Fintype ι'] [inst_4 : Fintype ι] (b : Module.Basis ι R M) (v : ι' → M) (e : ι ≃ ι'),
  (b.reindex e).toMatrix v = (Matrix.reindexAlgEquiv R R e) (b.toMatrix (v ∘ ⇑e))

See also Basis.toMatrix_reindex which gives the simp normal form of this result.

theorem Module.Basis.toMatrix_mulVec_repr E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (b : Module.Basis ι R M) (b' : Module.Basis ι' R M) [inst_3 : Fintype ι] [Finite ι'] (m : M),
  (b'.toMatrix ⇑b).mulVec ⇑(b.repr m) = ⇑(b'.repr m)

theorem Module.Basis.toMatrix_mul_toMatrix E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (b : Module.Basis ι R M) (b' : Module.Basis ι' R M) {ι'' : Type u_10} [inst_3 : Fintype ι']
  (b'' : ι'' → M), b.toMatrix ⇑b' * b'.toMatrix b'' = b.toMatrix b''

A generalization of Basis.toMatrix_self, in the opposite direction.

theorem Module.Basis.toMatrix_mul_toMatrix_flip E1 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] (b : Module.Basis ι R M) (b' : Module.Basis ι' R M) [inst_3 : DecidableEq ι]
  [inst_4 : Fintype ι'], b.toMatrix ⇑b' * b'.toMatrix ⇑b = 1

b.toMatrix b' and b'.toMatrix b are inverses.

def Module.Basis.invertibleToMatrix E1 #

{ι : Type u_1} →
  {R₂ : Type u_7} →
    {M₂ : Type u_8} →
      [inst : CommRing R₂] →
        [inst_1 : AddCommGroup M₂] →
          [inst_2 : Module R₂ M₂] →
            [inst_3 : DecidableEq ι] →
              [inst_4 : Fintype ι] → (b b' : Module.Basis ι R₂ M₂) → Invertible (b.toMatrix ⇑b')

A matrix whose columns form a basis b', expressed w.r.t. a basis b, is invertible.

theorem Module.Basis.toMatrix_reindex E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {κ : Type u_3} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R]
  [inst_1 : AddCommMonoid M] [inst_2 : Module R M] (b : Module.Basis ι R M) (v : κ → M) (e : ι ≃ ι'),
  (b.reindex e).toMatrix v = (b.toMatrix v).submatrix (⇑e.symm) id

theorem Module.Basis.toMatrix_map E0 #

∀ {ι : Type u_1} {ι' : Type u_2} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] {N : Type u_9} [inst_3 : AddCommMonoid N] [inst_4 : Module R N] (b : Module.Basis ι R M)
  (f : M ≃ₗ[R] N) (v : ι' → N), (b.map f).toMatrix v = b.toMatrix (⇑f.symm ∘ v)

theorem LinearMap.toMatrix_eq_basisToMatrix E1 #

∀ {ι : Type u_1} {κ : Type u_3} {R : Type u_5} {M : Type u_6} [inst : CommSemiring R] [inst_1 : AddCommMonoid M]
  [inst_2 : Module R M] {N : Type u_9} [inst_3 : AddCommMonoid N] [inst_4 : Module R N] (b : Module.Basis ι R M)
  (c : Module.Basis κ R N) (f : M →ₗ[R] N) [inst_5 : Fintype ι] [inst_6 : DecidableEq ι] [inst_7 : Finite κ],
  (LinearMap.toMatrix b c) f = c.toMatrix (⇑f ∘ ⇑b)