Unit 4, lesson 20

Orthogonal Projection and Best Approximation

The orthogonal decomposition of an inner product space, the orthogonal projection and the projection theorem for best approximation, orthogonal projectors as self-adjoint idempotent maps, and polynomial approximation.

  • Video 20
  • Projection and Best Approximation

Which straight line comes closest to t2t^2 when closeness is judged only by the values at t=−1,0,1,2t = -1, 0, 1, 2? This is one case of a general question, finding the point of a subspace nearest to a given vector. In every finite-dimensional real or complex inner product space the answer comes from splitting the vector into a piece inside the subspace and a piece perpendicular to it, and the inside piece is the nearest point. This lesson proves that the split exists, shows that it gives the one and only nearest point, and characterizes the linear maps that perform it. Throughout, F\mathbb{F} is R\mathbb{R} or C\mathbb{C}, inner products are conjugate-linear in the first argument and linear in the second, and a tuple such as (1,i)(1, i) stands for a column vector.

Key terms

Orthogonal decomposition

Definition Let VV be a finite-dimensional inner product space over F\mathbb{F} and let UU be a subspace. Then VV is the orthogonal direct sum

V=U⊕U⊥.V = U \oplus U^{\perp}.

So every v∈Vv \in V can be written in exactly one way as v=u+wv = u + w with u∈Uu \in U and w∈U⊥w \in U^{\perp}, and then ∥v∥2=∥u∥2+∥w∥2\lVert v \rVert^2 = \lVert u \rVert^2 + \lVert w \rVert^2. For existence, choose an orthonormal basis q1,…,qrq_1, \dots, q_r of UU and extend it to an orthonormal basis q1,…,qnq_1, \dots, q_n of VV. Finite dimension makes this possible, by extending to a basis of VV and applying Gram-Schmidt. Then take

u=∑j=1r⟨qj,v⟩ qj,w=∑j=r+1n⟨qj,v⟩ qj.\begin{gathered} u = \sum_{j=1}^{r} \langle q_j, v \rangle\, q_j, \\[0.4em] w = \sum_{j=r+1}^{n} \langle q_j, v \rangle\, q_j. \end{gathered}

The orthonormal expansion of vv gives v=u+wv = u + w. Here u∈Uu \in U, and w∈U⊥w \in U^{\perp} because each qjq_j with j>rj > r is orthogonal to q1,…,qrq_1, \dots, q_r. For uniqueness, if u+w=u′+w′u + w = u' + w' with u,u′∈Uu, u' \in U and w,w′∈U⊥w, w' \in U^{\perp}, then u−u′=w′−wu - u' = w' - w lies in U∩U⊥={0}U \cap U^{\perp} = \{0\}. The norm identity holds because ⟨u,w⟩=0\langle u, w \rangle = 0 removes both cross terms from ∥u+w∥2\lVert u + w \rVert^2.

In plain words Every vector splits into a piece inside UU and a piece perpendicular to UU, in only one way, and the squared lengths of the two pieces add up.

Example In R3\mathbb{R}^3 with the dot product, let UU be spanned by (1,1,0)(1, 1, 0) and (0,0,1)(0, 0, 1), and let v=(3,1,2)v = (3, 1, 2). Then

v=(2,2,2)+(1,−1,0),v = (2, 2, 2) + (1, -1, 0),

where (2,2,2)=2(1,1,0)+2(0,0,1)(2, 2, 2) = 2(1, 1, 0) + 2(0, 0, 1) lies in UU and (1,−1,0)(1, -1, 0) is orthogonal to both spanning vectors. The squared lengths agree, since 14=12+214 = 12 + 2.

Orthogonal projection

Definition Let UU be a subspace of a finite-dimensional inner product space VV over F\mathbb{F}. The orthogonal projection onto UU is the map PU ⁣:V→VP_U \colon V \to V that sends vv to its UU part in the decomposition V=U⊕U⊥V = U \oplus U^{\perp}. Equivalently, PUvP_U v is the unique vector with

PUv∈Uandv−PUv∈U⊥.P_U v \in U \quad \text{and} \quad v - P_U v \in U^{\perp}.

If q1,…,qrq_1, \dots, q_r is an orthonormal basis of UU, then

PUv=∑j=1r⟨qj,v⟩ qj.P_U v = \sum_{j=1}^{r} \langle q_j, v \rangle\, q_j.

The basis vector sits in the conjugate-linear first slot of each coefficient, so the coefficient is linear in vv. The map PUP_U is linear, fixes every vector of UU and sends every vector of U⊥U^{\perp} to 00. Because the decomposition is unique, PUP_U does not depend on which orthonormal basis of UU is used. For a basis u1,…,uru_1, \dots, u_r of UU that is not orthonormal, PUv=∑jcjujP_U v = \sum_j c_j u_j, where the coefficients solve Gc=hGc = h with the Gram matrix Gij=⟨ui,uj⟩G_{ij} = \langle u_i, u_j \rangle and hi=⟨ui,v⟩h_i = \langle u_i, v \rangle. These equations say exactly that ⟨ui,v−PUv⟩=0\langle u_i, v - P_U v \rangle = 0 for each ii.

In plain words Keep the coordinates of vv along an orthonormal basis of UU and drop the rest. What is dropped is perpendicular to UU.

Example In C2\mathbb{C}^2 with the standard inner product, let U=span⁡{(1,i)}U = \operatorname{span}\{(1, i)\}, with unit vector q=12(1,i)q = \tfrac{1}{\sqrt{2}}(1, i), and let v=(0,2)v = (0, 2). Then ⟨q,v⟩=12(−i)(2)=−2 i\langle q, v \rangle = \tfrac{1}{\sqrt{2}}(-i)(2) = -\sqrt{2}\,i, so

PUv=−2 i⋅12(1,i)=(−i,1).P_U v = -\sqrt{2}\,i \cdot \tfrac{1}{\sqrt{2}}(1, i) = (-i, 1).

The residual v−PUv=(i,1)v - P_U v = (i, 1) satisfies ⟨(1,i),(i,1)⟩=i−i=0\langle (1, i), (i, 1) \rangle = i - i = 0. Putting qq in the second slot instead gives the coefficient ⟨v,q⟩=2 i\langle v, q \rangle = \sqrt{2}\,i and the point (i,−1)(i, -1). Its residual (−i,3)(-i, 3) has inner product −4i-4i with (1,i)(1, i), so that point is not the projection.

Best approximation

Definition Let UU be a subspace of an inner product space VV over F\mathbb{F} and let v∈Vv \in V. A best approximation to vv from UU is a vector u0∈Uu_0 \in U with

∥v−u0∥≤∥v−u∥for every u∈U.\begin{gathered} \lVert v - u_0 \rVert \le \lVert v - u \rVert \\[0.4em] \text{for every } u \in U. \end{gathered}

The tool for finding it is the squared-distance identity. If p∈Up \in U and v−p∈U⊥v - p \in U^{\perp}, then for every u∈Uu \in U

∥v−u∥2=∥v−p∥2+∥p−u∥2.\lVert v - u \rVert^2 = \lVert v - p \rVert^2 + \lVert p - u \rVert^2.

To see it, write v−u=(v−p)+(p−u)v - u = (v - p) + (p - u). The second piece lies in UU and the first is orthogonal to UU, so both cross terms ⟨v−p,p−u⟩\langle v - p, p - u \rangle and ⟨p−u,v−p⟩\langle p - u, v - p \rangle vanish when the squared norm is expanded. The term ∥p−u∥2\lVert p - u \rVert^2 is positive unless u=pu = p. So such a pp is a best approximation, and it is the only one.

In plain words Once a point of UU has a residual perpendicular to UU, every other point of UU is farther from vv, and the extra squared distance is exactly the squared distance between the two points of UU.

Example For v=(3,1,2)v = (3, 1, 2) and the plane UU spanned by (1,1,0)(1, 1, 0) and (0,0,1)(0, 0, 1), the point p=(2,2,2)p = (2, 2, 2) has the residual (1,−1,0)(1, -1, 0), which is orthogonal to UU. The competitor u=(3,3,2)=3(1,1,0)+2(0,0,1)u = (3, 3, 2) = 3(1, 1, 0) + 2(0, 0, 1) gives

∥v−u∥2=0+4+0=4=2+2,\lVert v - u \rVert^2 = 0 + 4 + 0 = 4 = 2 + 2,

where ∥v−p∥2=2\lVert v - p \rVert^2 = 2 and ∥p−u∥2=2\lVert p - u \rVert^2 = 2. So uu is farther from vv than pp, and the excess is the squared distance from pp to uu.

Projection theorem

Definition Let VV be a finite-dimensional inner product space over F\mathbb{F}, let UU be a subspace and let v∈Vv \in V. Then the following hold.

  1. Exactly one best approximation to vv from UU exists, namely PUvP_U v.

  2. A vector u0∈Uu_0 \in U is that best approximation exactly when v−u0∈U⊥v - u_0 \in U^{\perp}.

  3. The squared distance from vv to UU is

    ∥v−PUv∥2=∥v∥2−∥PUv∥2.\lVert v - P_U v \rVert^2 = \lVert v \rVert^2 - \lVert P_U v \rVert^2.

Existence comes from the orthogonal decomposition, which used finite dimension to build an orthonormal basis. Uniqueness and the test in part 2 come from the squared-distance identity. A vector that passes the test is the unique best approximation, and conversely the unique best approximation is PUvP_U v, which passes the test. Part 3 is the Pythagorean identity for v=PUv+(v−PUv)v = P_U v + (v - P_U v), and for an orthonormal basis q1,…,qrq_1, \dots, q_r of UU the subtracted term equals ∑j∣⟨qj,v⟩∣2\sum_j \lvert \langle q_j, v \rangle \rvert^2. The theorem is about the point u0u_0, not about coordinates. If UU is described by a dependent spanning list, several coefficient lists give the same u0u_0. In infinite-dimensional spaces a subspace need not contain a nearest point at all.

In plain words In a finite-dimensional inner product space every vector has exactly one nearest point in a given subspace, and you recognize it by its residual being perpendicular to the subspace.

Example For v=(3,1,2)v = (3, 1, 2) and the same plane UU, the test confirms u0=(2,2,2)u_0 = (2, 2, 2) without any minimizing, and the squared distance is 14−12=214 - 12 = 2. Now describe the plane by the dependent list (1,1,0)(1, 1, 0), (0,0,1)(0, 0, 1), (1,1,1)(1, 1, 1). Then

2(1,1,0)+2(0,0,1)=(2,2,2),2(1,1,1)=(2,2,2),\begin{aligned} 2(1, 1, 0) + 2(0, 0, 1) &= (2, 2, 2), \\[0.4em] 2(1, 1, 1) &= (2, 2, 2), \end{aligned}

so the coefficient lists (2,2,0)(2, 2, 0) and (0,0,2)(0, 0, 2) name the same unique nearest point.

Orthogonal projector

Definition Let VV be a finite-dimensional inner product space over F\mathbb{F}. A linear map P ⁣:V→VP \colon V \to V is an orthogonal projector if

P2=PandP∗=P.P^2 = P \quad \text{and} \quad P^{*} = P.

Every orthogonal projection PUP_U is one. It is idempotent because it fixes its own outputs, which lie in UU. It is self-adjoint because v−PUvv - P_U v and v′−PUv′v' - P_U v' are orthogonal to UU, so

⟨PUv,v′⟩=⟨PUv,PUv′⟩=⟨v,PUv′⟩.\begin{aligned} \langle P_U v, v' \rangle &= \langle P_U v, P_U v' \rangle \\[0.4em] &= \langle v, P_U v' \rangle. \end{aligned}

Conversely, if P2=P=P∗P^2 = P = P^{*}, then P=PUP = P_U for U=im⁡PU = \operatorname{im} P. Indeed PvPv lies in im⁡P\operatorname{im} P, and for every image vector PzPz the residual v−Pvv - Pv satisfies

⟨Pz,v−Pv⟩=⟨z,P(v−Pv)⟩=⟨z,Pv−P2v⟩=0.\begin{aligned} \langle Pz, v - Pv \rangle &= \langle z, P(v - Pv) \rangle \\[0.4em] &= \langle z, Pv - P^2v \rangle = 0. \end{aligned}

If the columns of Q∈Fn×rQ \in \mathbb{F}^{n \times r} are the coordinates of an orthonormal basis of UU in an orthonormal basis of VV, so that Q∗Q=IrQ^{*}Q = I_r, then the matrix of PUP_U in that basis of VV is QQ∗QQ^{*}. In a basis with Gram matrix GG, the condition P∗=PP^{*} = P reads M∗G=GMM^{*}G = GM for the coordinate matrix MM of PP. Idempotence alone is not enough. A map with P2=PP^2 = P is the projection onto its image along its kernel, and when the kernel is not (im⁡P)⊥(\operatorname{im} P)^{\perp} the projection is oblique and misses the nearest point for some vectors.

In plain words A map is an orthogonal projector when applying it a second time changes nothing and it equals its own adjoint. The second condition is what makes the discarded part perpendicular.

Example For U=span⁡{(1,i)}U = \operatorname{span}\{(1, i)\} in C2\mathbb{C}^2 and q=12(1,i)q = \tfrac{1}{\sqrt{2}}(1, i),

P=qq∗=12[1−ii1].P = qq^{*} = \frac{1}{2}\begin{bmatrix} 1 & -i \\ i & 1 \end{bmatrix}.

It is Hermitian, its square is PP, and P(0,2)=(−i,1)P(0, 2) = (-i, 1), the projection found earlier. By contrast, on R2\mathbb{R}^2 with the dot product the matrix

K=[1200]K = \begin{bmatrix} 1 & 2 \\ 0 & 0 \end{bmatrix}

satisfies K2=KK^2 = K and has the first coordinate axis as its image, but KT≠KK^{\mathsf{T}} \ne K. It sends (0,1)(0, 1) to (2,0)(2, 0), at squared distance 55 from (0,1)(0, 1), while the point (0,0)(0, 0) of the same axis is at squared distance 11.

Polynomial approximation in an inner product space

Definition Let t1,…,tNt_1, \dots, t_N be distinct real numbers with N≥d+1N \ge d + 1. On Pd\mathcal{P}_d, the space of polynomials of degree at most dd with coefficients in F\mathbb{F}, the formula

⟨p,q⟩=∑k=1Np(tk)‾ q(tk)\langle p, q \rangle = \sum_{k=1}^{N} \overline{p(t_k)}\, q(t_k)

defines an inner product. It is positive definite because ⟨p,p⟩=∑k∣p(tk)∣2=0\langle p, p \rangle = \sum_k \lvert p(t_k) \rvert^2 = 0 forces pp to vanish at N≥d+1N \ge d + 1 points, and a nonzero polynomial of degree at most dd has at most dd roots. Polynomial approximation in an inner product space asks for the polynomial in a subspace UU, such as Pe\mathcal{P}_e with e<de < d, that is closest to a given pp in this or another inner product. By the projection theorem the answer is PUpP_U p, found from the Gram equations for a basis of UU. A different inner product, for example one with different sample points, generally gives a different best approximation.

In plain words Polynomials are vectors, and an inner product decides how far apart two of them are. The best approximation from a smaller polynomial space is then an orthogonal projection like any other.

Example Use the points −1,0,1,2-1, 0, 1, 2 on P2\mathcal{P}_2 and project t2t^2 onto P1=span⁡{1,t}\mathcal{P}_1 = \operatorname{span}\{1, t\}. The sample vectors are (1,1,1,1)(1, 1, 1, 1) for 11, (−1,0,1,2)(-1, 0, 1, 2) for tt and (1,0,1,4)(1, 0, 1, 4) for t2t^2, so the Gram equations for c0+c1tc_0 + c_1 t are

[4226][c0c1]=[68],\begin{bmatrix} 4 & 2 \\ 2 & 6 \end{bmatrix} \begin{bmatrix} c_0 \\ c_1 \end{bmatrix} = \begin{bmatrix} 6 \\ 8 \end{bmatrix},

with solution c0=c1=1c_0 = c_1 = 1. The best line is 1+t1 + t. The residual t2−t−1t^2 - t - 1 has samples (1,−1,−1,1)(1, -1, -1, 1), which are orthogonal to the samples of 11 and of tt, and its squared norm is 44. The line 2t2t, which agrees with t2t^2 at 00 and 22, has squared error 10=4+610 = 4 + 6, where 66 is the squared norm of (1+t)−2t=1−t(1 + t) - 2t = 1 - t.

Check yourself

  1. In R3\mathbb{R}^3 with the dot product, find the orthogonal projection of v=(1,2,3)v = (1, 2, 3) onto the line spanned by u=(1,0,1)u = (1, 0, 1), and the distance from vv to that line.
Show the answer

The coefficient is ⟨u,v⟩/⟨u,u⟩=4/2=2\langle u, v \rangle / \langle u, u \rangle = 4/2 = 2, so the projection is 2u=(2,0,2)2u = (2, 0, 2). The residual (−1,2,1)(-1, 2, 1) has dot product −1+0+1=0-1 + 0 + 1 = 0 with uu, so it passes the test, and the distance is its length 6\sqrt{6}.

  1. On P2\mathcal{P}_2 use the inner product ⟨p,q⟩=∑kp(tk)‾ q(tk)\langle p, q \rangle = \sum_k \overline{p(t_k)}\, q(t_k) over the points −1,0,1-1, 0, 1. Find the best approximation to t2+2tt^2 + 2t from P1\mathcal{P}_1 and its squared error.
Show the answer

For these symmetric points ⟨1,t⟩=−1+0+1=0\langle 1, t \rangle = -1 + 0 + 1 = 0, so 11 and tt form an orthogonal basis of P1\mathcal{P}_1 and each coefficient can be found on its own. The samples of p=t2+2tp = t^2 + 2t are (−1,0,3)(-1, 0, 3), so

⟨1,p⟩⟨1,1⟩=23,⟨t,p⟩⟨t,t⟩=42=2.\frac{\langle 1, p \rangle}{\langle 1, 1 \rangle} = \frac{2}{3}, \qquad \frac{\langle t, p \rangle}{\langle t, t \rangle} = \frac{4}{2} = 2.

The best approximation is 23+2t\tfrac23 + 2t. The residual t2−23t^2 - \tfrac23 has samples (13,−23,13)(\tfrac13, -\tfrac23, \tfrac13), which are orthogonal to (1,1,1)(1, 1, 1) and to (−1,0,1)(-1, 0, 1), and the squared error is 19+49+19=23\tfrac19 + \tfrac49 + \tfrac19 = \tfrac23.

  1. Give R2\mathbb{R}^2 the inner product ⟨x,y⟩=x1y1+2x2y2\langle x, y \rangle = x_1y_1 + 2x_2y_2. Both matrices below are idempotent and have the line spanned by (1,1)(1, 1) as image. Which one is the orthogonal projector onto that line?
E=12[1111],M=13[1212]E = \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}, \qquad M = \frac{1}{3}\begin{bmatrix} 1 & 2 \\ 1 & 2 \end{bmatrix}
Show the answer

The standard basis has Gram matrix G=diag⁡(1,2)G = \operatorname{diag}(1, 2), so a real matrix is self-adjoint for this inner product exactly when XTG=GXX^{\mathsf{T}}G = GX. For MM both sides equal

13[1224],\frac{1}{3}\begin{bmatrix} 1 & 2 \\ 2 & 4 \end{bmatrix},

so MM is the orthogonal projector. For EE the two sides are different,

ETG=12[1212],GE=12[1122],\begin{gathered} E^{\mathsf{T}}G = \frac{1}{2}\begin{bmatrix} 1 & 2 \\ 1 & 2 \end{bmatrix}, \\[0.4em] GE = \frac{1}{2}\begin{bmatrix} 1 & 1 \\ 2 & 2 \end{bmatrix}, \end{gathered}

even though EE is the orthogonal projector for the dot product. Test both on v=(1,0)v = (1, 0). The matrix MM gives (13,13)(\tfrac13, \tfrac13) with residual (23,−13)(\tfrac23, -\tfrac13), and ⟨(1,1),(23,−13)⟩=23−23=0\langle (1, 1), (\tfrac23, -\tfrac13) \rangle = \tfrac23 - \tfrac23 = 0. The matrix EE gives (12,12)(\tfrac12, \tfrac12) with residual (12,−12)(\tfrac12, -\tfrac12), whose inner product with (1,1)(1, 1) is 12−1=−12\tfrac12 - 1 = -\tfrac12. The squared distances are 23\tfrac23 and 34\tfrac34, so EE misses the nearest point.

How this lesson connects