Professional Documents
Culture Documents
Least Squares: Least Squares Problem Solution of A Least Squares Problem Solving Least Squares Problems
Least Squares: Least Squares Problem Solution of A Least Squares Problem Solving Least Squares Problems
8. Least squares
8.1
Least squares problem
!2
m n
k Ax − bk 2 =
X X
Ai j x j − bi
i=1 j=1
m n
k Ax − bk =
2
ri (x) ,
2
ri (x) =
X X
Ai j x j − bi
i=1 j=1
f ( x̂) + 2
2 0 1 f ( x̂) + 1
x2
0
A = −1 1 , b = 0
0 2 −1 x̂
−1
−1 0 1
x1
• the least squares solution x̂ minimizes
minimize k Ax − bk 2
k A x̂ − bk ≤ k Ax − bk for all x
n
k Ax − bk = k
2
a j x j − bk 2
X
minimize
j=1
r = A x̂ − b
A x̂
range(A) = span(a1, . . . , an )
Channel 1 1,500
Channel 2
2 Channel 3
Impressions
Impressions
1,000
1
500
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
Least squares
Group Group 8.6
Example: illumination
Example: m = 252, n = 10; figure shows position and height of each lamp
25m
2 (3.5m)
1 (4.0m)
3 (6.0m)
6 (6.0m)
4 (4.0m)
5 (4.0m) 7 (5.5m)
9 (5.0m) 10 (4.5m)
8 (5.0m)
0
0 25m
Least squares 8.7
Example: illumination
100 100
50 50
0 0
0 1 2 0 1 2
Intensity Intensity
Least squares 8.8
Outline
x̂ = (AT A)−1 AT b
= A† b
minimize k Ax − bk 2
A(x − x̂) , 0 if x , x̂
!2
m n
f (x) = k Ax − bk 2 =
X X
Ai j x j − bi
i=1 j=1
• gradient of f is
∂f ∂f ∂f
∇ f (x) = (x), (x), . . . , (x) = 2AT (Ax − b)
∂ x1 ∂ x2 ∂ xn
r̂ = A x̂ − b
A x̂
range(A) = span(a1, . . . , an )
AT Ax = AT b
• these equations are called the normal equations of the least squares problem
• coefficient matrix AT A is the Gram matrix of A
• equivalent to ∇ f (x) = 0 where f (x) = k Ax − bk 2
• all solutions of the least squares problem satisfy the normal equations
• AT A is nonsingular
• normal equations have a unique solution x̂ = (AT A)−1 AT b
Algorithm
3 −6 −1
A = 4 −8 , b = 7
0 1 2
1. QR factorization: A = QR with
3/5 0
5 −10
Q = 4/5 0 , R=
0 1 0 1
2. calculate d = QT b = (5, 2)
3. solve Rx = d
5 −10 x1 5
=
0 1 x2 2
solution is x1 = 5, x2 = 2
AT Ax = AT b
1 −1 0
A = 0 10−5 , b = 10−5 ,
0 0 1
Method 2: QR factorization of A is
1 0
1 −1
Q = 0 1 , R=
0 0 0 10−5