least square approximation


Summary

Least square solution

Algorithm for finding least square solution

least square may have a general solution

Least square by QR factorization

is already in REF making it easier to solve

Projection

Concept

Least square solution

  • solution that is closer than every other vector

Orthogonal projection

Projection is unique

QR factorization

Application

Linear regression

constructing the matrix equation

Extra

Octave

octave
# Least squares solution(last column)
rref([A'*A A'*b])

# Least squares solution if A is QR factorizable
[Q, R] = qr(A)
rref([R Q’*b])