Projection as a Best Approximation
Suppose a vector \(\mathbf{b}\) does not lie in a subspace \(W\). We may still want a vector in \(W\) that represents \(\mathbf{b}\) as closely as possible. The natural candidate is the orthogonal projection of \(\mathbf{b}\) onto \(W\): it is the part of \(\mathbf{b}\) that lies in \(W\), while the remaining part is perpendicular to \(W\). The best approximation theorem makes “as closely as possible” precise and proves that this candidate is the only closest vector in \(W\).
Throughout, work in \(\mathbb{R}^n\) with the standard dot product \(\mathbf{x}\cdot\mathbf{y}=\mathbf{x}^{\top}\mathbf{y}\) and norm \(\|\mathbf{x}\|=\sqrt{\mathbf{x}\cdot\mathbf{x}}\). For \(\mathbf{b}\in\mathbb{R}^n\) and \(\mathbf{w}\in W\), the distance from \(\mathbf{b}\) to \(\mathbf{w}\) is \(\|\mathbf{b}-\mathbf{w}\|\). A vector \(\mathbf{r}\) is perpendicular to \(W\) if \(\mathbf{r}\cdot\mathbf{w}=\mathbf{0}\) in the scalar sense—that is, \(\mathbf{r}\cdot\mathbf{w}=0\)—for every \(\mathbf{w}\in W\).
The orthogonal decomposition theorem gives a unique decomposition \(\mathbf{b}=\mathbf{p}+\mathbf{r}\) with \(\mathbf{p}\in W\) and \(\mathbf{r}\in W^\perp\). We use that result here: it ensures that the projection exists and is uniquely defined. The theorem below proves the further claim that this projection is not merely a vector in \(W\), but the unique vector in \(W\) closest to \(\mathbf{b}\).
The Pythagorean Identity
The key calculation compares the residual \(\mathbf{b}-\mathbf{p}\) with the difference between two vectors in the subspace. Because both \(\mathbf{p}\) and any \(\mathbf{w}\in W\) belong to \(W\), their difference \(\mathbf{p}-\mathbf{w}\) also belongs to \(W\). The residual is perpendicular to that difference.
Proof. By the definition of the norm and the distributive property of the dot product,
In \(\mathbb{R}^n\), \(\mathbf{x}\cdot\mathbf{y}=\mathbf{y}\cdot\mathbf{x}\). Since \(\mathbf{x}\cdot\mathbf{y}=0\), both cross terms are zero. The remaining terms are \(\|\mathbf{x}\|^2\) and \(\|\mathbf{y}\|^2\), which gives the stated identity. \(\square\)
The Best Approximation Theorem
\(\|\mathbf{b}-\mathbf{w}\|^2=\|\mathbf{b}-\mathbf{p}\|^2+\|\mathbf{p}-\mathbf{w}\|^2.\)
Equality \(\|\mathbf{b}-\mathbf{w}\|=\|\mathbf{b}-\mathbf{p}\|\) holds if and only if \(\mathbf{w}=\mathbf{p}\).
Proof. By the definition of the projection, \(\mathbf{p}\in W\) and \(\mathbf{b}-\mathbf{p}\in W^\perp\). Fix any \(\mathbf{w}\in W\). Since \(W\) is a subspace, \(\mathbf{p}-\mathbf{w}\in W\), so \((\mathbf{b}-\mathbf{p})\cdot(\mathbf{p}-\mathbf{w})=0\). Decompose the difference from \(\mathbf{b}\) to \(\mathbf{w}\) as
The two vectors on the right are perpendicular. Applying the Pythagorean identity gives
A squared norm is nonnegative, so \(\|\mathbf{b}-\mathbf{w}\|^2\geq\|\mathbf{b}-\mathbf{p}\|^2\). Both norms are nonnegative, and squaring preserves their order; hence \(\|\mathbf{b}-\mathbf{w}\|\geq\|\mathbf{b}-\mathbf{p}\|\). Equality holds exactly when \(\|\mathbf{p}-\mathbf{w}\|^2=0\), which holds exactly when \(\mathbf{p}-\mathbf{w}=\mathbf{0}\), or \(\mathbf{w}=\mathbf{p}\). Thus \(\mathbf{p}\) is a minimizer and no other vector in \(W\) is a minimizer. \(\square\)
The identity is stronger than a comparison of distances: it tells exactly how much squared distance is added by choosing \(\mathbf{w}\) instead of the projection. The extra term is \(\|\mathbf{p}-\mathbf{w}\|^2\), which is zero only when the choice is the projection itself. This also explains why uniqueness follows from the geometry rather than from a particular formula for computing \(\mathbf{p}\).
Worked Examples
Worked Example: Projection onto a Line
Let \(W=\operatorname{span}\{(1,1)\}\subset\mathbb{R}^2\), and let \(\mathbf{b}=(3,1)\). Verify that \(\mathbf{p}=(2,2)\) is the unique closest vector in \(W\).
First, \(\mathbf{p}=2(1,1)\), so \(\mathbf{p}\in W\). The residual is
Its dot product with the generator of \(W\) is \((1,-1)\cdot(1,1)=1-1=0\). Every vector in \(W\) is a multiple of this generator, so the residual is perpendicular to all of \(W\). Thus \(\mathbf{p}\) is the projection. Write an arbitrary vector in \(W\) as \(\mathbf{w}=(t,t)\), with \(t\in\mathbb{R}\). The theorem gives
This is at least \(2\), with equality exactly when \(t=2\). Directly, \(\|\mathbf{b}-\mathbf{p}\|^2=\|(1,-1)\|^2=1+1=2\). For a check at \(t=3\), \(\mathbf{w}=(3,3)\), so \(\|\mathbf{b}-\mathbf{w}\|^2=\|(0,-2)\|^2=4\); the identity gives \(2+\|(2,2)-(3,3)\|^2=2+2=4\). The projection is indeed uniquely closest.
Worked Example: Projection onto a Plane in R³
Let \(W=\operatorname{span}\{(1,0,1),(0,1,1)\}\) and \(\mathbf{b}=(1,2,0)\). Check that \(\mathbf{p}=(0,1,1)\) is the unique closest vector in \(W\).
The proposed vector is the second generator, so \(\mathbf{p}\in W\). Its residual is \(\mathbf{r}=\mathbf{b}-\mathbf{p}=(1,1,-1)\). Check perpendicularity against both generators:
Every vector in \(W\) is a linear combination of those generators, so \(\mathbf{r}\) is perpendicular to every vector in \(W\). For a specific comparison, take \(\mathbf{w}=(1,0,1)\in W\). The projection distance squared is \(\|\mathbf{b}-\mathbf{p}\|^2=1+1+1=3\), while
The theorem accounts for the difference: \(\mathbf{p}-\mathbf{w}=(-1,1,0)\), whose squared norm is \(1+1+0=2\), and \(3+2=5\). For every other \(\mathbf{w}\in W\), the same identity says its squared distance is \(3+\|\mathbf{p}-\mathbf{w}\|^2\), so only \(\mathbf{w}=\mathbf{p}\) attains the minimum.
Worked Example: A Coordinate Subspace
Let \(W=\{(x,y,0):x,y\in\mathbb{R}\}\subset\mathbb{R}^3\) and \(\mathbf{b}=(2,-1,3)\). Show that \(\mathbf{p}=(2,-1,0)\) is the unique closest vector in \(W\).
The vector \(\mathbf{p}\) belongs to \(W\), and \(\mathbf{b}-\mathbf{p}=(0,0,3)\). For any \(\mathbf{w}=(x,y,0)\in W\), the dot product \((0,0,3)\cdot(x,y,0)=0\). Hence \(\mathbf{b}-\mathbf{p}\) is perpendicular to \(W\), and \(\mathbf{p}\) is the projection. Applying the theorem to an arbitrary \(\mathbf{w}\) gives
The right side is at least \(9\), and it equals \(9\) only if \(x=2\) and \(y=-1\), which makes \(\mathbf{w}=\mathbf{p}\). As a check, \(\|\mathbf{b}-\mathbf{p}\|^2=\|(0,0,3)\|^2=9\). For the alternative \(\mathbf{w}=(0,0,0)\), the squared distance is \(2^2+(-1)^2+3^2=14\); the theorem gives \(9+\|(2,-1,0)\|^2=9+5=14\).
Why the Orthogonality Condition Matters
For any \(\mathbf{w}\in W\), the decomposition used in the proof has two parts: the residual \(\mathbf{b}-\mathbf{p}\), which points away from the subspace, and the in-subspace adjustment \(\mathbf{p}-\mathbf{w}\). Perpendicularity ensures their squared lengths add. Without that perpendicularity, the dot-product expansion has cross terms, and the distance need not be minimized at \(\mathbf{p}\). This is why merely choosing a vector in \(W\) is not enough; it must satisfy the projection condition.
The conclusion also applies when \(\mathbf{b}\in W\). In that case the decomposition is \(\mathbf{b}=\mathbf{b}+\mathbf{0}\), so \(\operatorname{proj}_W\mathbf{b}=\mathbf{b}\). The minimum distance is \(0\), and the theorem says no other vector in \(W\) has distance \(0\) from \(\mathbf{b}\). At the other boundary case \(W=\{\mathbf{0}\}\), the only available vector is \(\mathbf{0}\), which is necessarily the unique minimizer; the theorem’s comparison remains valid.
A Common Pitfall
A frequent error is to subtract the squared correction term instead of adding it. In the line example, \(\mathbf{b}=(3,1)\), \(\mathbf{p}=(2,2)\), and \(\mathbf{w}=(3,3)\). The incorrect calculation would claim
But direct substitution gives \(\mathbf{b}-\mathbf{w}=(0,-2)\), so \(\|\mathbf{b}-\mathbf{w}\|^2=4\), not \(0\). The correct Pythagorean identity uses a plus sign: \(2+2=4\). Geometrically, moving from the projection to another vector in \(W\) adds a perpendicular displacement to the residual, so it increases the squared distance rather than subtracting from it.
Check Your Understanding
Use the projection condition and the best approximation identity to justify each conclusion.
- Suppose \(\mathbf{b}=\mathbf{p}+\mathbf{r}\), with \(\mathbf{p}\in W\) and \(\mathbf{r}\in W^\perp\). Write the identity for \(\|\mathbf{b}-\mathbf{w}\|^2\) for an arbitrary \(\mathbf{w}\in W\).
- For \(W=\operatorname{span}\{(1,0)\}\subset\mathbb{R}^2\) and \(\mathbf{b}=(4,3)\), verify that \((4,0)\) is the projection, then compare its distance with the distance to \((2,0)\).
- Why does equality of the distances to \(\mathbf{b}\) force \(\mathbf{w}=\mathbf{p}\) in the best approximation theorem?
- For \(W=\{(x,0):x\in\mathbb{R}\}\) and \(\mathbf{b}=(1,2)\), calculate the projection distance and the distance to \((0,0)\), and check the Pythagorean identity.
- State which step in the proof fails if the proposed vector \(\mathbf{p}\in W\) does not have residual \(\mathbf{b}-\mathbf{p}\) perpendicular to \(W\).