Linear Algebra and Its Applications, Exercise 3.3.23

Exercise 3.3.23. Given measurements y_1, y_2, \dots, y_m show that the best least squares fit to the horizontal line y = C is given by

C = (y_1 + y_2 + \cdots + y_m)/m

Answer: This corresponds to the system Ax = b where A is an m by 1 matrix with all entries equal to 1 and b = (y_1, y_2, \cdots, y_m). To find the least squares solution we form the system A^TA\bar{x} = A^Tb. We have

A^TA = \begin{bmatrix} 1&1&\cdots&1 \end{bmatrix} \begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix} = \sum_{i=1}^m 1 = m


A^Tb = \begin{bmatrix} 1&1&\cdots&1 \end{bmatrix} \begin{bmatrix} y_1 \\ y_2 \\ \vdots \\ y_m \end{bmatrix} = \sum_{i=1}^m y_i

The system A^TA\bar{x} = A^Tb thus reduces to m\bar{C} = \sum_{i=1}^m y_i so that

\bar{C} = (y_1 + y_2 + \cdots + y_m)/m

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: Logo

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

Facebook photo

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

Connecting to %s