## Linear Algebra and Its Applications, Exercise 3.4.17

Exercise 3.4.17. Given the matrix

$A = \begin{bmatrix} 1&1 \\ 2&3 \\ 2&1 \end{bmatrix}$

from the previous exercise and the vector $b = (1, 1, 1)$, solve $Ax = b$ by least squares using the factorization $A = QR$.

Answer: From the previous exercise we have

$Q = \begin{bmatrix} \frac{1}{3}&0 \\ \frac{2}{3}&\frac{1}{\sqrt{2}} \\ \frac{2}{3}&-\frac{1}{\sqrt{2}} \end{bmatrix}$

$R = \begin{bmatrix} 3&3 \\ 0&\sqrt{2} \end{bmatrix}$

To find the least squares solution $\bar{x}$ to $Ax = b$ where $b = (1, 1, 1)$, we take advantage of the fact that $R\bar{x} = Q^Tb$.

On the right side of the equation we have

$Q^Tb = \begin{bmatrix} \frac{1}{3}&\frac{2}{3}&\frac{2}{3} \\ 0&\frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}} \end{bmatrix} \begin{bmatrix} 1 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} \frac{5}{3} \\ 0 \end{bmatrix}$

so that the system $R\bar{x} = Q^Tb$ is then

$\begin{bmatrix} 3&3 \\ 0&\sqrt{2} \end{bmatrix} \begin{bmatrix} \bar{x_1} \\ \bar{x_2} \end{bmatrix} = \begin{bmatrix} \frac{5}{3} \\ 0 \end{bmatrix}$

From the second equation we have $\bar{x_2} = 0$. Substituting into the first equation we have $3\bar{x_1} + 3\bar{x_2} = 3\bar{x_1} + 3 \cdot 0 = \frac{5}{3}$ so that $3\bar{x_1} = \frac{5}{3}$ or $\bar{x_1} = \frac{5}{9}$.

The least squares solution to $Ax = b$ with $b = (1, 1, 1)$ is therefore $\bar{x} = (\frac{5}{9}, 0)$.

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.