## Linear Algebra and Its Applications, Exercise 3.4.12

Exercise 3.4.12. Given the vectors $a_1 = (1, 1)$ and $a_2 = (4, 0)$, find a scalar $c$ such that $a_2 - ca_1$ is orthogonal to $a_1$. Given the matrix $A = \begin{bmatrix} 1&4 \\ 1&0 \end{bmatrix}$ whose columns are $a_1$ and $a_2$ respectively, find matrices $Q$ and $R$ such that $Q$ is orthogonal and $A = QR$.

Answer: We must have $a_1^T(a_2 - ca_1) = 0$. This implies that $a_1^Ta_2 = c(a_1^Ta_1)$ or

$c = \frac{a_1^Ta_2}{a_1^Ta_1} = \frac{1 \cdot 4 + 1 \cdot 0}{1 \cdot 1 + 1 \cdot 1} = \frac{4}{2} = 2$

So the scalar multiplying $a_1$ is 2.

As a check, we then have

$a_2 - ca_1 = \begin{bmatrix} 4 \\ 0 \end{bmatrix} - 2 \cdot \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ -2 \end{bmatrix}$

with $a_1^T(a_2 - ca_1) = 1 \cdot 2 + 1 \cdot -2 = 2 - 2 = 0$. So the new vector is orthogonal to $a_1$.

We now attempt to factor $A = \begin{bmatrix} 1&4 \\ 1&0 \end{bmatrix}$ into $QR$. If we perform Gram-Schmidt orthogonalization on $A$, the first column of $Q$ is $q_1 = a_1 / \|a_1\|$. We have $\|a_1\| = \sqrt{a_1^Ta_1} = \sqrt{2}$, so $q_1 = (\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}})$. The length $\|a_1\| = \sqrt{2}$ would then be the 1, 1 entry of the matrix $R$. We thus have

$Q = \begin{bmatrix} \frac{1}{\sqrt{2}}&? \\ \frac{1}{\sqrt{2}}&? \end{bmatrix} \qquad R = \begin{bmatrix} \sqrt{2}&? \\ ?&? \end{bmatrix}$

The second column $q_2$ of $Q$ is created by first subtracting from $a_2$ the projection of $a_2$ onto $q_1$ and then normalizing the result. The result of subtracting the projection is

$a_2 - (q_1^Ta_2)q_1 = \begin{bmatrix} 4 \\ 0 \end{bmatrix} - (\frac{1}{\sqrt{2}} \cdot 4 + \frac{1}{\sqrt{2}} \cdot 0) \cdot \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix}$

$= \begin{bmatrix} 4 \\ 0 \end{bmatrix} - \frac{4}{\sqrt{2}} \cdot \begin{bmatrix} \frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}} \end{bmatrix} = \begin{bmatrix} 4 \\ 0 \end{bmatrix} - \begin{bmatrix} 2 \\ 2 \end{bmatrix} = \begin{bmatrix} 2 \\ -2 \end{bmatrix}$

The length of this vector is $\sqrt{2^2 + (-2)^2} = \sqrt{8} = 2 \sqrt{2}$, so we have

$q_2 = \frac{1}{2 \sqrt{2}} \begin{bmatrix} 2 \\ -2 \end{bmatrix} = \begin{bmatrix} \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} \end{bmatrix}$

The matrix $Q$ is then

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

The second diagonal entry of the matrix $R$ is the length $2\sqrt{2}$ used in computing $q_2$. The off-diagonal element of $R$ is the value $q_1^Ta_2 = \frac{4}{\sqrt{2}} = 2 \sqrt{2}$ used in subtracting from $a_2$ the component in the direction of $q_1$. We thus have

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

The product of the two matrices is then

$QR = \begin{bmatrix} \frac{1}{\sqrt{2}}&\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}}&-\frac{1}{\sqrt{2}} \end{bmatrix} \begin{bmatrix} \sqrt{2}&2\sqrt{2} \\ 0&2\sqrt{2} \end{bmatrix} = \begin{bmatrix} 1&4 \\ 1&0 \end{bmatrix} = A$

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.