## Linear Algebra and Its Applications, Exercise 3.4.16

Exercise 3.4.16. Given the matrix $A$ whose columns are the following two vectors $a_1$ and $a_3$ [sic]:

$a_1 = \begin{bmatrix} 1 \\ 2 \\ 2 \end{bmatrix} \quad a_3 = \begin{bmatrix} 1 \\ 3 \\ 1 \end{bmatrix}$

factor $A$ as $A = QR$. If there are $n$ vectors $a_j$ with $m$ elements each, what are the dimensions of $A$, $Q$, and $R$?

Answer: With $a_1$ and $a_3$ as the two columns of $A$, we first choose $a_1' = a_1 = (1, 2, 2)$. We then have

$a_3' = a_3 - \frac{(a_1')^Ta_3}{(a_1')^Ta_1'}a_1' = a_3 - \frac{1 \cdot 1 + 2 \cdot 3 + 2 \cdot 1}{1^2 + 2^2 + 2^2}a_1' = a_3 - \frac{9}{9}a_1' = a_3 - a_1'$

$= \begin{bmatrix} 1 \\ 3 \\ 1 \end{bmatrix} - \begin{bmatrix} 1 \\ 2 \\ 2 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \\ -1 \end{bmatrix}$

Now that we have calculated the orthogonal vectors $a_1'$ and $a_3'$ we can normalize them to create the orthonormal vectors $q_1$ and $q_3$. We have

$\|a_1'\| = \sqrt{1^2 + 2^2 + 2^2} = \sqrt{9} = 3$

$\|a_3'\| = \sqrt{0^2 + 1^2 + (-1)^2} = \sqrt{2}$

so that

$q_1 = a_1' / \|a_1'\| = \frac{1}{3} \begin{bmatrix} 1 \\ 2 \\ 2 \end{bmatrix} = \begin{bmatrix} \frac{1}{3} \\ \frac{2}{3} \\ \frac{2}{3} \end{bmatrix}$

$q_3 = a_3' / \|a_3'\| = \frac{1}{\sqrt{2}} \begin{bmatrix} 0 \\ 1 \\ -1 \end{bmatrix} = \begin{bmatrix} 0 \\ \frac{1}{\sqrt{2}} \\ -\frac{1}{\sqrt{2}} \end{bmatrix}$

The matrix $Q$ is the 3 by 2 matrix with columns $q_1$ and $q_3$:

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

The matrix $R$ is the 2 by 2 matrix calculated as follows:

$R = \begin{bmatrix} q_1^Ta_1&q_1^Ta_3 \\ 0&q_3^Ta_3 \end{bmatrix} = \begin{bmatrix} \frac{1}{3} \cdot 1 + \frac{2}{3} \cdot 2 + \frac{2}{3} \cdot 2&\frac{1}{3} \cdot 1 + \frac{2}{3} \cdot 3 + \frac{2}{3} \cdot 1 \\ 0&0 \cdot 1 + \frac{1}{\sqrt{2}} \cdot 3 + (-\frac{1}{\sqrt{2}}) \cdot 1 \end{bmatrix}$

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

If there are $n$ vectors $a_j$ with $m$ elements each, since they form the columns of $A$ the shape of $A$ will be $m$ by $n$. The matrix $Q$ contains one orthonormal column for each column in $A$, and its orthonormal columns have the same number of elements as the columns of $A$, so $Q$ is also $m$ by $n$. Finally, $R$ is a square matrix with one column for each column of $Q$, so it is $n$ by $n$.

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.