- categories: Linear algebra, Real Analysis, Method
Definition
The least squares problem seeks to minimize the residual error , where:
- is a matrix with ,
- is a given vector,
- is the unknown vector to solve for.
This arises when the system is overdetermined (more equations than unknowns), and no exact solution exists. The solution is:
Intuition
The least squares solution minimizes the Euclidean distance between and the column space of . It projects onto the subspace spanned by the columns of , yielding the best approximation of that lies in the range of .
Key Properties
-
Normal Equations:
The least squares solution satisfies:
-
Existence and Uniqueness:
- A unique solution exists if is invertible (i.e., has full column rank).
- If is not full rank, the solution is not unique, and the pseudoinverse is used.
-
Orthogonality Condition:
The residual is orthogonal to the column space of :
Methods to Solve -
- Compute , where is orthogonal and is upper triangular. Solve:
- Compute , where is orthogonal and is upper triangular. Solve:
-
- Solve directly.
- This method is computationally less stable compared to QR or SVD.
-
Singular Value Decomposition (SVD):
- Decompose , where is diagonal. Solve using:
where is the pseudoinverse of .
- Decompose , where is diagonal. Solve using:
-
Iterative Methods:
- For large systems, iterative solvers like Stochastic Gradient Descent (SGD) or conjugate gradient are used.
-
- Use Regularization to improve the stability
Applications
-
Data Fitting:
- Fit a model to data points by minimizing the sum of squared errors (e.g., linear regression).
-
- Denoise signals or approximate functions using least squares.
-
Control Systems:
- Estimate system parameters in system identification.
-
Computer Vision:
- Solve problems like camera calibration and 3D reconstruction.
-
- Forms the basis for solving constrained optimization problems (e.g., quadratic programming).
Examples
-
Simple Linear Regression:
Fit a line to data points by solving the least squares problem:
Solve for . -
Overdetermined System:
Solve where:
Using the normal equations:
Solve to find .