Chapter 6: Application: The Least-Square Solution and The Least-Squares Error. 1 Best Approximation
Chapter 6: Application: The Least-Square Solution and The Least-Squares Error. 1 Best Approximation
1 Best Approximation
In this section we shall show how orthogonal projections can be used to solve a
certain approximation problems.
ku − projW uk < ku − wk
If w 6= projW u, then the second term in the sum (**) will be positive, so
that
ku − wk2 > ku − projW uk2
or equivalently,
ku − wk > ku − projW uk
1
P
u u − projW u
Q
projW u
W
u−w
u
u − projW u
O w
Q
projW u
W
2
Let e = Ax − b, the error vector that results from the approximation x.
For each n×1 matrix x, the product Ax is a linear combination of the column
vectors of A. Hence as x varies over Rn the vector Ax varies over the entire
column space W . Geometrically, solving the least squares problems is simply
to find a vector x in Rn such that Ax is the closest vector in W to b.
It follows from the Best Approximation Theorem that the closest vector in
W to b is the orthogonal projection of b on W . Thus, for a vector x to be a
least squares solution of Ax = b, this vector must satisfy
Ax = projW b (∗)
Ax
W
b − Ax = b − projW b
AT (b − Ax) = 0
3
or equivalently,
AT Ax = AT b
This is called the normal system associated with Ax = b, and the individual
equations are called the normal equations associated with Ax = b.
Ax = b,
AT Ax̂ = AT b,
4x1 = 2
2x2 = 0
x1 + x2 = 11
4
Given Ax = b, as above, we first form a new system, the so-called system of
normal equations:
AT Ax̂ = AT b.
4 0
T 4 0 1
Since A = 0 2 , we see that A = , hence
0 2 1
1 1
4 0 2
4 0 1 17 1 4 0 1
AT A = 0 2 = , and AT b = 0 =
0 2 1 1 5 0 2 1
1 1 11
19
.
11
So the system of normal equations AT Ax̂ = AT b in our case is
17 1 x̂1 19 17x̂1 + x̂2 = 19
= or .
1 5 x̂2 11 x̂1 + 5x̂2 = 11
One can solve this system by using the techniques learnt in the first half of
the semester and obtain x̂1 = 1 and x̂2 = 2, i.e., the least-squares solution to
the original system is
x̂1 1
x̂ = = .
x̂2 2
kb − Ax̂k.
2 4 0
1
In our case, b = 0 , A = 0 2 , and x̂ = . Hence Ax̂ =
2
11 1 1
4 0 4 2 4 −2
0 2 1 = 4 , b − Ax̂ = 0 − 4 = −4 and
2
1 1 3 11 3 8
p √
kb − Ax̂k = (−2)2 + (−4)2 + 82 = 84.
5
3 The Least-Squares Lines.
Suppose you are given the following data points:
(2, 1), (5, 2), (7, 3), (8, 3)
.
If you plot these 4 points on a graph, a straight-line graph is suggested, but
the four points do not perfectly fit on a single straight line.
Our aim now is to find the best straight line that fits the data.
A straight line is given by the equation y = a + bx. Once we know a and b,
we have our line. So let us find the “best” a and b for the data given above:
The first point says that, if x = 2, then y = 1, giving the equation
1 = a + b(2) = a + 2b.
The rest of the equations are
2 = a + 5b, 3 = a + 7b, & 3 = a + 8b
, so we have the following system of linear equations:
a + 2b = 1
a + 5b = 2
a + 7b = 3
a + 8b = 3
and we want to solve for a and b.
If the data points are not collinear, the it is impossible to find the coefficients
a and b that satisfy the system of liner equations exactly. This is an inconsistent
system.
In this case we shall look for a least squares solution.
1 2 1
1 5
, x = a , and b = 2 , then in matrix form the
If we let A =
1 7 b 3
1 8 3
system is the now familiar
Ax = b
6
and we have to solve the system of normal equations
AT Ax̂ = AT b
1 2
1 1 1 1 1 5 4 22
as we did before: AT A = = ,
2 5 7 8 1 7 22 142
1 8
1
1 1 1 1 2 9
AT b = = and the system of normal equations is
2 5 7 8 3 57
3
4 22 â 9
= .
22 142 b̂ 57
i.e., â = 2/7 and b̂ = 5/14 are the best choices for a and b, and the least-squares
line is
2 5
y = + x.
7 14