Documentation

Mathlib.LinearAlgebra.LinearIndependent.Lemmas

Linear independence #

This file collects consequences of linear (in)dependence and includes specialized tests for specific families of vectors, requiring more theory to state.

Main statements #

We prove several specialized tests for linear independence of families of vectors and of sets of vectors.

In many cases we additionally provide dot-style operations (e.g., LinearIndependent.union) to make the linear independence tests usable as hv.insert ha etc.

We also prove that, when working over a division ring, any family of vectors includes a linear independent subfamily spanning the same subspace.

TODO #

Rework proofs to hold in semirings, by avoiding the path through ker (Finsupp.linearCombination R v) = ⊥.

Tags #

linearly dependent, linear dependence, linearly independent, linear independence

theorem Fintype.linearIndependent_iff'ₛ {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] [Fintype ι] [DecidableEq ι] :
LinearIndependent R v Function.Injective ((LinearMap.lsum R (fun (x : ι) => R) ) fun (i : ι) => LinearMap.id.smulRight (v i))

A finite family of vectors v i is linear independent iff the linear map that sends c : ι → R to ∑ i, c i • v i is injective.

theorem LinearIndependent.pair_iffₛ {R : Type u_2} {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] {x y : M} :
LinearIndependent R ![x, y] ∀ (s t s' t' : R), s x + t y = s' x + t' ys = s' t = t'
theorem LinearIndependent.eq_of_pair {R : Type u_2} {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] {x y : M} (h : LinearIndependent R ![x, y]) {s t s' t' : R} (h' : s x + t y = s' x + t' y) :
s = s' t = t'
theorem LinearIndependent.eq_zero_of_pair' {R : Type u_2} {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] {x y : M} (h : LinearIndependent R ![x, y]) {s t : R} (h' : s x = t y) :
s = 0 t = 0
theorem LinearIndependent.eq_zero_of_pair {R : Type u_2} {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] {x y : M} (h : LinearIndependent R ![x, y]) {s t : R} (h' : s x + t y = 0) :
s = 0 t = 0
theorem linearIndepOn_iUnion_of_directed {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] {η : Type u_6} {s : ηSet ι} (hs : Directed (fun (x1 x2 : Set ι) => x1 x2) s) (h : ∀ (i : η), LinearIndepOn R v (s i)) :
LinearIndepOn R v (⋃ (i : η), s i)
@[deprecated linearIndepOn_iUnion_of_directed (since := "2025-02-15")]
theorem linearIndependent_iUnion_of_directed {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] {η : Type u_6} {s : ηSet ι} (hs : Directed (fun (x1 x2 : Set ι) => x1 x2) s) (h : ∀ (i : η), LinearIndepOn R v (s i)) :
LinearIndepOn R v (⋃ (i : η), s i)

Alias of linearIndepOn_iUnion_of_directed.

theorem linearIndepOn_sUnion_of_directed {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] {s : Set (Set ι)} (hs : DirectedOn (fun (x1 x2 : Set ι) => x1 x2) s) (h : as, LinearIndepOn R v a) :
@[deprecated linearIndepOn_sUnion_of_directed (since := "2025-02-15")]
theorem linearIndependent_sUnion_of_directed {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] {s : Set (Set ι)} (hs : DirectedOn (fun (x1 x2 : Set ι) => x1 x2) s) (h : as, LinearIndepOn R v a) :

Alias of linearIndepOn_sUnion_of_directed.

theorem linearIndepOn_biUnion_of_directed {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] {η : Type u_6} {s : Set η} {t : ηSet ι} (hs : DirectedOn (t ⁻¹'o fun (x1 x2 : Set ι) => x1 x2) s) (h : as, LinearIndepOn R v (t a)) :
LinearIndepOn R v (⋃ as, t a)
@[deprecated linearIndepOn_biUnion_of_directed (since := "2025-02-15")]
theorem linearIndependent_biUnion_of_directed {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] {η : Type u_6} {s : Set η} {t : ηSet ι} (hs : DirectedOn (t ⁻¹'o fun (x1 x2 : Set ι) => x1 x2) s) (h : as, LinearIndepOn R v (t a)) :
LinearIndepOn R v (⋃ as, t a)

Alias of linearIndepOn_biUnion_of_directed.

theorem LinearIndependent.iSupIndep_span_singleton {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] (hv : LinearIndependent R v) :
iSupIndep fun (i : ι) => Submodule.span R {v i}

See also iSupIndep_iff_linearIndependent_of_ne_zero.

@[deprecated LinearIndependent.iSupIndep_span_singleton (since := "2024-11-24")]
theorem LinearIndependent.independent_span_singleton {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Semiring R] [AddCommMonoid M] [Module R M] (hv : LinearIndependent R v) :
iSupIndep fun (i : ι) => Submodule.span R {v i}

Alias of LinearIndependent.iSupIndep_span_singleton.


See also iSupIndep_iff_linearIndependent_of_ne_zero.

theorem linearIndependent_inl_union_inr' {ι : Type u'} {ι' : Type u_1} {R : Type u_2} {M : Type u_4} {M' : Type u_5} [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [Module R M] [Module R M'] {v : ιM} {v' : ι'M'} (hv : LinearIndependent R v) (hv' : LinearIndependent R v') :
LinearIndependent R (Sum.elim ((LinearMap.inl R M M') v) ((LinearMap.inr R M M') v'))
theorem LinearIndependent.inl_union_inr {R : Type u_2} {M : Type u_4} {M' : Type u_5} [Semiring R] [AddCommMonoid M] [AddCommMonoid M'] [Module R M] [Module R M'] {s : Set M} {t : Set M'} (hs : LinearIndependent R fun (x : s) => x) (ht : LinearIndependent R fun (x : t) => x) :
LinearIndependent R fun (x : ↑((LinearMap.inl R M M') '' s (LinearMap.inr R M M') '' t)) => x
theorem exists_maximal_linearIndepOn' {ι : Type u'} (R : Type u_2) {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] (v : ιM) :
∃ (s : Set ι), LinearIndepOn R v s ∀ (t : Set ι), s tLinearIndepOn R v ts = t

TODO : refactor to use Maximal.

@[deprecated exists_maximal_linearIndepOn' (since := "2025-02-15")]
theorem exists_maximal_independent' {ι : Type u'} (R : Type u_2) {M : Type u_4} [Semiring R] [AddCommMonoid M] [Module R M] (v : ιM) :
∃ (s : Set ι), LinearIndepOn R v s ∀ (t : Set ι), s tLinearIndepOn R v ts = t

Alias of exists_maximal_linearIndepOn'.


TODO : refactor to use Maximal.

theorem Fintype.linearIndependent_iff' {ι : Type u'} {R : Type u_2} {M : Type u_4} {v : ιM} [Ring R] [AddCommGroup M] [Module R M] [Fintype ι] [DecidableEq ι] :
LinearIndependent R v LinearMap.ker ((LinearMap.lsum R (fun (x : ι) => R) ) fun (i : ι) => LinearMap.id.smulRight (v i)) =

A finite family of vectors v i is linear independent iff the linear map that sends c : ι → R to ∑ i, c i • v i has the trivial kernel.

theorem LinearIndependent.pair_iff {R : Type u_2} {M : Type u_4} [Ring R] [AddCommGroup M] [Module R M] {x y : M} :
LinearIndependent R ![x, y] ∀ (s t : R), s x + t y = 0s = 0 t = 0

Also see LinearIndependent.pair_iff' for a simpler version over fields.

Properties which require Ring R #

theorem LinearIndependent.linear_combination_pair_of_det_ne_zero {R : Type u_6} {M : Type u_7} [CommRing R] [NoZeroDivisors R] [AddCommGroup M] [Module R M] {x y : M} (h : LinearIndependent R ![x, y]) {a b c d : R} (h' : a * d - b * c 0) :
LinearIndependent R ![a x + b y, c x + d y]

If two vectors x and y are linearly independent, so are their linear combinations a x + b y and c x + d y provided the determinant a * d - b * c is nonzero.

theorem linearIndepOn_id_iUnion_finite {ι : Type u'} {R : Type u_2} {M : Type u_4} [Ring R] [AddCommGroup M] [Module R M] {f : ιSet M} (hl : ∀ (i : ι), LinearIndepOn R id (f i)) (hd : ∀ (i : ι) (t : Set ι), t.FiniteitDisjoint (Submodule.span R (f i)) (⨆ it, Submodule.span R (f i))) :
LinearIndepOn R id (⋃ (i : ι), f i)
@[deprecated linearIndepOn_id_iUnion_finite (since := "2025-02-15")]
theorem linearIndependent_iUnion_finite_subtype {ι : Type u'} {R : Type u_2} {M : Type u_4} [Ring R] [AddCommGroup M] [Module R M] {f : ιSet M} (hl : ∀ (i : ι), LinearIndepOn R id (f i)) (hd : ∀ (i : ι) (t : Set ι), t.FiniteitDisjoint (Submodule.span R (f i)) (⨆ it, Submodule.span R (f i))) :
LinearIndepOn R id (⋃ (i : ι), f i)

Alias of linearIndepOn_id_iUnion_finite.

theorem linearIndependent_iUnion_finite {R : Type u_2} {M : Type u_4} [Ring R] [AddCommGroup M] [Module R M] {η : Type u_6} {ιs : ηType u_7} {f : (j : η) → ιs jM} (hindep : ∀ (j : η), LinearIndependent R (f j)) (hd : ∀ (i : η) (t : Set η), t.FiniteitDisjoint (Submodule.span R (Set.range (f i))) (⨆ it, Submodule.span R (Set.range (f i)))) :
LinearIndependent R fun (ji : (j : η) × ιs j) => f ji.fst ji.snd
theorem exists_maximal_linearIndepOn {ι : Type u'} (R : Type u_2) {M : Type u_4} [Ring R] [AddCommGroup M] [Module R M] (v : ιM) :
∃ (s : Set ι), LinearIndepOn R v s is, ∃ (a : R), a 0 a v i Submodule.span R (v '' s)
@[deprecated exists_maximal_linearIndepOn (since := "2025-02-15")]
theorem exists_maximal_independent {ι : Type u'} (R : Type u_2) {M : Type u_4} [Ring R] [AddCommGroup M] [Module R M] (v : ιM) :
∃ (s : Set ι), LinearIndepOn R v s is, ∃ (a : R), a 0 a v i Submodule.span R (v '' s)

Alias of exists_maximal_linearIndepOn.

theorem LinearIndependent.restrict_scalars' (R : Type u_6) {S : Type u_7} {M : Type u_8} {ι : Type u_9} [CommSemiring R] [Semiring S] [Algebra R S] [FaithfulSMul R S] [AddCommMonoid M] [Module R M] [Module S M] [IsScalarTower R S M] {v : ιM} (li : LinearIndependent S v) :

Properties which require DivisionRing K #

These can be considered generalizations of properties of linear independence in vector spaces.

theorem mem_span_insert_exchange {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set V} {x y : V} :
x Submodule.span K (insert y s)xSubmodule.span K sy Submodule.span K (insert x s)
theorem LinearIndepOn.insert {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set V} {x : V} (hs : LinearIndepOn K id s) (hx : xSubmodule.span K s) :
@[deprecated LinearIndepOn.insert (since := "2025-02-15")]
theorem LinearIndependent.insert {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set V} {x : V} (hs : LinearIndepOn K id s) (hx : xSubmodule.span K s) :

Alias of LinearIndepOn.insert.

theorem linearIndependent_option' {ι : Type u'} {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {v : ιV} {x : V} :
theorem LinearIndependent.option {ι : Type u'} {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {v : ιV} {x : V} (hv : LinearIndependent K v) (hx : xSubmodule.span K (Set.range v)) :
LinearIndependent K fun (o : Option ι) => o.casesOn' x v
theorem linearIndependent_option {ι : Type u'} {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {v : Option ιV} :
theorem linearIndepOn_insert {ι : Type u'} {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set ι} {a : ι} {f : ιV} (has : as) :
LinearIndepOn K f (insert a s) LinearIndepOn K f s f aSubmodule.span K (f '' s)
@[deprecated linearIndepOn_insert (since := "2025-02-15")]
theorem linearIndependent_insert' {ι : Type u'} {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set ι} {a : ι} {f : ιV} (has : as) :
LinearIndepOn K f (insert a s) LinearIndepOn K f s f aSubmodule.span K (f '' s)

Alias of linearIndepOn_insert.

theorem linearIndepOn_id_insert {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set V} {x : V} (hxs : xs) :
@[deprecated linearIndepOn_insert (since := "2025-02-15")]
theorem linearIndependent_insert {ι : Type u'} {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set ι} {a : ι} {f : ιV} (has : as) :
LinearIndepOn K f (insert a s) LinearIndepOn K f s f aSubmodule.span K (f '' s)

Alias of linearIndepOn_insert.

theorem linearIndepOn_id_pair {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {x y : V} (hx : x 0) (hy : ∀ (a : K), a x y) :
@[deprecated linearIndepOn_id_pair (since := "2025-02-15")]
theorem linearIndependent_pair {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {x y : V} (hx : x 0) (hy : ∀ (a : K), a x y) :

Alias of linearIndepOn_id_pair.

theorem LinearIndependent.pair_iff' {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {x y : V} (hx : x 0) :
LinearIndependent K ![x, y] ∀ (a : K), a x y

Also see LinearIndependent.pair_iff for the version over arbitrary rings.

theorem linearIndependent_fin_cons {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {x : V} {n : } {v : Fin nV} :
theorem linearIndependent_fin_snoc {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {x : V} {n : } {v : Fin nV} :
theorem LinearIndependent.fin_cons {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {x : V} {n : } {v : Fin nV} (hv : LinearIndependent K v) (hx : xSubmodule.span K (Set.range v)) :

See LinearIndependent.fin_cons' for an uglier version that works if you only have a module over a semiring.

theorem linearIndependent_fin_succ {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {n : } {v : Fin (n + 1)V} :
theorem linearIndependent_fin_succ' {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {n : } {v : Fin (n + 1)V} :
def equiv_linearIndependent {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] (n : ) :
{ s : Fin (n + 1)V // LinearIndependent K s } (s : { s : Fin nV // LinearIndependent K s }) × (↑(Submodule.span K (Set.range s)))

Equivalence between k + 1 vectors of length n and k vectors of length n along with a vector in the complement of their span.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem linearIndependent_fin2 {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {f : Fin 2V} :
    LinearIndependent K f f 1 0 ∀ (a : K), a f 1 f 0
    theorem exists_linearIndepOn_id_extension {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
    bt, s b t (Submodule.span K b) LinearIndepOn K id b

    TODO : generalize this and related results to non-identity functions

    @[deprecated exists_linearIndepOn_id_extension (since := "2025-02-15")]
    theorem exists_linearIndependent_extension {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
    bt, s b t (Submodule.span K b) LinearIndepOn K id b

    Alias of exists_linearIndepOn_id_extension.


    TODO : generalize this and related results to non-identity functions

    theorem exists_linearIndependent' {ι : Type u'} (K : Type u_3) {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] (v : ιV) :
    ∃ (κ : Type u') (a : κι), Function.Injective a Submodule.span K (Set.range (v a)) = Submodule.span K (Set.range v) LinearIndependent K (v a)

    Indexed version of exists_linearIndependent.

    noncomputable def LinearIndepOn.extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
    Set V

    LinearIndepOn.extend adds vectors to a linear independent set s ⊆ t until it spans all elements of t. TODO - generalize the lemmas below to functions that aren't the identity.

    Equations
    Instances For
      @[deprecated LinearIndepOn.extend (since := "2025-02-15")]
      def LinearIndependent.extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
      Set V

      Alias of LinearIndepOn.extend.


      LinearIndepOn.extend adds vectors to a linear independent set s ⊆ t until it spans all elements of t. TODO - generalize the lemmas below to functions that aren't the identity.

      Equations
      Instances For
        theorem LinearIndepOn.extend_subset {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        hs.extend hst t
        @[deprecated LinearIndepOn.extend_subset (since := "2025-02-15")]
        theorem LinearIndependent.extend_subset {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        hs.extend hst t

        Alias of LinearIndepOn.extend_subset.

        theorem LinearIndepOn.subset_extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        s hs.extend hst
        @[deprecated LinearIndepOn.subset_extend (since := "2025-02-15")]
        theorem LinearIndependent.subset_extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        s hs.extend hst

        Alias of LinearIndepOn.subset_extend.

        theorem LinearIndepOn.subset_span_extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        t (Submodule.span K (hs.extend hst))
        @[deprecated LinearIndepOn.subset_span_extend (since := "2025-02-15")]
        theorem LinearIndependent.subset_span_extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        t (Submodule.span K (hs.extend hst))

        Alias of LinearIndepOn.subset_span_extend.

        theorem LinearIndepOn.span_extend_eq_span {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        @[deprecated LinearIndepOn.span_extend_eq_span (since := "2025-02-15")]
        theorem LinearIndependent.span_extend_eq_span {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :

        Alias of LinearIndepOn.span_extend_eq_span.

        theorem LinearIndepOn.linearIndepOn_extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :
        @[deprecated LinearIndepOn.linearIndepOn_extend (since := "2025-02-15")]
        theorem LinearIndependent.linearIndependent_extend {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (hs : LinearIndepOn K id s) (hst : s t) :

        Alias of LinearIndepOn.linearIndepOn_extend.

        theorem exists_of_linearIndepOn_of_finite_span {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set V} {t : Finset V} (hs : LinearIndepOn K id s) (hst : s (Submodule.span K t)) :
        ∃ (t' : Finset V), t' s t s t' t'.card = t.card
        @[deprecated exists_of_linearIndepOn_of_finite_span (since := "2025-02-15")]
        theorem exists_of_linearIndependent_of_finite_span {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s : Set V} {t : Finset V} (hs : LinearIndepOn K id s) (hst : s (Submodule.span K t)) :
        ∃ (t' : Finset V), t' s t s t' t'.card = t.card

        Alias of exists_of_linearIndepOn_of_finite_span.

        theorem exists_finite_card_le_of_finite_of_linearIndependent_of_span {K : Type u_3} {V : Type u} [DivisionRing K] [AddCommGroup V] [Module K V] {s t : Set V} (ht : t.Finite) (hs : LinearIndepOn K id s) (hst : s (Submodule.span K t)) :
        ∃ (h : s.Finite), h.toFinset.card ht.toFinset.card