numerical method (standard) for LS probs
In general, ∥(a,b)∥2=(a,b)T(a,b)=aTa+bTb=∥a∥2+∥b∥2
Linear Least Squares
min21∥Ax−b∥22
if A has full col rank (m>n) then XLS uniquely solves Normal Equation’s
ATAxLS=ATb
xLS=(ATA)−1ATb
yˉ=AxLS=A(ATA)−1ATb (projector onto range(A))
“Conditioning” of a matrix determines the accuracy of a linear system solve: cond(M)=λmin(M)λmax(M)
If M is not square:
cond(M)=∇min(M)∇max(M), where ∇ is the gradient
For M=ATA, ∇(M)=∇(ATA)=∇(A)2
λi(ATA)=∇i(A)2
With Q be orthogonal basis for range(A)
n×mQTm×nQ=n×nI
P is an orthogonal projector onto range(P) if
Take P=QQT: range(P)=range(Q)=range(A)
P2=QQTQQT=QQT=P
range(Q)=range(A)
Q=[q1,q2,…,qn]
span{q1,…,qn}=span{a1,…,an}
Every matrix Am×n has a QR Factorization:
A=Q[R0], where Q is orthogonal (QQT=QTQ=I) and R=upper triangular
Q is orthogonal (and square)
QTQ=QTQ=Im
Q1 is orthonormal (not orthogonal)
Q1TQ1=In
Q1Q1T=Im
orthonormal matrices are rotations:
for any vector x∈Rn, ∥Q1x∥2=∥x∥2 ⇒ ∥Q1x∥2=xTQ1TQ1x=xTx=∥x∥2
any y∈Rm, (Qx)T(Qy)=xTQTQy=xTy
Solving Least Squares
xmin∥Ax−b∥2
∥Ax−b∥2=∥QT(Ax−b)∥2=∥QTAx−QTb∥2=∥Rx0−Q1TbQ2Tb∥2=∥Rx−QTb∥2+∥Q2Tb∥2
A=Q[R0]
Multiply both sides on the left with QT
QTA=IQTQ[R0]
[Q1TAQ2TA]=[R0]
Q1TA=R
Q2TA=0
R1x=Q1Tb ⇒ solving least squares using QR
Cond(A)=Cond(Q,R)=Cond(R)