Exercise 3.4.1. a) Given the following four data points:
write down the four equations for fitting to the data.
b) Find the line fit by least squares and calculate the error .
c) Given the value of what is in relation to the column space? What is the projection of on the column space?
Answer: a) This corresponds to a system of the form as follows:
The equivalent system of equations is:
b) To find the least squares solution we multiply both sides by to create a system of the form . We have
so that the new system is
From the second equation we have and from the first equation we have .
The resulting graph is a line with slope of 1 and -intercept of -2. For the values of of -2, -1, 1, and 2 the values of are -4, -3, -1, and 0 respectively. But these are exactly the same as the values of in the given data points. Therefore we have .
c) Since the vector must be in the column space of , and the projection of onto the column space is simply itself.
NOTE: This continues a series of posts containing worked out exercises from the (out of print) book Linear Algebra and Its Applications, Third Edition by Gilbert Strang.
If you find these posts useful I encourage you to also check out the more current Linear Algebra and Its Applications, Fourth Edition, Dr Strang’s introductory textbook Introduction to Linear Algebra, Fifth Edition and the accompanying free online course, and Dr Strang’s other books.