Least Squares Definition and Derivations We have already spent much time finding solutions to Ax = b If there isn't a solution, we attempt to seek the x that gets closest to being a solution. The closest such vector will be the x such that Ax = proj_{W}b where W is the column space of A.
Notice that b  proj_{W}b is in the orthogonal complement of W hence in the null space of A^{T}. Hence if x is a this closest vector, then A^{T}(b  Ax) = 0 A^{T}Ax = A^{T}b Now we need to show that A^{T}A nonsingular so that we can solve for x. Lemma If A is an m x n matrix of rank n, then A^{T}A is nonsingular.
Proof We want to show that the null space of A^{T}A is zero. If 0 = A^{T}Ax then multiplying both sides by x^{T}, we get 0 = x^{T}A^{T}Ax = (Ax)^{T}Ax = Ax ^{.} Ax = Ax^{2} If the magnitude of a vector is zero, then the vector is zero, hence Ax = 0 Since rank(A) = n we can conclude that x = 0 We can now state the main theorem. Let A be an m x n matrix or rank n, then the system Ax = b has the unique least squares solution x = (A^{T}A) ^{1}A^{T}b Examples Example Find the least squares solution to Ax = b with
Solution We can quickly check that A has rank 2 (the first two rows are not multiples of each other). Hence we can compute
Notice that
not exactly b, but as close as we are going to get. Least Squares Regression Line Of fundamental importance in statistical analysis is finding the least squares regression line. ExampleAn engineer is tracking the friction index over mileage of a breaking system of a vehicle. She expects that the mileagefriction relationship is approximately linear. She collects five data points that are show in the table below.
The graph below shows these points
We are interested in the line that best fits the data. More specifically, if b is the vector of friction index data values and y is the vector consisting of y values when we plug in the mileage data for x and find y by the equation of the line, then we want the line that minimizes the distance between b and y. If the equation of the line is ax + b = y then we get the five equations 2a + b
= 20 The corresponding matrix equation is Ax = b or
Although this does not have an exact solution, it does have a closest solution. We have
We can conclude that the equation of the regression line is y = 0.48x + 20.6 Best Fitting Curves Often, a line is not the best model for the data. Fortunately the same technique works if we want to use other nonlinear curves to fit the data. Here we will explain how to find the least squares cubic. The process for other polynomials is similar.
Example A bioengineer is studying the growth of a genetically engineered bacteria culture and suspects that is it approximately follows a cubic model. He collects six data points listed below
He assumes the equation has the form ax^{3} + bx^{2} + cx + d = y This gives six equations with four unknowns
a + b + c + d = 2.1 The corresponding matrix equation is
We can use the least squares equation to find the best solution
So that the best fitting cubic is y = 0.2x^{3}  2.0x^{2} + 6.1x  2.3 The graph is shown below
Back to the Matrices and Vectors Home Page Back to the Linear Algebra Home Page Back to the Math Department Home Page email Questions and Suggestions
