Summary: Math 411 Numerical Linear Algebra, Professor: Rakhim Aitbayev, April 4, 2003 1
· Turn your test papers in on Tuesday, April 6.
· You must work individually on this test.
· Attach printouts of your computer code and its output with your comments.
Problem 1. Describe an algorithm to solve a least squares problem with a full-rank matrix.
Problem 2. Write a MATLAB program that solves the least squares problem with a full-rank
matrix A Rn×m. Include a reasonable number of comments in your program.
The code should first implement a QR decomposition, A = QR, where Q Rn×n is a product
of reflectors and R = [ ^R 0]T Rn×m, where ^R is m × m and upper triangular. Make use of
algorithms (3.2.37), (3.2.40), and (3.2.45).
Then, the code should use the QR decomposition to find x, the solution of the least squares
problem. Calculate c = QT b = QmQm-1 . . . Q1b by applying the reflectors subsequently.
An additional one-dimensional array is needed for b. This array can also be used for c and
intermediate results. The solution x is found by solving ^Rx = ^c by back substitution, where
c = [^c d]T . Find the minimum value of Ax - b 2 without computing Ax - b.
1. Use your program to solve the following problems.
(a) Find the least squares quadratic polynomial for the data.
ti -1 -0.75 -0.5 0 0.25 0.5 0.75