8 Orthogonality

Recall that two nonzero vectors 𝒖\mathbf{u}, 𝒗\mathbf{v} ∈\in ℝn\mathbb{R}^n are orthogonal if 𝒖⋅𝒗=0\mathbf{u}\cdot\mathbf{v}=0 The zero vector is orthogonal to every vector in ℝn\mathbb{R}^n.
𝒖⋅𝒗=0⇔θ=π2\mathbf{u}\cdot\mathbf{v}=0 \iff \theta = \frac{\pi}{2}, where θ=𝒖⋅𝒗∥𝒖∥∥𝒗∥\theta = \frac{\mathbf{u}\cdot\mathbf{v}}{\|\mathbf{u}\|\|\mathbf{v}\|}.

8.1 Orthogonal Complements

If a vector 𝒛\mathbf{z} is orthogonal to every vector in a subspace WW in ℝn\mathbb{R}^n, then 𝒛\mathbf{z} is orthogonal to WW.
The set of all vectors zz that are orthogonal to WW is the orthogonal complement of WW, denoted by W⟂W^\perp.

  1. Vector 𝒙∈W⇔𝒙\mathbf{x} \in W \iff \mathbf{x} is orthogonal to every vector in a set that spans WW.

    • Only need to check if 𝒙\mathbf{x} is perpendicular to the vectors that span WW (its basis vectors).

  2. W⟂W^\perp is a subspace of ℝn\mathbb{R}^n.

    • W⟂W^\perp contains the zero vector and is closed under addition and scalar multiplication.

L=W⟂L = W^\perp and W=L⟂W = L^\perp
The four fundamental subspaces of any matrix

An m×nm \times n matrix AA acts as a linear transformation mapping vectors from a domain (ℝn\mathbb{R}^n) to a codomain (ℝm\mathbb{R}^m).
We have the following relationships: (Row A)⟂=Nul Aand(Col A)⟂=Nul AT(\text{Row } A)^\perp = \text{Nul } A \quad \text{and} \quad (\text{Col } A)^\perp = \text{Nul } A^T Proof.

  1. Nul A⊆(Row A)⟂\text{Nul } A \subseteq (\text{Row } A)^\perp: If a vector 𝒙\mathbf{x} is in Nul A\text{Nul } A, then A𝒙=𝟎A\mathbf{x} = \mathbf{0}. When you compute A𝒙A\mathbf{x}, you are taking the dot product of each row of AA with the vector 𝒙\mathbf{x}. Because the result is a zero vector, 𝒙\mathbf{x} must be orthogonal to every single row of AA. Because the rows of AA span Row A\text{Row } A, 𝒙\mathbf{x} is orthogonal to the entire row space.

  2. (Row A)⟂⊆Nul A(\text{Row } A)^\perp \subseteq \text{Nul } A: If we start with a vector 𝒙\mathbf{x} that is orthogonal to Row A\text{Row } A, it must inherently be orthogonal to each individual row of AA. Therefore, the dot product of each row with 𝒙\mathbf{x} is 00, meaning A𝒙=𝟎A\mathbf{x} = \mathbf{0}. This confirms 𝒙\mathbf{x} is in Nul A\text{Nul } A.

  3. Substituting ATA^T into the first rule gives: (Row AT)⟂=Nul AT⟹(Col A)⟂=Nul AT(\text{Row } A^T)^\perp = \text{Nul } A^T \implies (\text{Col } A)^\perp = \text{Nul } A^T.

8.2 Orthogonal Projections

Decomposition of 𝒖\mathbf{u}

Sometimes, we need to break a vector 𝒖\mathbf{u} into two orthogonal vectors relative to reference vector 𝒂\mathbf{a}.

8.2.0.1 Projection Theorem

We can express 𝒖\mathbf{u} exactly one way as 𝒖=𝒘1+𝒘2\mathbf{u} = \mathbf{w}_1 + \mathbf{w}_2 where 𝒘1\mathbf{w}_1 is a scalar multiple of 𝒂\mathbf{a}, and 𝒘2\mathbf{w}_2 is a vector orthogonal to 𝒂\mathbf{a}.
𝒘1\mathbf{w}_1 is the orthogonal projection of 𝒖\mathbf{u} onto 𝒂\mathbf{a}. proj𝒂𝒖=(𝒖⋅𝒂∥𝒂∥2)𝒂=(𝒖⋅𝒂∥𝒂∥)𝒂∥𝒂∥=∥𝒖∥cos⁡θ⋅𝒂̂\text{proj}_\mathbf{a} \mathbf{u} = \left( \frac{\mathbf{u} \cdot \mathbf{a}}{\|\mathbf{a}\|^2} \right) \mathbf{a} = \left( \frac{\mathbf{u}\cdot\mathbf{a}}{\|\mathbf{a}\|}\right) \frac{\mathbf{a}}{\|\mathbf{a}\|} = \|\mathbf{u}\|\cos\theta \cdot \hat{\mathbf{a}} 𝒘2\mathbf{w}_2 is vector component of 𝒖\mathbf{u} orthogonal to 𝒂\mathbf{a} (or the residual). 𝒘2=𝒖−proj𝒂𝒖\mathbf{w}_2 = \mathbf{u} - \text{proj}_\mathbf{a} \mathbf{u} The norm of the projection is ∥proj𝒂𝒖∥=|𝒖⋅𝒂|∥𝒂∥=∥𝒖∥|cos⁡θ|\|\text{proj}_\mathbf{a} \mathbf{u}\| = \frac{|\mathbf{u} \cdot \mathbf{a}|}{\|\mathbf{a}\|} = \|\mathbf{u}\| |\cos \theta|

8.2.0.2 Pythagoras’ Theorem in ℝn\mathbb{R}^n

If 𝒖\mathbf{u} and 𝒗\mathbf{v} are orthogonal vectors, then ∥𝒖+𝒗∥2=∥𝒖∥2+∥𝒗∥2\|\mathbf{u} + \mathbf{v}\|^2 = \|\mathbf{u}\|^2 + \|\mathbf{v}\|^2 Proof. ∥𝒖+𝒗∥2=(𝒖+𝒗)⋅(𝒖+𝒗)=∥𝒖∥2+2(𝒖⋅𝒗)+∥𝒗∥2=∥𝒖+𝒗∥2=∥𝒖∥2+∥𝒗∥2\|\mathbf{u} + \mathbf{v}\|^2 = (\mathbf{u} + \mathbf{v}) \cdot (\mathbf{u} + \mathbf{v}) = \|\mathbf{u}\|^2 + 2(\mathbf{u} \cdot \mathbf{v}) + \|\mathbf{v}\|^2 = \|\mathbf{u} + \mathbf{v}\|^2 = \|\mathbf{u}\|^2 + \|\mathbf{v}\|^2

8.3 Orthogonal Sets & Bases

A set of vectors {𝒖1,…,𝒖p}\{\mathbf{u}_1, \dots, \mathbf{u}_p\} in ℝn\mathbb{R}^n is said to be an orthogonal set if each pair of distinct vectors from the set is orthogonal. Mathematically, this means their dot product is zero: 𝒖i⋅𝒖j=0wheneveri≠j\mathbf{u}_i \cdot \mathbf{u}_j = 0 \quad \text{whenever} \quad i \neq j

8.3.0.1 Theorem

If S={𝒖1,…,𝒖p}S = \{\mathbf{u}_1, \dots, \mathbf{u}_p\} is an orthogonal set of nonzero vectors in ℝn\mathbb{R}^n, then SS is linearly independent and hence is an orthogonal basis for the subspace spanned by SS.
Note that p≤np \leq n. If p=np=n, then SS is an orthogonal basis for the entire space ℝn\mathbb{R}^n.
Note also that not all bases are orthogonal.
Proof. Assume there is a linear combination that equals the zero vector: 𝟎=c1𝒖1+…+cp𝒖p\mathbf{0} = c_1\mathbf{u}_1 + \dots + c_p\mathbf{u}_p If we take the dot product of both sides with 𝒖1\mathbf{u}_1: 𝟎⋅𝒖1=(c1𝒖1+c2𝒖2+…+cp𝒖p)⋅𝒖1\mathbf{0} \cdot \mathbf{u}_1 = (c_1\mathbf{u}_1 + c_2\mathbf{u}_2 + \dots + c_p\mathbf{u}_p) \cdot \mathbf{u}_1 0=c1(𝒖1⋅𝒖1)+c2(𝒖2⋅𝒖1)+…+cp(𝒖p⋅𝒖1)0 = c_1(\mathbf{u}_1 \cdot \mathbf{u}_1) + c_2(\mathbf{u}_2 \cdot \mathbf{u}_1) + \dots + c_p(\mathbf{u}_p \cdot \mathbf{u}_1) Because SS is an orthogonal set, all dot products where i≠ji \neq j are zero. This leaves: 0=c1(𝒖1⋅𝒖1)0 = c_1(\mathbf{u}_1 \cdot \mathbf{u}_1) Since 𝒖1\mathbf{u}_1 is a nonzero vector, 𝒖1⋅𝒖1\mathbf{u}_1 \cdot \mathbf{u}_1 is not zero. Therefore, c1c_1 must be 00. By repeating this for each vector, all weights cic_i must be zero, proving the set is linearly independent.

8.3.1 Computing Coordinates Relative to an Orthogonal Basis

8.3.1.1 Theorem

Let {𝒖1,…,𝒖p}\{\mathbf{u}_1, \dots, \mathbf{u}_p\} be an orthogonal basis for a subspace WW of ℝn\mathbb{R}^n. For each 𝒚\mathbf{y} in WW, the weights in the linear combination 𝒚=c1𝒖1+…+cp𝒖p\mathbf{y} = c_1\mathbf{u}_1 + \dots + c_p\mathbf{u}_p are given by: cj=𝒚⋅𝒖j𝒖j⋅𝒖j(j=1,…,p)c_j = \frac{\mathbf{y} \cdot \mathbf{u}_j}{\mathbf{u}_j \cdot \mathbf{u}_j} \quad (j = 1, \dots, p) The proof for this is similar to the above theorem.

8.3.2 Orthogonal Projections onto Subspaces

8.3.2.1 Theorem

Let WW be a subspace of ℝn\mathbb{R}^n. Then each 𝒚\mathbf{y} in ℝn\mathbb{R}^n can be written uniquely in the form: 𝒚=𝒚̂+𝒛\mathbf{y} = \hat{\mathbf{y}} + \mathbf{z} where 𝒚̂\hat{\mathbf{y}} is in WW and 𝒛\mathbf{z} is in W⟂W^\perp (orthogonal to WW).
If {𝒖1,…,𝒖p}\{\mathbf{u}_1, \dots, \mathbf{u}_p\} is any orthogonal basis of WW, then the orthogonal projection of 𝒚\mathbf{y} onto WW (denoted as 𝒚̂\hat{\mathbf{y}} or projW𝒚\text{proj}_W \mathbf{y}) is calculated as: 𝒚̂=(𝒚⋅𝒖1𝒖1⋅𝒖1)𝒖1+…+(𝒚⋅𝒖p𝒖p⋅𝒖p)𝒖p\hat{\mathbf{y}} = \left(\frac{\mathbf{y} \cdot \mathbf{u}_1}{\mathbf{u}_1 \cdot \mathbf{u}_1}\right)\mathbf{u}_1 + \dots + \left(\frac{\mathbf{y} \cdot \mathbf{u}_p}{\mathbf{u}_p \cdot \mathbf{u}_p}\right)\mathbf{u}_p and the residual is 𝒛=𝒚−𝒚̂\mathbf{z} = \mathbf{y} - \hat{\mathbf{y}}.
Example: Let {𝒖1,…,𝒖5}\{\mathbf{u}_1, \dots, \mathbf{u}_5\} be an orthogonal basis for ℝ5\mathbb{R}^5 and let 𝒚=c1𝒖1+…+c5𝒖5\mathbf{y} = c_1\mathbf{u}_1 + \dots + c_5\mathbf{u}_5. Consider the subspace W=Span{𝒖1,𝒖2}W = \text{Span}\{\mathbf{u}_1, \mathbf{u}_2\}. Write 𝒚\mathbf{y} as the sum of a vector 𝒛1\mathbf{z}_1 in WW and a vector 𝒛2\mathbf{z}_2 in W⟂W^\perp.
Naturally, group the terms based on the orthogonal basis: 𝒚=c1𝒖1+c2𝒖2⏟𝒛1+c3𝒖3+c4𝒖4+c5𝒖5⏟𝒛2\mathbf{y} = \underbrace{c_1\mathbf{u}_1 + c_2\mathbf{u}_2}_{\mathbf{z}_1} + \underbrace{c_3\mathbf{u}_3 + c_4\mathbf{u}_4 + c_5\mathbf{u}_5}_{\mathbf{z}_2}

  1. 𝒛1\mathbf{z}_1 is clearly in Span{𝒖1,𝒖2}\text{Span}\{\mathbf{u}_1, \mathbf{u}_2\} (which is WW).

  2. To prove 𝒛2\mathbf{z}_2 is in W⟂W^\perp, we must show it is orthogonal to the basis of WW. Let’s check against 𝒖1\mathbf{u}_1: 𝒛2⋅𝒖1=(c3𝒖3+c4𝒖4+c5𝒖5)⋅𝒖1=c3(𝒖3⋅𝒖1)+c4(𝒖4⋅𝒖1)+c5(𝒖5⋅𝒖1)=0\mathbf{z}_2 \cdot \mathbf{u}_1 = (c_3\mathbf{u}_3 + c_4\mathbf{u}_4 + c_5\mathbf{u}_5) \cdot \mathbf{u}_1 = c_3(\mathbf{u}_3 \cdot \mathbf{u}_1) + c_4(\mathbf{u}_4 \cdot \mathbf{u}_1) + c_5(\mathbf{u}_5 \cdot \mathbf{u}_1) = 0 A similar calculation shows 𝒛2⋅𝒖2=0\mathbf{z}_2 \cdot \mathbf{u}_2 = 0. Thus, 𝒛2\mathbf{z}_2 is in W⟂W^\perp.

8.4 Orthonormal Sets & Orthogonal Matrices

8.4.1 Orthonormal sets

A set of vectors {𝒖1,…,𝒖p}\{\mathbf{u}_1, \dots, \mathbf{u}_p\} is an orthonormal set if it is an orthogonal set of unit vectors. 𝒖i⋅𝒖j=0(for i≠j)and𝒖i⋅𝒖i=1\mathbf{u}_i \cdot \mathbf{u}_j = 0 \quad (\text{for } i \neq j) \quad \text{and} \quad \mathbf{u}_i \cdot \mathbf{u}_i = 1 If an orthonormal set spans a subspace WW, it is an orthonormal basis for WW. (It is automatically linearly independent.)
The simplest example: The standard basis in ℝn\mathbb{R}^n (e.g., 𝒆1,𝒆2,…,𝒆n\mathbf{e}_1, \mathbf{e}_2, \dots, \mathbf{e}_n) is an orthonormal basis.
Example: Show that {𝒗1,𝒗2,𝒗3}\{\mathbf{v}_1, \mathbf{v}_2, \mathbf{v}_3\} is an orthonormal basis of ℝ3\mathbb{R}^3, where: 𝒗1=[3/111/111/11]\mathbf{v}_1 = \begin{bmatrix} 3/\sqrt{11} \\ 1/\sqrt{11} \\ 1/\sqrt{11} \end{bmatrix}, 𝒗2=[−1/62/61/6]\mathbf{v}_2 = \begin{bmatrix} -1/\sqrt{6} \\ 2/\sqrt{6} \\ 1/\sqrt{6} \end{bmatrix}, 𝒗3=[−1/66−4/667/66]\mathbf{v}_3 = \begin{bmatrix} -1/\sqrt{66} \\ -4/\sqrt{66} \\ 7/\sqrt{66} \end{bmatrix}.

  1. Check orthogonality: 𝒗1⋅𝒗2=−3/66+2/66+1/66=0\mathbf{v}_1 \cdot \mathbf{v}_2 = -3/\sqrt{66} + 2/\sqrt{66} + 1/\sqrt{66} = 0, and so on.

  2. Check unit length: 𝒗1⋅𝒗1=9/11+1/11+1/11=1\mathbf{v}_1 \cdot \mathbf{v}_1 = 9/11 + 1/11 + 1/11 = 1 and so on.

Hence it is an orthonormal set.

8.4.2 Matrices with Orthonormal Columns

8.4.2.1 Theorem

An m×nm \times n matrix UU has orthonormal columns if and only if UTU=IU^T U = I.
Proof. When you multiply UTUU^T U, the entry in row ii and column jj is the dot product of column 𝒖i\mathbf{u}_i and column 𝒖j\mathbf{u}_j.

UTU=[←𝒖1T→←𝒖2T→⋮←𝒖nT→][↑↑↑𝒖1𝒖2…𝒖n↓↓↓]=[𝒖1⋅𝒖1𝒖1⋅𝒖2…𝒖1⋅𝒖n𝒖2⋅𝒖1𝒖2⋅𝒖2…𝒖2⋅𝒖n⋮⋮⋱⋮𝒖n⋅𝒖1𝒖n⋅𝒖2…𝒖n⋅𝒖n]U^T U = \begin{bmatrix} \leftarrow \mathbf{u}_1^T \rightarrow \\ \leftarrow \mathbf{u}_2^T \rightarrow \\ \vdots \\ \leftarrow \mathbf{u}_n^T \rightarrow \end{bmatrix} \begin{bmatrix} \uparrow & \uparrow & & \uparrow \\ \mathbf{u}_1 & \mathbf{u}_2 & \dots & \mathbf{u}_n \\ \downarrow & \downarrow & & \downarrow \end{bmatrix} = \begin{bmatrix} \mathbf{u}_1 \cdot \mathbf{u}_1 & \mathbf{u}_1 \cdot \mathbf{u}_2 & \dots & \mathbf{u}_1 \cdot \mathbf{u}_n \\ \mathbf{u}_2 \cdot \mathbf{u}_1 & \mathbf{u}_2 \cdot \mathbf{u}_2 & \dots & \mathbf{u}_2 \cdot \mathbf{u}_n \\ \vdots & \vdots & \ddots & \vdots \\ \mathbf{u}_n \cdot \mathbf{u}_1 & \mathbf{u}_n \cdot \mathbf{u}_2 & \dots & \mathbf{u}_n \cdot \mathbf{u}_n \end{bmatrix} If the original vectors were orthonormal, it simplifies to: UTU=[10…001…0⋮⋮⋱⋮00…1]=IU^T U = \begin{bmatrix} 1 & 0 & \dots & 0 \\ 0 & 1 & \dots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \dots & 1 \end{bmatrix} = I

8.4.2.2 Theorem

Let UU be an m×nm \times n matrix with orthonormal columns, and let 𝒙\mathbf{x} and 𝒚\mathbf{y} be vectors in ℝn\mathbb{R}^n. Transforming vectors via UU preserves their lengths and their relationships to one another:

  1. Preserves Length: ∥U𝒙∥=∥𝒙∥\|U\mathbf{x}\| = \|\mathbf{x}\|

  2. Preserves Dot Product: (U𝒙)⋅(U𝒚)=𝒙⋅𝒚(U\mathbf{x}) \cdot (U\mathbf{y}) = \mathbf{x} \cdot \mathbf{y}

  3. Preserves Orthogonality: (U𝒙)⋅(U𝒚)=0(U\mathbf{x}) \cdot (U\mathbf{y}) = 0 if and only if 𝒙⋅𝒚=0\mathbf{x} \cdot \mathbf{y} = 0

Proof. Property 2: (U𝒙)⋅(U𝒚)=(U𝒙)T(U𝒚)=𝒙TUTU𝒚=𝒙TI𝒚=𝒙T𝒚=𝒙⋅𝒚(U\mathbf{x}) \cdot (U\mathbf{y}) = (U\mathbf{x})^T (U\mathbf{y}) = \mathbf{x}^T U^T U \mathbf{y} = \mathbf{x}^T I \mathbf{y} = \mathbf{x}^T \mathbf{y} = \mathbf{x} \cdot \mathbf{y}.
Property 1 follows as such: ∥U𝒙∥2=(U𝒙)⋅(U𝒙)=𝒙⋅𝒙=∥𝒙∥2\|U\mathbf{x}\|^2 = (U\mathbf{x}) \cdot (U\mathbf{x}) = \mathbf{x} \cdot \mathbf{x} = \|\mathbf{x}\|^2.
Example: Let U=[1/22/31/2−2/301/3]U = \begin{bmatrix} 1/\sqrt{2} & 2/3 \\ 1/\sqrt{2} & -2/3 \\ 0 & 1/3 \end{bmatrix} and 𝒙=[23]\mathbf{x} = \begin{bmatrix} \sqrt{2} \\ 3 \end{bmatrix}. Verify that ∥U𝒙∥=∥𝒙∥\|U\mathbf{x}\| = \|\mathbf{x}\|.
U𝒙=[1/22/31/2−2/301/3][23]=[1+21−20+1]=[3−11]U\mathbf{x} = \begin{bmatrix} 1/\sqrt{2} & 2/3 \\ 1/\sqrt{2} & -2/3 \\ 0 & 1/3 \end{bmatrix} \begin{bmatrix} \sqrt{2} \\ 3 \end{bmatrix} = \begin{bmatrix} 1 + 2 \\ 1 - 2 \\ 0 + 1 \end{bmatrix} = \begin{bmatrix} 3 \\ -1 \\ 1 \end{bmatrix} Compare norms:

8.4.3 Orthogonal matrices

If a matrix has orthonormal columns AND is square, it is an orthogonal matrix.
A orthogonal matrix QQ is a real square matrix, whose columns and rows are orthonormal vectors.

Reason: QQ is square, so its left inverse is also its right inverse, forcing QQT=IQQ^T = I. Just as QTQQ^TQ computes the dot products of the columns, QQTQQ^T computes the dot products of the rows: QQT=[←𝒓1→←𝒓2→⋮][↑↑𝒓1T𝒓2T…↓↓]=[𝒓1⋅𝒓1𝒓1⋅𝒓2𝒓2⋅𝒓1𝒓2⋅𝒓2]=[1001]QQ^T = \begin{bmatrix} \leftarrow \mathbf{r}_1 \rightarrow \\ \leftarrow \mathbf{r}_2 \rightarrow \\ \vdots \end{bmatrix} \begin{bmatrix} \uparrow & \uparrow & \\ \mathbf{r}_1^T & \mathbf{r}_2^T & \dots \\ \downarrow & \downarrow & \end{bmatrix} = \begin{bmatrix} \mathbf{r}_1 \cdot \mathbf{r}_1 & \mathbf{r}_1 \cdot \mathbf{r}_2 \\ \mathbf{r}_2 \cdot \mathbf{r}_1 & \mathbf{r}_2 \cdot \mathbf{r}_2 \end{bmatrix} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} Geometrically, if QQ is n×nn \times n orthogonal matrix, there are nn orthogonal columns in a nn-D space, hence forming a basis for the entire space.
A classic 2×22 \times 2 orthogonal matrix QQ is Q=[cos⁡(30∘)−sin⁡(30∘)sin⁡(30∘)cos⁡(30∘)]=[3/2−1/21/23/2]Q = \begin{bmatrix} \cos(30^\circ) & -\sin(30^\circ) \\ \sin(30^\circ) & \cos(30^\circ) \end{bmatrix} = \begin{bmatrix} \sqrt{3}/2 & -1/2 \\ 1/2 & \sqrt{3}/2 \end{bmatrix}

If matrix UU is m×nm \times n matrix, and m>nm > n, it is NOT an orthogonal matrix.
UTU=IU^T U = I is still true, yielding an n×nn \times n identity matrix.
But UUTU U^T yields an m×mm \times m matrix ≠I\neq I. Instead, P=UUTP = U U^T creates an m×mm \times m projection matrix of rank nn. This matrix PP can be used to project any given vector 𝒚\mathbf{y} onto the column space of UU (let’s call it WW) using the formula: 𝒚̂=UUT𝒚=P𝒚\hat{\mathbf{y}} = U U^T \mathbf{y} = P\mathbf{y}. Geometrically, for example if m=3m=3, n=2n=2, the two vectors span a flat 2D plane cutting through that 3D space.

8.5 Orthogonal Decomposition

Generalising an earlier theorem in 1-D space to higher-dimensional space,

8.5.0.1 Theorem

Let WW be a subspace of ℝn\mathbb{R}^n. Then each 𝒚\mathbf{y} in ℝn\mathbb{R}^n can be written uniquely in the form: 𝒚=𝒚̂+𝒛\mathbf{y} = \hat{\mathbf{y}} + \mathbf{z}

Formula: If {𝒖1,…,𝒖p}\{\mathbf{u}_1, \dots, \mathbf{u}_p\} is any orthogonal basis of WW, then: 𝒚̂=(𝒚⋅𝒖1𝒖1⋅𝒖1)𝒖1+…+(𝒚⋅𝒖p𝒖p⋅𝒖p)𝒖p\hat{\mathbf{y}} = \left(\frac{\mathbf{y} \cdot \mathbf{u}_1}{\mathbf{u}_1 \cdot \mathbf{u}_1}\right)\mathbf{u}_1 + \dots + \left(\frac{\mathbf{y} \cdot \mathbf{u}_p}{\mathbf{u}_p \cdot \mathbf{u}_p}\right)\mathbf{u}_p Proof. We have the residual 𝒛=𝒚−𝒚̂\mathbf{z} = \mathbf{y} - \hat{\mathbf{y}} and 𝒛⋅𝒖j=0\mathbf{z} \cdot \mathbf{u}_j = 0 because 𝒛\mathbf{z} is orthogonal to the subspace. So we have (𝒚−𝒚̂)⋅𝒖j=0𝒚⋅𝒖j=𝒚̂⋅𝒖j𝒚⋅𝒖j=(c1𝒖1+c2𝒖2+…+cj𝒖j+…+cp𝒖p)⋅𝒖j𝒚⋅𝒖j=0+0+…+cj(𝒖j⋅𝒖j)+…+0cj=𝒚⋅𝒖j𝒖j⋅𝒖j\begin{align*} (\mathbf{y} - \hat{\mathbf{y}}) \cdot \mathbf{u}_j &= 0\\ \mathbf{y} \cdot \mathbf{u}_j &= \hat{\mathbf{y}} \cdot \mathbf{u}_j\\ \mathbf{y} \cdot \mathbf{u}_j &= (c_1\mathbf{u}_1 + c_2\mathbf{u}_2 + \dots + c_j\mathbf{u}_j + \dots + c_p\mathbf{u}_p) \cdot \mathbf{u}_j\\ \mathbf{y} \cdot \mathbf{u}_j &= 0 + 0 + \dots + c_j(\mathbf{u}_j \cdot \mathbf{u}_j) + \dots + 0\\ c_j &= \frac{\mathbf{y} \cdot \mathbf{u}_j}{\mathbf{u}_j \cdot \mathbf{u}_j} \end{align*}

8.5.1 The Best Approximation Theorem

8.5.1.1 Theorem

Let WW be a subspace of ℝn\mathbb{R}^n, let 𝒚\mathbf{y} be any vector in ℝn\mathbb{R}^n, and let 𝒚̂\hat{\mathbf{y}} be the orthogonal projection of 𝒚\mathbf{y} onto WW. Then 𝒚̂\hat{\mathbf{y}} is the closest point in WW to 𝒚\mathbf{y}, meaning: ∥𝒚−𝒚̂∥<∥𝒚−𝒗∥\|\mathbf{y} - \hat{\mathbf{y}}\| < \|\mathbf{y} - \mathbf{v}\| for all other vectors 𝒗\mathbf{v} in WW distinct from 𝒚̂\hat{\mathbf{y}}.
Note: If 𝒚\mathbf{y} is already in WW, then projW𝒚=𝒚\text{proj}_W \mathbf{y} = \mathbf{y} (the distance is zero).
Proof. Rewrite (𝒚−𝒗)(\mathbf{y} - \mathbf{v}) as: 𝒚−𝒗=(𝒚−𝒚̂)+(𝒚̂−𝒗)\mathbf{y} - \mathbf{v} = (\mathbf{y} - \hat{\mathbf{y}}) + (\hat{\mathbf{y}} - \mathbf{v}) Since (𝒚−𝒚̂)(\mathbf{y} - \hat{\mathbf{y}}) and (𝒚̂−𝒗)(\hat{\mathbf{y}} - \mathbf{v}) are orthogonal, by Pythagoras Theorem: ∥𝒚−𝒗∥2=∥𝒚−𝒚̂∥2+∥𝒚̂−𝒗∥2\|\mathbf{y} - \mathbf{v}\|^2 = \|\mathbf{y} - \hat{\mathbf{y}}\|^2 + \|\hat{\mathbf{y}} - \mathbf{v}\|^2 Since 𝒗\mathbf{v} is not the same point as 𝒚̂\hat{\mathbf{y}}, then ∥𝒚̂−𝒗∥2>0\|\hat{\mathbf{y}} - \mathbf{v}\|^2 > 0, and ∥𝒚−𝒗∥>∥𝒚−𝒚̂∥\|\mathbf{y} - \mathbf{v}\| > \|\mathbf{y} - \hat{\mathbf{y}}\|

8.5.2 Projections with Orthonormal Bases

If {𝒖1,…,𝒖p}\{\mathbf{u}_1, \dots, \mathbf{u}_p\} is an orthonormal basis for WW, then the formula for the projection onto WW simplifies to: projW𝒚=(𝒚⋅𝒖1)𝒖1+(𝒚⋅𝒖2)𝒖2+…+(𝒚⋅𝒖p)𝒖p\text{proj}_W \mathbf{y} = (\mathbf{y} \cdot \mathbf{u}_1)\mathbf{u}_1 + (\mathbf{y} \cdot \mathbf{u}_2)\mathbf{u}_2 + \dots + (\mathbf{y} \cdot \mathbf{u}_p)\mathbf{u}_p because the denominators (𝒖i⋅𝒖i\mathbf{u}_i \cdot \mathbf{u}_i) all become 1.
If U=[𝒖1…𝒖p]U = [\mathbf{u}_1 \dots \mathbf{u}_p] is the matrix containing these orthonormal columns, the projection can be calculated via the projection matrix UUTUU^T: projW𝒚=UUT𝒚\text{proj}_W \mathbf{y} = U U^T \mathbf{y} Proof. 𝒚̂=(𝒚⋅𝒖1)𝒖1+(𝒚⋅𝒖2)𝒖2+…+(𝒚⋅𝒖p)𝒖p=𝒖1(𝒖1T𝒚)+𝒖2(𝒖2T𝒚)+…+𝒖p(𝒖pT𝒚)\begin{align*} \hat{\mathbf{y}} &= (\mathbf{y} \cdot \mathbf{u}_1)\mathbf{u}_1 + (\mathbf{y} \cdot \mathbf{u}_2)\mathbf{u}_2 + \dots + (\mathbf{y} \cdot \mathbf{u}_p)\mathbf{u}_p\\ &= \mathbf{u}_1(\mathbf{u}_1^T \mathbf{y}) + \mathbf{u}_2(\mathbf{u}_2^T \mathbf{y}) + \dots + \mathbf{u}_p(\mathbf{u}_p^T \mathbf{y}) \end{align*} Building the UUTyUU^Ty result: UT𝒚=[←𝒖1T→←𝒖2T→⋮←𝒖pT→]𝒚=[𝒖1T𝒚𝒖2T𝒚⋮𝒖pT𝒚]U^T \mathbf{y} = \begin{bmatrix} \leftarrow \mathbf{u}_1^T \rightarrow \\ \leftarrow \mathbf{u}_2^T \rightarrow \\ \vdots \\ \leftarrow \mathbf{u}_p^T \rightarrow \end{bmatrix} \mathbf{y} = \begin{bmatrix} \mathbf{u}_1^T \mathbf{y} \\ \mathbf{u}_2^T \mathbf{y} \\ \vdots \\ \mathbf{u}_p^T \mathbf{y} \end{bmatrix} U(UT𝒚)=[↑↑↑𝒖1𝒖2…𝒖p↓↓↓][𝒖1T𝒚𝒖2T𝒚⋮𝒖pT𝒚]=𝒖1(𝒖1T𝒚)+𝒖2(𝒖2T𝒚)+…+𝒖p(𝒖pT𝒚)\begin{align*} U (U^T \mathbf{y}) &= \begin{bmatrix} \uparrow & \uparrow & & \uparrow \\ \mathbf{u}_1 & \mathbf{u}_2 & \dots & \mathbf{u}_p \\ \downarrow & \downarrow & & \downarrow \end{bmatrix} \begin{bmatrix} \mathbf{u}_1^T \mathbf{y} \\ \mathbf{u}_2^T \mathbf{y} \\ \vdots \\ \mathbf{u}_p^T \mathbf{y} \end{bmatrix}\\ &= \mathbf{u}_1(\mathbf{u}_1^T \mathbf{y}) + \mathbf{u}_2(\mathbf{u}_2^T \mathbf{y}) + \dots + \mathbf{u}_p(\mathbf{u}_p^T \mathbf{y}) \end{align*} ∴𝒚̂=UUT𝒚\therefore\:\hat{\mathbf{y}} = UU^T\mathbf{y}.

8.6 QR decomposition

If AA is an m×nm \times n matrix with linearly indpendent columns, then AA can be factorised as A=QRA = QR

Note that m≥nm \geq n, otherwise the columns of AA are linearly dependent, forming a contradiction.
Properties of QQ:

  1. C(Q)=C(A)C(Q) = C(A): It means the column space of QQ is identical to the column space of AA.

  2. QTQ=IQ^T Q = I: Property of matrix with orthonormal columns.

  3. QQT=Projection MatrixQQ^T = \text{Projection Matrix}: QQ might not be square. This projects any vector onto the column space of AA.

Properties of RR:

  1. Square and Upper Triangular: all entries below of the main diagonal are zero.

  2. Invertibility: If AA has linearly independent columns, RR is invertible. If AA has linearly dependent columns, RR is NOT invertible (it will have zeros on its diagonal).

Sketch of why we use QR decomposition: Imagine trying to solve the system A𝒙=𝒚A\mathbf{x} = \mathbf{y} for a very large matrix AA. QR𝒙=𝒚[Substitute A with QR]QTQR𝒙=QT𝒚[Left multiply by QT]R𝒙=QT𝒚[QTQ=I]\begin{align*} QR\mathbf{x} &= \mathbf{y} & \text{[Substitute $A$ with $QR$]}\\ Q^T Q R \mathbf{x} &= Q^T \mathbf{y} & \text{[Left multiply by $Q^T$]}\\ R\mathbf{x} &= Q^T \mathbf{y} & \text{[$Q^TQ=I$]} \end{align*} This is easier to solve as R is an upper triangular matrix, so we can use back-substitution.

8.6.1 Gram-Schmidt (GS) Process

This algorithm finds the QQ matrix. It takes a set of independent vectors (columns of AA) and transforms them into mutually orthogonal vectors.
If you start with a set of vectors W={𝒙1,𝒙2,…,𝒙n}W = \{\mathbf{x}_1, \mathbf{x}_2, \dots, \mathbf{x}_n\}, the GS process outputs an orthogonal set W′={𝒗1,𝒗2,…,𝒗n}W' = \{\mathbf{v}_1, \mathbf{v}_2, \dots, \mathbf{v}_n\}. The subspace spanned by the new orthogonal vectors is exactly identical to the subspace spanned by the original vectors: Span(W)=Span(W′)\text{Span}(W) = \text{Span}(W').

8.6.1.1 The algorithm

Given a basis {𝒙1,…,𝒙p}\{\mathbf{x}_1, \dots, \mathbf{x}_p\} for a nonzero subspace, construct the orthogonal basis iteratively:

  1. Anchor the first vector: 𝒗1=𝒙1\mathbf{v}_1 = \mathbf{x}_1.

  2. For the second vector, subtract its projection onto the first: 𝒗2=𝒙2−(𝒙2⋅𝒗1𝒗1⋅𝒗1)𝒗1\mathbf{v}_2 = \mathbf{x}_2 - \left(\frac{\mathbf{x}_2 \cdot \mathbf{v}_1}{\mathbf{v}_1 \cdot \mathbf{v}_1}\right)\mathbf{v}_1.

  3. For the third vector, subtract its projections onto all previous vectors: 𝒗3=𝒙3−(𝒙3⋅𝒗1𝒗1⋅𝒗1)𝒗1−(𝒙3⋅𝒗2𝒗2⋅𝒗2)𝒗2\mathbf{v}_3 = \mathbf{x}_3 - \left(\frac{\mathbf{x}_3 \cdot \mathbf{v}_1}{\mathbf{v}_1 \cdot \mathbf{v}_1}\right)\mathbf{v}_1 - \left(\frac{\mathbf{x}_3 \cdot \mathbf{v}_2}{\mathbf{v}_2 \cdot \mathbf{v}_2}\right)\mathbf{v}_2.

  4. Repeat this pattern up to pp vectors.

Proof. The Orthogonal Decomposition Theorem: guarantees that any vector 𝒙k+1\mathbf{x}_{k+1} can be split into a component that lies within a previously established subspace WkW_k (the projection) and a component perfectly orthogonal to WkW_k (the residual). 𝒗k+1=𝒙k+1−projWk𝒙k+1\mathbf{v}_{k+1} = \mathbf{x}_{k+1} - \text{proj}_{W_k}\mathbf{x}_{k+1}, the algorithm mathematically strips away the interior projection, leaving only the orthogonal residual 𝒗k+1\mathbf{v}_{k+1}. Furthermore, because the original vectors are strictly linearly independent, 𝒙k+1\mathbf{x}_{k+1} cannot be entirely contained within WkW_k; thus, the residual 𝒗k+1\mathbf{v}_{k+1} will never collapse into the zero vector (𝟎\mathbf{0}), ensuring the newly formed orthogonal basis remains intact and spans the exact same space.

Orthonormalisation: The Gram-Schmidt algorithm natively produces an orthogonal set. To achieve the orthonormal set required for matrix QQ, every vector must be normalized so its length equals 11. This is done by dividing the vector by its norm: 𝒖k=𝒗k∥𝒗k∥\mathbf{u}_k = \frac{\mathbf{v}_k}{\|\mathbf{v}_k\|}.

8.6.1.2 Finding RR

RR is found using the relationship R=QTAR = Q^T A.

8.6.1.3 Full QR decomposition

For m×nm \times n matrix AA where m>nm > n, the standard method only yields the m×nm \times n Economy QR. To obtain a Full QR factorization, QQ must be expanded into a perfectly square m×mm \times m matrix.

  1. To achieve this, append a dummy matrix Ã\tilde{A} (such as the Identity matrix II) to AA so that the combined matrix [AÃ][A \quad \tilde{A}] reaches a full rank of mm.

  2. Run the Gram-Schmidt process on this massive combined matrix. The original columns form the block Q1Q_1, while the extra manufactured columns form Q2Q_2, extending the set to form a complete orthonormal basis for ℝm\mathbb{R}^m.

8.6.1.4 Why append the identity matrix?

If matrix AA is m×nm \times n (where m>nm > n), its columns only span an nn-dimensional slice of the full mm-dimensional space (ℝm\mathbb{R}^m). To build a square m×mm \times m matrix for QQ, we must "discover" the missing m−nm-n perpendicular directions. Because the columns of the m×mm \times m identity matrix inherently span the entirety of ℝm\mathbb{R}^m, appending them onto AA guarantees that every possible dimension is represented. When we run G-S across this combined matrix, the algorithm naturally filters out the redundant dimensions (which become 𝟎\mathbf{0} and are discarded) and orthogonalizes the remaining distinct directions, perfectly completing the basis.

8.6.1.5 The 4 cases of AA

AA could be square or tall, and the columns could be indepedent or dependent.
Square matrices, m=nm=n: the economy and full decompositions are exactly the same. QQ is always a perfect square orthogonal matrix, meaning QTQ=QQT=IQ^T Q = Q Q^T = I. The only thing that changes is the invertibility of RR.

Tall matrices, m>nm>n: the difference between Full and Economy QR becomes prominent.
A tall matrix AA can be written in block matrix form for a Full QR: A=[Q1Q2][R10]=Q1R1A = \begin{bmatrix} Q_1 & Q_2 \end{bmatrix} \begin{bmatrix} R_1 \\ 0 \end{bmatrix} = Q_1 R_1.

8.6.1.6 Example - Economy QR

Let AA be a 4×34 \times 3 matrix with linearly independent columns: A=[𝒙1𝒙2𝒙3]=[1311111−1311−1]A = \begin{bmatrix} \mathbf{x}_1 & \mathbf{x}_2 & \mathbf{x}_3 \end{bmatrix} = \begin{bmatrix} 1 & 3 & 1 \\ 1 & 1 & 1 \\ 1 & -1 & 3 \\ 1 & 1 & -1 \end{bmatrix} Anchor the first vector: 𝒗1=𝒙1=[1111]\mathbf{v}_1 = \mathbf{x}_1 = \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} Orthogonalize the second vector (𝒙2\mathbf{x}_2): 𝒗2=[31−11]−(44)[1111]=[31−11]−[1111]=[20−20]\mathbf{v}_2 = \begin{bmatrix} 3 \\ 1 \\ -1 \\ 1 \end{bmatrix} - \left( \frac{4}{4} \right) \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 3 \\ 1 \\ -1 \\ 1 \end{bmatrix} - \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} = \begin{bmatrix} 2 \\ 0 \\ -2 \\ 0 \end{bmatrix} Orthogonalize the third vector (𝒙3\mathbf{x}_3): 𝒗3=𝒙3−(𝒙3⋅𝒗1𝒗1⋅𝒗1)𝒗1−(𝒙3⋅𝒗2𝒗2⋅𝒗2)𝒗2\mathbf{v}_3 = \mathbf{x}_3 - \left( \frac{\mathbf{x}_3 \cdot \mathbf{v}_1}{\mathbf{v}_1 \cdot \mathbf{v}_1} \right) \mathbf{v}_1 - \left( \frac{\mathbf{x}_3 \cdot \mathbf{v}_2}{\mathbf{v}_2 \cdot \mathbf{v}_2} \right) \mathbf{v}_2 𝒗3=[113−1]−(44)[1111]−(−48)[20−20]=[101−2]\mathbf{v}_3 = \begin{bmatrix} 1 \\ 1 \\ 3 \\ -1 \end{bmatrix} - \left( \frac{4}{4} \right) \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix} - \left( \frac{-4}{8} \right) \begin{bmatrix} 2 \\ 0 \\ -2 \\ 0 \end{bmatrix} = \begin{bmatrix} 1 \\ 0 \\ 1 \\ -2 \end{bmatrix} We divide each vector by its length (∥𝒗1∥=2\|\mathbf{v}_1\| = 2, ∥𝒗2∥=8=22\|\mathbf{v}_2\| = \sqrt{8} = 2\sqrt{2}, and ∥𝒗3∥=6\|\mathbf{v}_3\| = \sqrt{6}): Qeconomy=[𝒖1𝒖2𝒖3]=[1/21/21/61/2001/2−1/21/61/20−2/6]Q_{economy} = \begin{bmatrix} \mathbf{u}_1 & \mathbf{u}_2 & \mathbf{u}_3 \end{bmatrix} = \begin{bmatrix} 1/2 & 1/\sqrt{2} & 1/\sqrt{6} \\ 1/2 & 0 & 0 \\ 1/2 & -1/\sqrt{2} & 1/\sqrt{6} \\ 1/2 & 0 & -2/\sqrt{6} \end{bmatrix} R=QTAR = Q^T A: Reconomy=[𝒖1⋅𝒙1𝒖1⋅𝒙2𝒖1⋅𝒙30𝒖2⋅𝒙2𝒖2⋅𝒙300𝒖3⋅𝒙3]=[222022−2006]R_{economy} = \begin{bmatrix} \mathbf{u}_1 \cdot \mathbf{x}_1 & \mathbf{u}_1 \cdot \mathbf{x}_2 & \mathbf{u}_1 \cdot \mathbf{x}_3 \\ 0 & \mathbf{u}_2 \cdot \mathbf{x}_2 & \mathbf{u}_2 \cdot \mathbf{x}_3 \\ 0 & 0 & \mathbf{u}_3 \cdot \mathbf{x}_3 \end{bmatrix} = \begin{bmatrix} 2 & 2 & 2 \\ 0 & 2\sqrt{2} & -\sqrt{2} \\ 0 & 0 & \sqrt{6} \end{bmatrix}

8.6.1.7 Full QR

Using the same AA as above, we append the 4×44 \times 4 Identity matrix (II) to AA to guarantee we have raw vectors pointing in every possible dimension: [A∣I]=[131100011101001−13001011−10001][A \mid I] = \begin{bmatrix} 1 & 3 & 1 & 1 & 0 & 0 & 0 \\ 1 & 1 & 1 & 0 & 1 & 0 & 0 \\ 1 & -1 & 3 & 0 & 0 & 1 & 0 \\ 1 & 1 & -1 & 0 & 0 & 0 & 1 \end{bmatrix} Let’s process the first column of the Identity matrix (𝒙4=[1000]\mathbf{x}_4 = \begin{bmatrix} 1 \\ 0 \\ 0 \\ 0 \end{bmatrix}): 𝒗4=𝒙4−proj𝒗1𝒙4−proj𝒗2𝒙4−proj𝒗3𝒙4\mathbf{v}_4 = \mathbf{x}_4 - \text{proj}_{\mathbf{v}_1}\mathbf{x}_4 - \text{proj}_{\mathbf{v}_2}\mathbf{x}_4 - \text{proj}_{\mathbf{v}_3}\mathbf{x}_4 𝒗4=[1/12−1/41/121/12]\mathbf{v}_4 = \begin{bmatrix} 1/12 \\ -1/4 \\ 1/12 \\ 1/12 \end{bmatrix} Normalising, we get, 𝒖4=[1/12−3/121/121/12]\mathbf{u}_4 = \begin{bmatrix} 1/\sqrt{12} \\ -3/\sqrt{12} \\ 1/\sqrt{12} \\ 1/\sqrt{12} \end{bmatrix} We now possess 4 orthogonal vectors (𝒗1,𝒗2,𝒗3,𝒗4\mathbf{v}_1, \mathbf{v}_2, \mathbf{v}_3, \mathbf{v}_4). ince a 4D space can only hold a maximum of 4 mutually perpendicular directions, if we continued the algorithm on the remaining columns of the identity matrix, they would all perfectly cancel out into the zero vector (𝟎\mathbf{0}) and be discarded. Qfull=[𝒖1𝒖2𝒖3𝒖4]=[1/21/21/61/121/200−3/121/2−1/21/61/121/20−2/61/12]Q_{full} = \begin{bmatrix} \mathbf{u}_1 & \mathbf{u}_2 & \mathbf{u}_3 & \mathbf{u}_4 \end{bmatrix} = \begin{bmatrix} 1/2 & 1/\sqrt{2} & 1/\sqrt{6} & 1/\sqrt{12} \\ 1/2 & 0 & 0 & -3/\sqrt{12} \\ 1/2 & -1/\sqrt{2} & 1/\sqrt{6} & 1/\sqrt{12} \\ 1/2 & 0 & -2/\sqrt{6} & 1/\sqrt{12} \end{bmatrix} To construct RfullR_{full}, we take ReconomyR_{economy} and simply pad the bottom with a row of zeros until it matches the dimensions of our original 4×34 \times 3 matrix AA. Rfull=[222022−2006000]R_{full} = \begin{bmatrix} 2 & 2 & 2 \\ 0 & 2\sqrt{2} & -\sqrt{2} \\ 0 & 0 & \sqrt{6} \\ 0 & 0 & 0 \end{bmatrix}

8.6.1.8 What if AA had linearly dependent columns?

Let AA be a 4×34 \times 3 matrix where the second column is exactly twice the first column (linearly dependent). A=[121001120001]A = \begin{bmatrix} 1 & 2 & 1 \\ 0 & 0 & 1 \\ 1 & 2 & 0 \\ 0 & 0 & 1 \end{bmatrix} Process the first vector (𝒙1\mathbf{x}_1): 𝒗1=[1010]⟹𝒖1=[1/201/20]\mathbf{v}_1 = \begin{bmatrix} 1 \\ 0 \\ 1 \\ 0 \end{bmatrix} \implies \mathbf{u}_1 = \begin{bmatrix} 1/\sqrt{2} \\ 0 \\ 1/\sqrt{2} \\ 0 \end{bmatrix} Because 𝒗2=𝟎\mathbf{v}_2 = \mathbf{0}, we discard it, do not increment our rank counter, and move immediately to the next column.
Process the third vector (𝒙3\mathbf{x}_3): 𝒗3=[1101]−(12)[1010]=[1/21−1/21]⟹𝒖2=[1/102/10−1/102/10]\mathbf{v}_3 = \begin{bmatrix} 1 \\ 1 \\ 0 \\ 1 \end{bmatrix} - \left( \frac{1}{2} \right) \begin{bmatrix} 1 \\ 0 \\ 1 \\ 0 \end{bmatrix} = \begin{bmatrix} 1/2 \\ 1 \\ -1/2 \\ 1 \end{bmatrix} \implies \mathbf{u}_2 = \begin{bmatrix} 1/\sqrt{10} \\ 2/\sqrt{10} \\ -1/\sqrt{10} \\ 2/\sqrt{10} \end{bmatrix} Because we discarded a dependent column, our 4×34 \times 3 matrix only yielded 22 valid orthonormal vectors. Thus, QQ is a 4×24 \times 2 matrix. Q=[𝒖1𝒖2]=[1/21/1002/101/2−1/1002/10]Q = [\mathbf{u}_1 \quad \mathbf{u}_2] = \begin{bmatrix} 1/\sqrt{2} & 1/\sqrt{10} \\ 0 & 2/\sqrt{10} \\ 1/\sqrt{2} & -1/\sqrt{10} \\ 0 & 2/\sqrt{10} \end{bmatrix} To find RR, we calculate QTAQ^T A: R=[𝒖1T𝒖2T]A=[2/24/21/2005/10]R = \begin{bmatrix} \mathbf{u}_1^T \\ \mathbf{u}_2^T \end{bmatrix} A = \begin{bmatrix} 2/\sqrt{2} & 4/\sqrt{2} & 1/\sqrt{2} \\ 0 & 0 & 5/\sqrt{10} \end{bmatrix} Observe the second row of RR. Because the second column of AA was dependent on the first, it did not generate a new orthogonal vector to drop down to. The zeroes stretch horizontally, creating the "staircase" shape that means RR is not invertible.