Exercise 3.3.2. We have the value at time
and the value
at time
. We wish to fit these values using a line constrained to go through the origin, i.e., with an equation of the form
. Solve the system using least squares and describe the best fit line.
Answer: In general we would fit a line of the form ; however since we want the fitted line to go through the origin we have
and are fitting a line of the form
. Given the values of
and
at
and
respectively we have the following system of two equations:
This system corresponds to the general matrix equation
which in this case becomes
This system has no solution. However we can find a least squares solution in general using the matrix equation
In this case this corresponds to the equation
or
We then have or
.
So the least squares solution is the line . This line passes through the origin (i.e., at
it has a value of zero). At time
it has the value 3, which is greater than the value
. At time
it has the value 6, which is less than the value
.
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, Fourth Edition
and the accompanying free online course, and Dr Strang’s other books
.