Basics of the least squares method
1Introduction
The key point of this lecture is that the
The equation has a solution exactly when lies in . In applications, measured data often put slightly outside the
2Terms and definitions
over .
The
For real matrices, the
In the complex case, is replaced by the
3Plan
Since always lies in , minimizing means projecting onto that
4Intuitive explanation
Think of the
The reason we project onto the
At the closest point , the residual has no component along the
5Precise explanation
5.11. Projection onto the column space 列空間 れつくうかん
For a least squares solution, is the
is orthogonal to every column of .
5.22. From orthogonality to normal equations 正規方程式 せいきほうていしき
Let the columns of be . The condition
is written in matrix form as
in the real case. Substituting gives
so
In the complex case, the same orthogonality condition is written as , hence
5.33. Uniqueness
If the columns of are linearly independent, then is
If the columns are linearly dependent, the projection is still unique, but the coefficient vector may not be unique. The
5.44. Projection matrix
If has full column
Then
The matrix satisfies
In the complex case,
6Concrete examples
For
the vector has all entries equal to . The normal equation is
so . This is the average of and is the best constant approximation.
For a line fit through using , write
Then
Solving gives
The best-fit line is
and the residual is orthogonal to both columns of .
7Another viewpoint
Geometrically, the
8Theorem: existence and projection characterization
For every and , a minimizer of exists. The minimizing vector may not be unique, but the best approximation is unique and equals the
Indeed, since is finite-dimensional, we can decompose
Choose such that . For any ,
This proof shows that least squares is fundamentally an orthogonal-decomposition argument.
9rank 階数 かいすう -deficient case and least-norm solutions
If the columns of are dependent, is not
10Numerical warning
The
11Criteria
- Use least squares when is overdetermined or inconsistent.
- The residual must be orthogonal to the
column space .列空間 れつくうかん - If the columns of are independent, use the invertibility of .
- If the columns are dependent, distinguish the unique projection from nonunique coefficient vectors.
12Scope and limitations
In real standard inner products, use . In complex spaces, use . When the columns are dependent, the projection is unique but the coefficients need not be. Numerical algorithms often avoid explicitly forming .
13Theorem: existence of least-squares solutions and orthogonal projection
For and , a vector minimizing always exists. However, need not be unique. The unique object is the best approximation , namely the
The reason is that is a finite-dimensional
Choose with . For any ,
Here and are used. This proof shows that least squares is based on
14rank 階数 かいすう -deficient case and least-norm solutions
If the columns of are
may have multiple solutions. Those solutions give the same , and their differences lie in . To select a unique representative, choose the least-norm solution with no component in the direction. The
15Calculation example: fitting a line with two variables
Approximate the points by . In matrix form,
The normal equations are
so
Solving gives
Thus the best-fitting line is
The residual is
16Practical numerical warning
Forming roughly squares the condition number. Thus even if is only moderately ill-conditioned, can become much more unstable. Normal equations show the theoretical structure, but in numerical computation QR decomposition or
17Final forms
18In one sentence
The