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 / V22. Affine, Euclidean and convex geometry

Mathlib.LinearAlgebra.AffineSpace.Matrix

12 declarations. Mathlib docs · Source

def AffineBasis.toMatrix E1 #

{ι : Type u₁} →
  {k : Type u₂} →
    {V : Type u₃} →
      {P : Type u₄} →
        [inst : AddCommGroup V] →
          [inst_1 : AddTorsor V P] →
            [inst_2 : Ring k] → [inst_3 : Module k V] → AffineBasis ι k P → {ι' : Type u_1} → (ι' → P) → Matrix ι' ι k

Given an affine basis p, and a family of points q : ι' → P, this is the matrix whose rows are the barycentric coordinates of q with respect to p.

It is an affine equivalent of Basis.toMatrix.

theorem AffineBasis.toMatrix_apply E0 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) {ι' : Type u_1} (q : ι' → P) (i : ι') (j : ι),
  b.toMatrix q i j = (b.coord j) (q i)

theorem AffineBasis.toMatrix_self E0 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) [inst_4 : DecidableEq ι], b.toMatrix ⇑b = 1

theorem AffineBasis.toMatrix_row_sum_one E1 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) {ι' : Type u_1} [inst_4 : Fintype ι] (q : ι' → P)
  (i : ι'), ∑ j, b.toMatrix q i j = 1

theorem AffineBasis.affineIndependent_of_toMatrix_right_inv E1 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) {ι' : Type u_1} [inst_4 : Fintype ι] [Finite ι']
  [inst_6 : DecidableEq ι'] (p : ι' → P) {A : Matrix ι ι' k}, b.toMatrix p * A = 1 → AffineIndependent k p

Given a family of points p : ι' → P and an affine basis b, if the matrix whose rows are the coordinates of p with respect b has a right inverse, then p is affine independent.

theorem AffineBasis.affineSpan_eq_top_of_toMatrix_left_inv E1 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) {ι' : Type u_1} [Finite ι] [inst_5 : Fintype ι']
  [inst_6 : DecidableEq ι] [Nontrivial k] (p : ι' → P) {A : Matrix ι ι' k},
  A * b.toMatrix p = 1 → affineSpan k (Set.range p) = ⊤

Given a family of points p : ι' → P and an affine basis b, if the matrix whose rows are the coordinates of p with respect b has a left inverse, then p spans the entire space.

theorem AffineBasis.toMatrix_vecMul_coords E0 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) {ι' : Type u_1} [inst_4 : Fintype ι']
  (b₂ : AffineBasis ι' k P) (x : P), Matrix.vecMul (b₂.coords x) (b.toMatrix ⇑b₂) = b.coords x

A change of basis formula for barycentric coordinates.

See also AffineBasis.toMatrix_inv_vecMul_toMatrix.

theorem AffineBasis.toMatrix_mul_toMatrix E1 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) {ι' : Type u_1} [inst_4 : Fintype ι]
  [inst_5 : DecidableEq ι'] (b₂ : AffineBasis ι' k P), b.toMatrix ⇑b₂ * b₂.toMatrix ⇑b = 1

theorem AffineBasis.isUnit_toMatrix E1 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) [inst_4 : Fintype ι] [inst_5 : DecidableEq ι]
  (b₂ : AffineBasis ι k P), IsUnit (b.toMatrix ⇑b₂)

theorem AffineBasis.isUnit_toMatrix_iff E0 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : Ring k] [inst_3 : Module k V] (b : AffineBasis ι k P) [inst_4 : Fintype ι] [inst_5 : DecidableEq ι]
  [Nontrivial k] (p : ι → P), IsUnit (b.toMatrix p) ↔ AffineIndependent k p ∧ affineSpan k (Set.range p) = ⊤

theorem AffineBasis.toMatrix_inv_vecMul_toMatrix E0 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : CommRing k] [inst_3 : Module k V] [inst_4 : DecidableEq ι] [inst_5 : Fintype ι] (b b₂ : AffineBasis ι k P)
  (x : P), Matrix.vecMul (b.coords x) (b.toMatrix ⇑b₂)⁻¹ = b₂.coords x

A change of basis formula for barycentric coordinates.

See also AffineBasis.toMatrix_vecMul_coords.

theorem AffineBasis.det_smul_coords_eq_cramer_coords E1 #

∀ {ι : Type u₁} {k : Type u₂} {V : Type u₃} {P : Type u₄} [inst : AddCommGroup V] [inst_1 : AddTorsor V P]
  [inst_2 : CommRing k] [inst_3 : Module k V] [inst_4 : DecidableEq ι] [inst_5 : Fintype ι] (b b₂ : AffineBasis ι k P)
  (x : P), (b.toMatrix ⇑b₂).det • b₂.coords x = (b.toMatrix ⇑b₂).transpose.cramer (b.coords x)

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