Linear Algebra and Its Applications, Exercise 3.3.22

Exercise 3.3.22. Given measurements of b = 4, 2, -1, 0, 0 at t = -2, -1, 0, 1, 2 use least squares to find the line of best fit of the form C + Dt.

Answer: This corresponds to a system Ax = b as follows:

\begin{bmatrix} 1&-2 \\ 1&-1 \\ 1&0 \\ 1&1 \\ 1&2 \end{bmatrix} \begin{bmatrix} C \\ D \end{bmatrix} = \begin{bmatrix} 4 \\ 2 \\ -1 \\ 0 \\ 0 \end{bmatrix}

To find the least squares solution we form the system A^TA\bar{x} = A^Tb. We have

A^TA = \begin{bmatrix} 1&1&1&1&1 \\ -2&-1&0&1&2 \end{bmatrix} \begin{bmatrix} 1&-2 \\ 1&-1 \\ 1&0 \\ 1&1 \\ 1&2 \end{bmatrix}

= \begin{bmatrix} 5&0 \\ 0&10 \end{bmatrix}

and

A^Tb = \begin{bmatrix} 1&1&1&1&1 \\ -2&-1&0&1&2 \end{bmatrix} \begin{bmatrix} 4 \\ 2 \\ -1 \\ 0 \\ 0 \end{bmatrix} = \begin{bmatrix} 5 \\ -10 \end{bmatrix}

The system A^TA\bar{x} = A^Tb is then

\begin{bmatrix} 5&0 \\ 0&10 \end{bmatrix} \begin{bmatrix} \bar{C} \\ \bar{D} \end{bmatrix} = \begin{bmatrix} 5 \\ -10 \end{bmatrix}

From the second equation we have \bar{D} = -1 and from the first equation we have \bar{C} = 1. The line of best fit is therefore 1 - t.

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.

This entry was posted in linear algebra and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s