Computing least-squares solution - non-orthogonal case
Computing least-squares solution: non-orthogonal case
Problem: Consider the matrix equation There is no exact solution; find the best approximate “least-squares” solution and the resulting error.
Solution: Write and for the matrix and vector. Next calculate , and . Now solve the matrix equation
We use row-reduction on the augmented matrix:
Therefore and .
To compute the error, first find :
and then subtract from and compute the norm:
Computing least-squares solution - orthogonal case
Computing least-squares solution: orthogonal case
Problem: Find the least-squares solution for the following matrix equation:
Notice that the second column of the matrix and the vector represent the and values, respectively, of the data from Exercise 07-02.
Solution: The matrix columns are orthogonal. In this situation it is faster to compute the projection directly:
Furthermore, we have and for the coefficients of that give the best approximate solution, since these are the weights on the columns of that yield the projection. Therefore is our solution.
Finally, the error is given by:
Finding a best fit cubic
Finding a best fit cubic
Suppose we have some data like this:
Input: 1 2 3 4 5 6 Output: 5 9 8 4 6 8 Let’s fit a cubic polynomial to this data. We use the objects:
First, compute:
Row reduction of the augmented matrix yields:
Therefore our best fit cubic polynomial is:
Using Penrose quasi-inverse to solve LLS
Using Penrose quasi-inverse to solve LLS
In an exercise on computing an SVD by hand we found the following SVD:
Problem: Use the SVD above in order to (a) find the Penrose quasi-inverse , and (b) find a vector that minimizes for .
Solution: The quasi-inverse is formed by transposing and inverting the entries. We obtain for (a):
Then (b) to solve the LLS, we simply compute and obtain .
Notice that after calculating once, we can solve any LLS problem very efficiently. That is a nice feature.