6.3 Orthogonal Projections

last time:

Orthogonal projection of  \vec{y}  onto  \vec{u}
Figure:Orthogonal projection of \( \vec{y} \) onto \( \vec{u} \)
Detailed description
Vector diagram showing vector \( \vec{y} \) and vector \( \vec{u} \) originating from the same point. The projection vector \( \hat{y} \) lies along \( \vec{u} \), and the orthogonal component \( \vec{z} = \vec{y} - \hat{y} \) extends perpendicularly from the tip of \( \hat{y} \) to the tip of \( \vec{y} \).
\[ \vec{z} = \vec{y} - \hat{y} \]

component of \( \vec{y} \) orthogonal to \( \vec{u} \)

\[ \hat{y} = \frac{\vec{y} \cdot \vec{u}}{\vec{u} \cdot \vec{u}} \vec{u} = \operatorname{proj}_{\vec{u}} \vec{y} \]

orthogonal projection of \( \vec{y} \) onto \( \vec{u} \)

Orthogonal projection of  \vec{y}  onto plane  W
Figure:Orthogonal projection of \( \vec{y} \) onto plane \( W \)
Detailed description
Three-dimensional diagram of a plane \( W \) containing the origin \( \vec{0} \) and two orthogonal basis vectors \( \vec{u}_1 \) and \( \vec{u}_2 \). Vector \( \vec{y} \) extends upward out of plane \( W \). A dashed perpendicular line drops from the tip of \( \vec{y} \) to the tip of its projection \( \hat{y} \) inside \( W \), representing the orthogonal component \( \vec{z} = \vec{y} - \hat{y} \).
\[ W = \operatorname{span}\{ \underbrace{\vec{u}_1, \vec{u}_2}_{\text{orthogonal}} \} \]
\[ \vec{z} = \vec{y} - \hat{y} \]
\[ \hat{y} = \frac{\vec{y} \cdot \vec{u}_1}{\vec{u}_1 \cdot \vec{u}_1} \vec{u}_1 + \frac{\vec{y} \cdot \vec{u}_2}{\vec{u}_2 \cdot \vec{u}_2} \vec{u}_2 \]

Orthogonal Projection

If \( \{ \vec{u}_1, \dots, \vec{u}_p \} \) is orthogonal basis for \( W \), then projection of \( \vec{y} \) onto \( W \) is uniquely determined as

\[ \hat{y} = \frac{\vec{y} \cdot \vec{u}_1}{\vec{u}_1 \cdot \vec{u}_1} \vec{u}_1 + \frac{\vec{y} \cdot \vec{u}_2}{\vec{u}_2 \cdot \vec{u}_2} \vec{u}_2 + \dots + \frac{\vec{y} \cdot \vec{u}_p}{\vec{u}_p \cdot \vec{u}_p} \vec{u}_p \]

independent of the basis used (as long as it is orthogonal)

Example

\[ \vec{u}_1 = \begin{bmatrix} -7 \\ 1 \\ 4 \end{bmatrix}, \quad \vec{u}_2 = \begin{bmatrix} -1 \\ 1 \\ -2 \end{bmatrix}, \quad \vec{y} = \begin{bmatrix} -9 \\ -1 \\ 1 \end{bmatrix} \]

Find \( \operatorname{proj}_W \vec{y} \) where \( W = \operatorname{span}\{ \vec{u}_1, \vec{u}_2 \} \)

\( \vec{u}_1 \cdot \vec{u}_2 = 0 \), \( \vec{u}_1 \perp \vec{u}_2 \)

\[ \hat{y} = \frac{\vec{y} \cdot \vec{u}_1}{\vec{u}_1 \cdot \vec{u}_1} \vec{u}_1 + \frac{\vec{y} \cdot \vec{u}_2}{\vec{u}_2 \cdot \vec{u}_2} \vec{u}_2 \]

Orthogonal Projection and Closest Distance

\[ \begin{aligned} \hat{y} &= \frac{63 - 1 + 4}{49 + 1 + 16} \begin{bmatrix} -7 \\ 1 \\ 4 \end{bmatrix} + \frac{9 - 1 - 2}{1 + 1 + 4} \begin{bmatrix} -1 \\ 1 \\ -2 \end{bmatrix} \\ &= (1) \begin{bmatrix} -7 \\ 1 \\ 4 \end{bmatrix} + (1) \begin{bmatrix} -1 \\ 1 \\ -2 \end{bmatrix} = \begin{bmatrix} -8 \\ 2 \\ 2 \end{bmatrix} \end{aligned} \]
Orthogonal projection  \hat{y}  onto subspace  W
Figure:Orthogonal projection \( \hat{y} \) onto subspace \( W \)
Detailed description
Geometric diagram of a plane representing subspace \( W \) spanned by basis vectors \( \vec{u}_1 \) and \( \vec{u}_2 \). A vector \( \vec{y} \) extends above the plane, with its orthogonal projection \( \hat{y} \) lying inside the plane.

Try another basis: \( \left\{ \begin{bmatrix} 1 \\ 0 \\ -1 \end{bmatrix}, \begin{bmatrix} -3 \\ 2 \\ -3 \end{bmatrix} \right\} \) (labeled \( \vec{u}_1 \) and \( \vec{u}_2 \)) also spans the same \( W \).

Given \( \vec{y} = \begin{bmatrix} -9 \\ -1 \\ 1 \end{bmatrix} \):

\[ \begin{aligned} \hat{y} &= \frac{-9 - 1}{1 + 1} \begin{bmatrix} 1 \\ 0 \\ -1 \end{bmatrix} + \frac{27 - 2 - 3}{9 + 4 + 9} \begin{bmatrix} -3 \\ 2 \\ -3 \end{bmatrix} \\ &= (-5) \begin{bmatrix} 1 \\ 0 \\ -1 \end{bmatrix} + (1) \begin{bmatrix} -3 \\ 2 \\ -3 \end{bmatrix} = \begin{bmatrix} -8 \\ 2 \\ 2 \end{bmatrix} \quad \text{(same as before)} \end{aligned} \]\[ \vec{z} = \vec{y} - \hat{y} = \begin{bmatrix} -9 \\ -1 \\ 1 \end{bmatrix} - \begin{bmatrix} -8 \\ 2 \\ 2 \end{bmatrix} = \begin{bmatrix} -1 \\ -3 \\ -1 \end{bmatrix} \]

The closest distance between \( \vec{y} \) and \( W \) is \( \|z\| = \sqrt{11} \).

Closest Point in \( W \) to \( \vec{y} \)

What is the point in \( W \) that is closest to \( \vec{y} \)?

\( \rightarrow \) tip of \( \hat{y} \): \( (-8, 2, 2) \)

\[ \vec{u}_1 = \begin{bmatrix} -7 \\ 1 \\ 4 \end{bmatrix}, \quad \vec{u}_2 = \begin{bmatrix} -1 \\ 1 \\ -2 \end{bmatrix}, \quad \vec{y} = \begin{bmatrix} -9 \\ -1 \\ 1 \end{bmatrix} \]

Find \( c_1 \) and \( c_2 \) such that \( \vec{y} = c_1 \vec{u}_1 + c_2 \vec{u}_2 \), but if \( \vec{y} \) is not in \( \operatorname{span}\{ \vec{u}_1, \vec{u}_2 \} \), then there are no solutions.

\[ \begin{bmatrix} -7 & -1 & -9 \\ 1 & 1 & -1 \\ 4 & -2 & 1 \end{bmatrix} \sim \begin{bmatrix} 1 & 1 & -1 \\ 0 & 6 & -16 \\ 0 & 0 & \boxed{-11} \end{bmatrix} \]

Columns correspond to variables \( c_1 \) and \( c_2 \) respectively.

Pivot in rightmost column (\( -11 \)) \( \rightarrow \) inconsistent system.

From earlier:

\[ \hat{y} = (1)\vec{u}_1 + (1)\vec{u}_2 \]

The coefficients \( (1) \) and \( (1) \) are the closest \( c_1, c_2 \) to the true solution.

Orthogonal Projection and Finding a Perpendicular Vector

\[\vec{u}_1 = \begin{bmatrix} 1 \\ 1 \\ -2 \end{bmatrix}, \quad \vec{u}_2 = \begin{bmatrix} 5 \\ -1 \\ 2 \end{bmatrix}, \quad \vec{u}_3 = \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}\]

\( \vec{u}_1 \cdot \vec{u}_2 = 0 \), so \( \vec{u}_1 \perp \vec{u}_2 \) but \( \vec{u}_3 \) is not orthogonal to either.

If we know \( \vec{u}_3 \) is not in \( \operatorname{span}\{\vec{u}_1, \vec{u}_2\} \), find a nonzero vector that is orthogonal to both \( \vec{u}_1 \) and \( \vec{u}_2 \).

Orthogonal projection of  \vec{u}_3  onto plane
Figure:Orthogonal projection of \( \vec{u}_3 \) onto plane
Detailed description
Geometric diagram showing a plane represented as a parallelogram containing the origin \( \vec{0} \) and the two orthogonal vectors \( \vec{u}_1 \) and \( \vec{u}_2 \). Vector \( \vec{u}_3 \) extends upward out of the plane from \( \vec{0} \). Its orthogonal projection onto the plane is the vector \( \hat{u}_3 \), and a dashed vertical vector connects the tip of \( \hat{u}_3 \) to the tip of \( \vec{u}_3 \), representing the orthogonal component \( \vec{z} \) perpendicular to both \( \vec{u}_1 \) and \( \vec{u}_2 \).

\( \vec{z} \) is \( \perp \) to both \( \vec{u}_1 \) and \( \vec{u}_2 \)

\[\begin{aligned}\hat{u}_3 &= \frac{\vec{u}_3 \cdot \vec{u}_1}{\vec{u}_1 \cdot \vec{u}_1} \vec{u}_1 + \frac{\vec{u}_3 \cdot \vec{u}_2}{\vec{u}_2 \cdot \vec{u}_2} \vec{u}_2 \\&= \frac{-2}{6} \begin{bmatrix} 1 \\ 1 \\ -2 \end{bmatrix} + \frac{2}{30} \begin{bmatrix} 5 \\ -1 \\ 2 \end{bmatrix} \\&= \begin{bmatrix} 0 \\ -2/5 \\ 4/5 \end{bmatrix}\end{aligned}\]

Orthonormal Basis and Orthogonal Projection

\[ \vec{z} = \vec{u}_3 - \hat{u}_3 = \begin{bmatrix} 0 \\ 2/5 \\ 1/5 \end{bmatrix} \]

this is orthogonal to both \( \vec{u}_1 \) and \( \vec{u}_2 \)

If \( \{ \vec{u}_1, \dots, \vec{u}_p \} \) is an orthonormal basis for \( W \)

\[ \begin{aligned} \vec{u}_i \cdot \vec{u}_j &= 0 \quad i \neq j \\ \| \vec{u}_i \| &= 1 \quad \text{for all } i \end{aligned} \]
\[ \operatorname{proj}_W \vec{y} = (\vec{y} \cdot \vec{u}_1)\vec{u}_1 + \dots + (\vec{y} \cdot \vec{u}_p)\vec{u}_p \]

if \( U = \begin{bmatrix} \vec{u}_1 & \vec{u}_2 & \dots & \vec{u}_p \end{bmatrix} \)

then

\[ \operatorname{proj}_W \vec{y} = U U^T \vec{y} \]

Example

\[ \vec{u}_1 = \begin{bmatrix} 1 \\ 0 \\ -1 \end{bmatrix}, \quad \vec{u}_2 = \begin{bmatrix} -3 \\ 2 \\ -3 \end{bmatrix}, \quad \vec{y} = \begin{bmatrix} -9 \\ -1 \\ 1 \end{bmatrix} \]

\( \{ \vec{u}_1, \vec{u}_2 \} \) is orthogonal but not orthonormal

but \( \left\{ \frac{\vec{u}_1}{\|\vec{u}_1\|}, \frac{\vec{u}_2}{\|\vec{u}_2\|} \right\} \) is

\[ = \left\{ \begin{bmatrix} 1/\sqrt{2} \\ 0 \\ -1/\sqrt{2} \end{bmatrix}, \begin{bmatrix} -3/\sqrt{22} \\ 2/\sqrt{22} \\ -3/\sqrt{22} \end{bmatrix} \right\}, \quad U = \begin{bmatrix} 1/\sqrt{2} & -3/\sqrt{22} \\ 0 & 2/\sqrt{22} \\ -1/\sqrt{2} & -3/\sqrt{22} \end{bmatrix} \]\[ \begin{aligned} \hat{y} &= \operatorname{proj}_W \vec{y} = U U^T \vec{y} = \begin{bmatrix} 1/\sqrt{2} & -3/\sqrt{22} \\ 0 & 2/\sqrt{22} \\ -1/\sqrt{2} & -3/\sqrt{22} \end{bmatrix} \begin{bmatrix} 1/\sqrt{2} & 0 & -1/\sqrt{2} \\ -3/\sqrt{22} & 2/\sqrt{22} & -3/\sqrt{22} \end{bmatrix} \begin{bmatrix} -9 \\ -1 \\ 1 \end{bmatrix} \\ &= \begin{bmatrix} 10/11 & -3/11 & -1/11 \\ -3/11 & 2/11 & -3/11 \\ -1/11 & -3/11 & 10/11 \end{bmatrix} \begin{bmatrix} -9 \\ -1 \\ 1 \end{bmatrix} = \begin{bmatrix} -8 \\ 2 \\ 2 \end{bmatrix} \end{aligned} \]