Tutorials › Linear Algebra › Residual Orthogonality In Projection

Orthogonal Complements and Projections · Tutorial 675 of 1000

Residual Orthogonality In Projection

Learn to prove and verify the residual-orthogonality condition for projections onto subspaces of \(\mathbb{R}^n\).

Intermediate 10 min read

What You'll Learn

  • State the residual-orthogonality condition for an orthogonal projection.
  • Prove that a projected vector’s residual belongs to the orthogonal complement.
  • Use membership and orthogonality to characterize a projection uniquely.
  • Compute projections onto coordinate planes and subspaces with nonorthogonal generators.
  • Test projection candidates using a matrix and dot products.
  • Recognize why lying in the subspace alone does not make a candidate the projection.

The Residual and the Orthogonal Complement

When a vector \(\mathbf{b}\in\mathbb{R}^n\) is projected onto a subspace \(W\), the projection is the component that belongs to \(W\). The difference between the original vector and that component is called the residual. The key condition in this tutorial is that this residual is perpendicular to every vector in \(W\). It gives a practical way to check a proposed projection: the projected vector must lie in the subspace, and the residual must be orthogonal to the subspace.

We use the standard dot product \(\mathbf{x}\cdot\mathbf{y}=\mathbf{x}^{\top}\mathbf{y}\) on \(\mathbb{R}^n\). For a subspace \(W\subseteq\mathbb{R}^n\), its orthogonal complement is the set of vectors perpendicular to every vector in \(W\).

Definition: The orthogonal complement of \(W\) is \(W^\perp=\{\mathbf{z}\in\mathbb{R}^n:\mathbf{z}\cdot\mathbf{w}=0\text{ for every }\mathbf{w}\in W\}\). If \(\mathbf{p}\) is the orthogonal projection of \(\mathbf{b}\) onto \(W\), then \(\mathbf{p}\in W\), and \(\mathbf{b}-\mathbf{p}\) is the residual.

In finite-dimensional Euclidean space, the orthogonal decomposition theorem gives a unique expression \(\mathbf{b}=\mathbf{p}+\mathbf{r}\), where \(\mathbf{p}\in W\) and \(\mathbf{r}\in W^\perp\). The vector \(\mathbf{p}\) is the orthogonal projection of \(\mathbf{b}\) onto \(W\). We will prove the residual condition using the matrix characterization of orthogonal projection from the earlier material, and then prove that the two conditions also identify the projection uniquely.

Why the Residual Is Orthogonal

Suppose \(P\) is the matrix of the orthogonal projection onto \(W\). By the characterization of orthogonal projection matrices, \(P^{\top}=P\), \(P^2=P\), and the range of \(P\) is \(W\). The projected vector is \(P\mathbf{b}\), so its residual is \((I_n-P)\mathbf{b}\). The identities \(P^{\top}=P\) and \(P^2=P\) let us test this residual against any vector in the range of \(P\), which is exactly \(W\).

Theorem (Residual orthogonality): Let \(W\) be a subspace of \(\mathbb{R}^n\), and let \(P\in\mathbb{R}^{n\times n}\) be the orthogonal projection matrix onto \(W\). For every \(\mathbf{b}\in\mathbb{R}^n\), the residual \(\mathbf{b}-P\mathbf{b}\) belongs to \(W^\perp\).

Proof. Let \(\mathbf{b}\in\mathbb{R}^n\), and let \(\mathbf{w}\in W\) be arbitrary. Since \(W\) is the range of \(P\), there is a vector \(\mathbf{z}\in\mathbb{R}^n\) such that \(\mathbf{w}=P\mathbf{z}\). Using symmetry and idempotence of \(P\), we obtain

$$ (\mathbf{b}-P\mathbf{b})\cdot\mathbf{w} =((I_n-P)\mathbf{b})^{\top}P\mathbf{z} =\mathbf{b}^{\top}(I_n-P)^{\top}P\mathbf{z} =\mathbf{b}^{\top}(I_n-P)P\mathbf{z} =0, $$

because \((I_n-P)P=P-P^2=0\). Thus the residual has dot product zero with every \(\mathbf{w}\in W\). By the definition of \(W^\perp\), \(\mathbf{b}-P\mathbf{b}\in W^\perp\). \(\square\)

Worked Example: Projection onto a Coordinate Plane

Let \(W=\{(x,y,0):x,y\in\mathbb{R}\}\subseteq\mathbb{R}^3\), and project \(\mathbf{b}=(3,2,4)\) onto \(W\). The vector \(\mathbf{p}=(3,2,0)\) lies in \(W\). Its residual is

$$ \mathbf{b}-\mathbf{p}=(3,2,4)-(3,2,0)=(0,0,4). $$

Every vector in \(W\) has the form \(\mathbf{w}=(s,t,0)\). The dot product with the residual is

$$ (\mathbf{b}-\mathbf{p})\cdot\mathbf{w} =(0,0,4)\cdot(s,t,0) =0s+0t+4\cdot0 =0. $$

Therefore the residual is in \(W^\perp\), and \(\mathbf{p}\) satisfies the projection conditions. In this example the orthogonal complement is the \(z\)-axis: any \((0,0,c)\) is perpendicular to every \((s,t,0)\), and a vector perpendicular to both \((1,0,0)\) and \((0,1,0)\) must have its first two coordinates zero.

Check: \(\mathbf{p}+\left(\mathbf{b}-\mathbf{p}\right)=(3,2,0)+(0,0,4)=(3,2,4)=\mathbf{b}\), as required by the decomposition.

Membership and Orthogonality Characterize the Projection

The residual condition is not only necessary. Together with membership in \(W\), it is enough to identify the orthogonal projection. This characterization gives a direct verification method even when a projection matrix has not been computed. It is also important to keep both parts: a vector in \(W\) need not be the projection, and a residual orthogonal to \(W\) does not by itself say that the proposed projected vector belongs to \(W\).

Theorem (Projection characterization): Let \(W\subseteq\mathbb{R}^n\) be a subspace, let \(P\) be the orthogonal projection matrix onto \(W\), and let \(\mathbf{b},\mathbf{q}\in\mathbb{R}^n\). Then \(\mathbf{q}=P\mathbf{b}\) if and only if \(\mathbf{q}\in W\) and \(\mathbf{b}-\mathbf{q}\in W^\perp\).

Proof. First suppose \(\mathbf{q}=P\mathbf{b}\). The range of \(P\) is \(W\), so \(\mathbf{q}\in W\). The residual theorem just proved gives \(\mathbf{b}-\mathbf{q}=\mathbf{b}-P\mathbf{b}\in W^\perp\).

Conversely, suppose \(\mathbf{q}\in W\) and \(\mathbf{r}=\mathbf{b}-\mathbf{q}\in W^\perp\). Because \(P\) maps onto \(W\) and is idempotent, \(P\mathbf{q}=\mathbf{q}\). Also \(P\mathbf{r}\in W\), so \(\mathbf{r}\cdot P\mathbf{r}=0\) by \(\mathbf{r}\in W^\perp\). Symmetry and idempotence give

$$ \|P\mathbf{r}\|^2 =(P\mathbf{r})^{\top}(P\mathbf{r}) =\mathbf{r}^{\top}P^{\top}P\mathbf{r} =\mathbf{r}^{\top}P\mathbf{r} =\mathbf{r}\cdot P\mathbf{r} =0. $$

A vector has squared norm zero only if it is the zero vector, so \(P\mathbf{r}=\mathbf{0}\). Since \(\mathbf{b}=\mathbf{q}+\mathbf{r}\), linearity now gives \(P\mathbf{b}=P\mathbf{q}+P\mathbf{r}=\mathbf{q}\). Hence \(\mathbf{q}=P\mathbf{b}\), proving the reverse direction as well. \(\square\)

Worked Example: Projection onto a Subspace with Nonorthogonal Generators

Let \(W=\operatorname{span}\{\mathbf{u},\mathbf{v}\}\subseteq\mathbb{R}^3\), where \(\mathbf{u}=(1,1,0)\) and \(\mathbf{v}=(1,0,1)\). Find the projection of \(\mathbf{b}=(5,0,-1)\) onto \(W\) by imposing residual orthogonality.

Write a possible projection as \(\mathbf{p}=a\mathbf{u}+c\mathbf{v}\). The residual must be perpendicular to both generators, since both belong to \(W\). The needed dot products are \(\mathbf{u}\cdot\mathbf{u}=2\), \(\mathbf{u}\cdot\mathbf{v}=1\), \(\mathbf{v}\cdot\mathbf{v}=2\), \(\mathbf{b}\cdot\mathbf{u}=5\), and \(\mathbf{b}\cdot\mathbf{v}=4\). Thus

$$ (\mathbf{b}-a\mathbf{u}-c\mathbf{v})\cdot\mathbf{u}=0 \quad\Longrightarrow\quad 5-2a-c=0, $$
$$ (\mathbf{b}-a\mathbf{u}-c\mathbf{v})\cdot\mathbf{v}=0 \quad\Longrightarrow\quad 4-a-2c=0. $$

From the first equation, \(c=5-2a\). Substitution into the second gives \(4-a-2(5-2a)=0\), so \(4-a-10+4a=0\), \(3a=6\), and \(a=2\). Therefore \(c=5-2(2)=1\), and

$$ \mathbf{p}=2(1,1,0)+(1,0,1)=(3,2,1). $$

The residual is \(\mathbf{b}-\mathbf{p}=(5,0,-1)-(3,2,1)=(2,-2,-2)\). Check its dot products with the generators:

$$ (2,-2,-2)\cdot(1,1,0)=2-2+0=0,\qquad (2,-2,-2)\cdot(1,0,1)=2+0-2=0. $$

Every vector in \(W\) is a linear combination of these generators, so orthogonality to both implies orthogonality to every vector in \(W\). Also, \(\mathbf{p}=2\mathbf{u}+\mathbf{v}\in W\). The characterization therefore confirms that this is the projection.

Check: \((3,2,1)+(2,-2,-2)=(5,0,-1)=\mathbf{b}\), and the two required dot products are zero.

Testing a Projection with a Matrix

For a subspace given as the column space of a matrix, the residual condition can be checked against each column. If \(\mathbf{A}\) has columns that span \(W\), then a vector is perpendicular to all of \(W\) exactly when it is perpendicular to every column of \(\mathbf{A}\). In matrix notation, the condition is \(\mathbf{A}^{\top}(\mathbf{b}-\mathbf{q})=\mathbf{0}\). Indeed, the entries of this product are the dot products of the residual with the respective columns. This is a test for a candidate; it does not require the columns to be orthogonal.

Worked Example: Verify a Projection Using Its Generating Matrix

Let \(W=\operatorname{Col}\mathbf{A}\), where

$$ \mathbf{A}= \begin{bmatrix} 1&0\\ 0&1\\ 1&1 \end{bmatrix}, \qquad \mathbf{b}= \begin{bmatrix}1\\2\\0\end{bmatrix}. $$

The columns of \(\mathbf{A}\) are \(\mathbf{a}_1=(1,0,1)\) and \(\mathbf{a}_2=(0,1,1)\). Try \(\mathbf{q}=\mathbf{a}_2=(0,1,1)\), which is in \(W\). Its residual is

$$ \mathbf{r}=\mathbf{b}-\mathbf{q} = \begin{bmatrix}1\\2\\0\end{bmatrix} - \begin{bmatrix}0\\1\\1\end{bmatrix} = \begin{bmatrix}1\\1\\-1\end{bmatrix}. $$

Test both generating columns:

$$ \mathbf{a}_1\cdot\mathbf{r}=1+0-1=0, \qquad \mathbf{a}_2\cdot\mathbf{r}=0+1-1=0. $$

Equivalently, the matrix test gives

$$ \mathbf{A}^{\top}\mathbf{r} = \begin{bmatrix} 1&0&1\\ 0&1&1 \end{bmatrix} \begin{bmatrix}1\\1\\-1\end{bmatrix} = \begin{bmatrix}1-1\\1-1\end{bmatrix} = \begin{bmatrix}0\\0\end{bmatrix}. $$

Thus \(\mathbf{r}\in W^\perp\), and \(\mathbf{q}\in W\), so the characterization proves that \(\mathbf{q}\) is the projection. For an additional matrix check, the projection matrix is

$$ \mathbf{P}= \frac{1}{3} \begin{bmatrix} 2&-1&1\\ -1&2&1\\ 1&1&2 \end{bmatrix}, \qquad \mathbf{P}\mathbf{b} = \frac{1}{3} \begin{bmatrix} 2-2\\ -1+4\\ 1+2 \end{bmatrix} = \begin{bmatrix}0\\1\\1\end{bmatrix} =\mathbf{q}. $$

The matrix product agrees with the residual test.

Common Mistake: Checking Only Subspace Membership

A tempting but incorrect check is to verify only that a candidate \(\mathbf{q}\) lies in \(W\). In the matrix example, choose instead \(\mathbf{q}_{\mathrm{wrong}}=(1,1,2)\). It does lie in \(W\), because \(\mathbf{q}_{\mathrm{wrong}}=\mathbf{a}_1+\mathbf{a}_2\). But its residual for the same \(\mathbf{b}\) is

$$ \mathbf{b}-\mathbf{q}_{\mathrm{wrong}} = \begin{bmatrix}1\\2\\0\end{bmatrix} - \begin{bmatrix}1\\1\\2\end{bmatrix} = \begin{bmatrix}0\\1\\-2\end{bmatrix}. $$

The first column already disproves orthogonality:

$$ \mathbf{a}_1\cdot(\mathbf{b}-\mathbf{q}_{\mathrm{wrong}}) =(1,0,1)\cdot(0,1,-2) =0+0-2=-2\ne0. $$

So \(\mathbf{q}_{\mathrm{wrong}}\) is not the projection. The correction is to check both conditions: the proposed vector must belong to \(W\), and its residual must be perpendicular to every generator of \(W\). Also take care with the subtraction order: the residual here is \(\mathbf{b}-\mathbf{q}\), not \(\mathbf{q}-\mathbf{b}\). Reversing the order changes the sign of every dot product but not whether those products equal zero.

Using the Condition Reliably

Residual orthogonality is useful because it turns a projection claim into checks involving subspace membership and dot products. For \(W=\operatorname{Col}\mathbf{A}\), checking \(\mathbf{A}^{\top}(\mathbf{b}-\mathbf{q})=\mathbf{0}\) checks all the generator directions at once. If the columns span \(W\), linearity ensures that zero dot product with each column gives zero dot product with every linear combination of those columns.

The condition also explains why the projection is determined uniquely. If two candidates both lie in \(W\) and both have residuals in \(W^\perp\), the projection characterization shows that each equals \(P\mathbf{b}\); therefore they are the same vector. This provides a proof of uniqueness without comparing their coordinates directly. The essential distinction is between the projected component, which belongs to \(W\), and the residual, which belongs to \(W^\perp\): together they decompose \(\mathbf{b}\) into orthogonal components.

Check Your Understanding

For each question, state the subspace membership and residual-orthogonality checks that justify your conclusion.

  1. For \(W=\{(x,y,0):x,y\in\mathbb{R}\}\) and \(\mathbf{b}=(2,-1,5)\), find the projection and verify its residual.
  2. Suppose \(W=\operatorname{span}\{(1,0,1),(0,1,1)\}\). What matrix product tests whether a proposed residual is in \(W^\perp\)?
  3. Let \(P\) be a symmetric idempotent matrix with range \(W\). Identify the identity that makes \((I_n-P)P\mathbf{z}\) zero in the residual-orthogonality proof.
  4. Explain why a candidate \(\mathbf{q}\in W\) is not necessarily the projection of \(\mathbf{b}\) onto \(W\).
  5. If \(\mathbf{q}\in W\) and \(\mathbf{b}-\mathbf{q}\in W^\perp\), what theorem justifies concluding that \(\mathbf{q}\) is the projection?

Test yourself: Linear Algebra final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon