Documentation

Linglib.Core.Analysis.LeastSquares

Least-squares solutions #

IsLeastSquares A b x says x minimises ‖A y − b‖ over the domain of a linear map A into a real inner product space. Mathlib provides the subspace side (Submodule.starProjection and its minimality); this file packages the pulled-back problem: the first-order characterisation, existence, uniqueness of fitted values, and the solution coset.

[UPSTREAM] candidate — mathlib has the ingredients but not the packaging; generalises from to RCLike 𝕜.

Main declarations #

def Core.IsLeastSquares {E : Type u_1} {F : Type u_2} [AddCommGroup E] [Module E] [NormedAddCommGroup F] [InnerProductSpace F] (A : E →ₗ[] F) (b : F) (x : E) :

x is a least-squares solution of A y ≈ b if it minimises the residual norm ‖A y − b‖.

Equations
Instances For
    theorem Core.isLeastSquares_iff_inner_eq_zero {E : Type u_1} {F : Type u_2} [AddCommGroup E] [Module E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x : E} :
    IsLeastSquares A b x ∀ (y : E), inner (b - A x) (A y) = 0

    The first-order characterisation of least squares: x is a solution iff the residual b − A x is orthogonal to everything A can produce — the normal equations, with no rank hypothesis.

    theorem Core.exists_isLeastSquares {E : Type u_1} {F : Type u_2} [AddCommGroup E] [Module E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} [A.range.HasOrthogonalProjection] :
    ∃ (x : E), IsLeastSquares A b x

    Least-squares solutions exist whenever the range of A admits an orthogonal projection — in particular whenever it is finite-dimensional.

    theorem Core.IsLeastSquares.map_eq {E : Type u_1} {F : Type u_2} [AddCommGroup E] [Module E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x x' : E} (hx : IsLeastSquares A b x) (hx' : IsLeastSquares A b x') :
    A x = A x'

    Fitted values are unique: any two least-squares solutions produce the same point of the range.

    theorem Core.IsLeastSquares.iff_map_eq {E : Type u_1} {F : Type u_2} [AddCommGroup E] [Module E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} {x x' : E} (hx : IsLeastSquares A b x) :
    IsLeastSquares A b x' A x' = A x

    The least-squares solutions are exactly the preimages of the fitted value: given one solution, another point solves iff it maps to the same place.

    theorem Core.IsLeastSquares.eq_of_injective {E : Type u_1} {F : Type u_2} [AddCommGroup E] [Module E] [NormedAddCommGroup F] [InnerProductSpace F] {A : E →ₗ[] F} {b : F} (hA : Function.Injective A) {x x' : E} (hx : IsLeastSquares A b x) (hx' : IsLeastSquares A b x') :
    x = x'

    Under an injective design map the least-squares solution is unique.