maths2u
Tier
⌕ Search ⌘K
Theorem

The orthogonal projection theorem

T-051Home MU-202Threads structure
Statement

Let \(V\) be an inner product space over \(\mathbb{R}\) or \(\mathbb{C}\), with inner product \(\langle \cdot,\cdot\rangle\) and induced norm \(\|v\|=\sqrt{\langle v,v\rangle}\). Let \(W \subseteq V\) be a subspace which is complete in the norm induced by \(\langle\cdot,\cdot\rangle\) (in particular, any finite-dimensional subspace of any inner product space, or any closed subspace of a Hilbert space, qualifies). Then for every \(x \in V\) there exists a unique \(p \in W\) minimising the distance to \(x\), that is \[ \|x-p\| = \inf_{w \in W} \|x-w\|, \] and this minimiser \(p\) is characterised uniquely by the orthogonality condition \[ x-p \perp W, \quad \text{i.e.} \quad \langle x-p,\, w\rangle = 0 \ \ \forall w\in W. \] The map \(P_W:V\to W\), \(x\mapsto p\), is linear, satisfies \(P_W^2=P_W\), \(\|P_W x\|\le \|x\|\), and is called the orthogonal projection of \(V\) onto \(W\).

Why it matters

This theorem is the structural engine behind least-squares approximation, Fourier series, the Gram–Schmidt process, and the existence of orthogonal complements. It converts a metric optimisation problem — "find the closest point in \(W\) to \(x\)" — into an algebraic one — "find the point whose error is orthogonal to \(W\)" — which is exactly what makes projections computable via linear equations (the normal equations) rather than calculus of variations from scratch.

It is also the finite-dimensional/Hilbert-space engine of decomposition: it produces the direct sum \(V = W \oplus W^{\perp}\) whenever \(W\) is complete, which underlies spectral theory, orthogonal diagonalisation, and the projection-valued measures of functional analysis.

Hypotheses
\(V\) is an inner product space (real or complex).Without an inner product there is no notion of orthogonality or of a norm coming from an inner product, so "closest point" and "orthogonal" are not even defined; one could still minimise a norm in a general normed space, but uniqueness and the orthogonality characterisation can fail — e.g. in \((\mathbb{R}^2,\|\cdot\|_1)\) the closest point on a line to an external point need not be unique. \(W\) is a linear subspace of \(V\).If \(W\) is merely a convex set the existence/uniqueness of a minimiser still holds (in the complete case) but the clean orthogonality characterisation \(\langle x-p,w\rangle=0\ \forall w\in W\) fails; instead one only gets the weaker variational inequality \(\operatorname{Re}\langle x-p, w-p\rangle \le 0\) for all \(w\in W\). If \(W\) is not even convex — e.g. \(W=\{(t,t^2):t\in\mathbb{R}\}\subset\mathbb{R}^2\) — the closest point can fail to be unique. \(W\) is complete in the induced norm.Take \(V=L^2[0,1]\) and \(W\) the (dense, non-closed) subspace of polynomials, and \(x\) a function not equal a.e. to any polynomial but approximable arbitrarily well, e.g. \(x(t)=|t-\tfrac12|^{1/2}\)-type constructions in general force \(\inf_{w\in W}\|x-w\|=0\) with no polynomial actually attaining it, so no minimiser \(p\in W\) exists at all — existence fails outright without completeness.
Proof
1
Let \(d = \inf_{w\in W}\|x-w\|\). Choose a minimising sequence \((w_n)\subseteq W\) with \(\|x-w_n\|\to d\).
Definition of infimum: an infimum is a limit of values of the function \(w\mapsto\|x-w\|\ge 0\); such a sequence exists by the definition of infimum in \(\mathbb{R}\).A
2
\[ \|w_n-w_m\|^2 = 2\|x-w_n\|^2+2\|x-w_m\|^2-4\Big\|x-\tfrac{w_n+w_m}{2}\Big\|^2 \]
Parallelogram law applied to the vectors \(a=x-w_n\), \(b=x-w_m\): \(\|a-b\|^2+\|a+b\|^2=2\|a\|^2+2\|b\|^2\), rearranged using \(a-b=w_m-w_n\) and \(a+b=2x-(w_n+w_m)\).C
3
Since \(\tfrac{w_n+w_m}{2}\in W\) (as \(W\) is a subspace), \(\big\|x-\tfrac{w_n+w_m}{2}\big\|\ge d\), so \[ \|w_n-w_m\|^2 \le 2\|x-w_n\|^2+2\|x-w_m\|^2-4d^2 \xrightarrow[n,m\to\infty]{} 2d^2+2d^2-4d^2=0. \]
Definition of \(d\) as the infimum over \(W\), together with the limit \(\|x-w_n\|\to d\) from Step 1; this is the standard "parallelogram trick" showing minimising sequences are Cauchy.B
4
Hence \((w_n)\) is Cauchy in \(W\); since \(W\) is complete, \(w_n\to p\) for some \(p\in W\).
Completeness hypothesis on \(W\), applied to the Cauchy sequence just constructed. This step is exactly where the completeness hypothesis is used, and is the only place it is used.B
5
By continuity of the norm, \(\|x-p\|=\lim_n\|x-w_n\| = d\), so \(p\) attains the infimum: existence is proved.
Continuity of \(v\mapsto\|v\|\) (reverse triangle inequality: \(|\,\|x-p\|-\|x-w_n\|\,|\le \|p-w_n\|\to0\)).A
6
Claim: \(x-p\perp W\). Fix \(w\in W\), \(w\neq 0\), and \(t\in\mathbb{R}\) (or \(\mathbb{C}\)); consider \(f(t)=\|x-p-tw\|^2\ge d^2\) since \(p+tw\in W\).
\(p+tw\in W\) as \(W\) is a subspace, and \(d\) is the infimum of \(\|x-w'\|\) over \(w'\in W\), so \(f(t)\ge d^2=\|x-p\|^2=f(0)\) for all \(t\): \(f\) attains its minimum at \(t=0\).B
7
Expand (real case first): \(f(t)=\|x-p\|^2-2t\langle x-p,w\rangle+t^2\|w\|^2\). Since \(f\) is a minimum at \(t=0\) and differentiable, \(f'(0)=0\), giving \(\langle x-p,w\rangle=0\).
Sesquilinearity/bilinearity of the inner product to expand the square, then elementary calculus (a differentiable real function minimised at an interior point has zero derivative there).A
8
Complex case: for \(z\in\mathbb{C}\), \(f(z)=\|x-p\|^2-2\operatorname{Re}(\bar z\langle x-p,w\rangle)+|z|^2\|w\|^2\ge f(0)\) for all \(z\); taking \(z=t\overline{\langle x-p,w\rangle}\) for \(t\ge0\) real gives \(-2t|\langle x-p,w\rangle|^2+t^2|\langle x-p,w\rangle|^2\|w\|^2\ge0\) for all small \(t\gt0\), forcing \(|\langle x-p,w\rangle|^2=0\), i.e. \(\langle x-p,w\rangle=0\).
Same minimisation argument as Step 7 but along the complex ray that makes the linear term real and negative unless it already vanishes; standard device for extending real variational arguments to complex inner product spaces.C
9
As \(w\in W\) was arbitrary, \(\langle x-p,w\rangle=0\) for all \(w\in W\), i.e. \(x-p\perp W\). This proves the orthogonality characterisation for the \(p\) constructed above.
Universal generalisation: the argument in Steps 6–8 held for an arbitrary fixed \(w\in W\), hence holds for all \(w\in W\).A
10
Uniqueness: suppose \(p,p'\in W\) both satisfy \(x-p\perp W\) and \(x-p'\perp W\). Then \(p-p'\in W\) and \[ \|p-p'\|^2=\langle p-p',p-p'\rangle=\langle (x-p')-(x-p),\,p-p'\rangle=\langle x-p',p-p'\rangle-\langle x-p,p-p'\rangle=0-0=0, \] so \(p=p'\).
Both orthogonality relations applied to the test vector \(w=p-p'\in W\), plus positive-definiteness of the inner product (\(\langle v,v\rangle=0\Rightarrow v=0\)).B
11
Converse direction of the characterisation: if \(q\in W\) satisfies \(x-q\perp W\), then for any \(w\in W\), writing \(w=q+(w-q)\) with \(w-q\in W\), \[ \|x-w\|^2=\|(x-q)-(w-q)\|^2=\|x-q\|^2+\|w-q\|^2 \ge \|x-q\|^2 \] by the Pythagorean identity, since \(x-q\perp(w-q)\). Hence \(q\) is itself a minimiser, so \(q=p\) by uniqueness. This shows the orthogonality condition is not just necessary but also sufficient to characterise \(p\).
Pythagoras' theorem in an inner product space: if \(u\perp v\) then \(\|u+v\|^2=\|u\|^2+\|v\|^2\), which follows directly from expanding \(\langle u+v,u+v\rangle\) and using \(\langle u,v\rangle=0\).B
12
Linearity and idempotence of \(P_W\): for \(x_1,x_2\in V\), \(\alpha,\beta\) scalars, the vector \(\alpha P_W x_1+\beta P_W x_2\in W\) satisfies \(\big(\alpha x_1+\beta x_2\big)-\big(\alpha P_Wx_1+\beta P_Wx_2\big) = \alpha(x_1-P_Wx_1)+\beta(x_2-P_Wx_2)\perp W\) (linearity of the inner product in the first slot / conjugate-linearity in the second, applied to each term). By the uniqueness of Step 10 this forces \(P_W(\alpha x_1+\beta x_2)=\alpha P_Wx_1+\beta P_Wx_2\). Idempotence \(P_W^2=P_W\) is immediate since for \(w\in W\), \(w-w=0\perp W\) trivially, so \(P_Ww=w\).
Uniqueness (Step 10) applied to identify a vector satisfying the orthogonality characterisation with \(P_W\) of the corresponding point, plus bilinearity/sesquilinearity of \(\langle\cdot,\cdot\rangle\).B
13
Norm bound: by Step 11's Pythagorean identity with \(w=0\in W\), \(\|x\|^2=\|x-P_Wx\|^2+\|P_Wx\|^2\ge\|P_Wx\|^2\), so \(\|P_Wx\|\le\|x\|\).
Pythagoras (Step 11) specialised to \(w=0\), using \(0\in W\) since \(W\) is a subspace.A
Result
\( x-P_Wx \perp W \iff P_Wx = \operatorname*{arg\,min}_{w\in W}\|x-w\| \), unique when \(W\) is complete

Reading. Among all vectors in \(W\), exactly one is closest to \(x\); it is found not by calculus over all of \(W\) but by demanding that the leftover error \(x-p\) have zero inner product with every direction in \(W\). "Closest" and "error orthogonal to \(W\)" are the same condition.

Scope. Applies to any inner product space \(V\) and any subspace \(W\) that is complete under the induced norm — automatically true when \(\dim W\lt\infty\) (even if \(V\) is infinite-dimensional), and true for closed subspaces of a complete space (Hilbert space). It fails for non-closed subspaces of infinite-dimensional spaces, and the clean orthogonality form fails if \(W\) is replaced by a non-linear convex set.

Corollaries & converses
  • Orthogonal decomposition. \(V=W\oplus W^{\perp}\) whenever \(W\) is complete: every \(x\) splits uniquely as \(x=P_Wx+(x-P_Wx)\) with \(P_Wx\in W\), \(x-P_Wx\in W^\perp\).
  • Bessel's inequality / best approximation by an orthonormal set. If \(\{e_1,\dots,e_n\}\) is orthonormal and \(W=\operatorname{span}\{e_i\}\), the theorem gives \(P_Wx=\sum_i\langle x,e_i\rangle e_i\) and \(\|x\|^2\ge\sum_i|\langle x,e_i\rangle|^2\), the computational engine of Fourier coefficients and least squares.
  • \(P_W\) is self-adjoint and \(\|P_W\|\le1\) (an orthogonal projection operator). Follows from linearity (Step 12) plus \(\langle P_Wx,y\rangle=\langle P_Wx,P_Wy\rangle=\langle x,P_Wy\rangle\) using the orthogonality relation twice.
  • Converse (of the characterisation, not the whole theorem) holds exactly: Step 11 shows any \(q\in W\) with \(x-q\perp W\) is automatically the minimiser — the orthogonality condition is an iff, not just a necessary condition.
  • Converse of existence does NOT hold: completeness of \(W\) is sufficient but not necessary for a given single \(x\) to have a closest point in \(W\); it is necessary for every \(x\in V\) to have one. A specific \(x\) may happen to attain its distance to a non-complete \(W\) without \(W\) being complete.
Fails without
  • Drop completeness of \(W\): \(V=\ell^2\), \(W=\{x\in\ell^2 : \text{finitely many nonzero terms}\}\) (finitely supported sequences), which is a subspace but not closed. Take \(x=(1,\tfrac12,\tfrac14,\dots)\in\ell^2\setminus W\); \(\inf_{w\in W}\|x-w\|=0\) (truncations of \(x\) approximate it arbitrarily well) but no \(w\in W\) achieves \(\|x-w\|=0\), so no minimiser exists at all.
  • Drop linearity of \(W\) (replace with a general closed convex set, keeping existence/uniqueness but breaking the orthogonality form): \(V=\mathbb{R}^2\), \(W=\{(a,b):a^2+b^2\le1\}\) the closed unit disc, \(x=(2,0)\). The unique closest point is \(p=(1,0)\), but \(x-p=(1,0)\) is not orthogonal to the whole set \(W\) (e.g. \(\langle x-p,(0,1)\rangle=0\) but \(\langle x-p,(-1,0)\rangle=-1\ne0\)) — only the weaker variational inequality \(\langle x-p,w-p\rangle\le0\ \forall w\in W\) survives.
  • Drop convexity entirely: \(V=\mathbb{R}^2\), \(W=\{(1,0),(-1,0)\}\) (not even a subspace, just two points), \(x=(0,0)\). Both points are equally close, so uniqueness fails outright — illustrating why linear (or at least strictly convex) structure is essential to the clean statement.
Common errors
  • Asserting the theorem for an arbitrary subspace \(W\) of an infinite-dimensional \(V\) without checking closedness — students often forget that "subspace" alone is not enough once \(\dim V=\infty\).
  • Confusing "\(x-p\perp W\)" with "\(x-p\perp p\)" — only the second is implied (\(p\in W\)); the orthogonality is to the entire subspace, a strictly stronger statement, which is what makes \(p\) unique.
  • Trying to verify \(x-p\perp W\) by checking a single vector \(w\in W\) rather than all \(w\in W\) (or, in the finite-dimensional case, all vectors of a spanning/basis set — which is legitimate by linearity of the inner product, but checking one arbitrary vector is not).
  • Using the real-variable derivative trick (Step 7) unmodified in a complex inner product space and getting the wrong sign or missing the conjugate, instead of the ray argument of Step 8.
  • Believing \(P_W\) is an orthogonal projection merely because it is idempotent (\(P^2=P\)); idempotence alone only gives a (possibly oblique) linear projection. Self-adjointness (\(P=P^*\)) is the extra ingredient that makes it orthogonal, and this is a consequence of the theorem, not a separate assumption to check by hand each time.
Discussion

The proof's real engine is the parallelogram law in Step 2–3, which is exactly the property that fails in general normed spaces and is the reason "closest point" theorems in Banach space theory need extra hypotheses (uniform convexity) to recover uniqueness. Inner product spaces get it for free because the norm comes from a bilinear/sesquilinear form, and it is this same parallelogram identity that later characterises inner product norms among all norms (the Jordan–von Neumann theorem).

Historically the idea traces to Fourier's use of orthogonality to compute series coefficients and to Hilbert and Schmidt's early twentieth-century formalisation of \(L^2\) spaces, where the projection theorem becomes the abstract statement underlying "the best approximation of a function by a trigonometric polynomial is given by its Fourier coefficients."

The theorem is the base case of a much larger structural fact: every closed subspace of a Hilbert space has a topological complement (its orthogonal complement), which is false for general closed subspaces of general Banach spaces. This is part of why Hilbert spaces are so much more tractable than Banach spaces — orthogonal projections give canonical, norm-decreasing splittings, whereas Banach-space projections (when they exist) need not be norm non-increasing or canonical.

A subtlety often missed: the theorem does not require \(V\) itself to be complete, only \(W\). One can work inside an incomplete inner product space (e.g. the space of continuous functions with the \(L^2\) inner product, not complete) and still project onto any finite-dimensional subspace, because finite-dimensional subspaces of any normed space are automatically complete (a consequence of the equivalence of norms in finite dimensions). This is precisely why Gram–Schmidt and least-squares regression need no completeness hypothesis on the ambient space at all.

Worked examples
1
Let \(V=\mathbb{R}^3\) with the standard inner product, \(W=\operatorname{span}\{u_1,u_2\}\) with \(u_1=(1,0,0)\), \(u_2=(0,1,1)\)/\(\sqrt2\) (already orthonormal), and \(x=(2,3,1)\). Find \(P_Wx\) and the distance from \(x\) to \(W\).
Setup: \(W\) is 2-dimensional, hence automatically complete, so the theorem applies and \(P_Wx\) exists uniquely.A
2
By the Corollary (orthonormal-set formula), \(P_Wx=\langle x,u_1\rangle u_1+\langle x,u_2\rangle u_2\). Compute \(\langle x,u_1\rangle=2\), \(\langle x,u_2\rangle=\dfrac{3+1}{\sqrt2}=\dfrac{4}{\sqrt2}=2\sqrt2\).
Direct application of the Bessel/projection formula derived in Corollaries, valid because \(\{u_1,u_2\}\) is orthonormal.A
3
\[ P_Wx = 2(1,0,0)+2\sqrt2\cdot\tfrac{1}{\sqrt2}(0,1,1) = (2,0,0)+(0,2,2) = (2,2,2). \]
Substitution and scalar multiplication of vectors.A
4
Check orthogonality: \(x-P_Wx=(0,1,-1)\); \(\langle(0,1,-1),u_1\rangle=0\), \(\langle(0,1,-1),u_2\rangle=\tfrac{1-1}{\sqrt2}=0\). Both vanish, confirming \(x-P_Wx\perp W\) as required by the theorem.
Verification against the orthogonality characterisation proved in Step 9 of the proof.A
\(P_Wx=(2,2,2)\), \(\operatorname{dist}(x,W)=\|x-P_Wx\|=\sqrt{0^2+1^2+(-1)^2}=\sqrt2\)
1
Least squares: find the line \(y=c\) (i.e. constant function) in \(C[0,1]\) with the \(L^2\) inner product \(\langle f,g\rangle=\int_0^1 f(t)g(t)\,dt\) closest to \(x(t)=t^2\). Here \(W=\{\text{constants}\}=\operatorname{span}\{1\}\), one-dimensional, hence complete.
\(W\) is finite-dimensional (dimension 1), so the theorem's completeness hypothesis is automatically satisfied.A
2
Normalise the spanning vector: \(\|1\|^2=\int_0^1 1\,dt=1\), so \(e=1\) is already a unit vector; by the projection formula \(P_Wx=\langle x,e\rangle e\).
Corollary formula for projection onto a one-dimensional (orthonormal) subspace.A
3
\[ \langle x,e\rangle=\int_0^1 t^2\cdot1\,dt=\tfrac13, \quad\text{so } P_Wx=\tfrac13. \]
Direct computation of the defining integral.A
4
Verify orthogonality: \(\langle x-\tfrac13,\,1\rangle=\int_0^1\big(t^2-\tfrac13\big)dt=\tfrac13-\tfrac13=0\). Confirms \(P_Wx=\tfrac13\) is exactly the theorem's minimiser, not merely a plausible guess.
Direct check of the orthogonality characterisation (Steps 9–11 of the proof).A
The constant function \(c=\tfrac13\) is the \(L^2\)-best constant approximation to \(t^2\) on \([0,1]\) — the mean value, exactly as the theorem predicts.
Problems
  1. In \(\mathbb{R}^3\) with the standard inner product, let \(W=\{(a,b,c):a+b+c=0\}\) and \(x=(1,1,1)\). Find \(P_Wx\) and \(\operatorname{dist}(x,W)\).
    Solution\(W\) is a plane through the origin (2-dimensional, hence complete), with normal vector \(n=(1,1,1)\). The projection onto \(W\) is \(x\) minus its projection onto \(\operatorname{span}\{n\}\): \(P_{\operatorname{span}\{n\}}x=\dfrac{\langle x,n\rangle}{\|n\|^2}n=\dfrac{3}{3}(1,1,1)=(1,1,1)=x\). So \(P_Wx=x-(1,1,1)=(0,0,0)\), and \(\operatorname{dist}(x,W)=\|x-P_Wx\|=\|(1,1,1)\|=\sqrt3\). (Sanity check: \(x\) itself is a multiple of the normal, so it is "purely orthogonal" to the plane, and its projection onto the plane is indeed the origin.)
  2. Let \(V=\mathbb{R}^2\) with standard inner product, \(W=\operatorname{span}\{(1,2)\}\), \(x=(4,-2)\). Compute \(P_Wx\) and verify \(x-P_Wx\perp W\) explicitly.
    Solution\(u=(1,2)\), \(\|u\|^2=5\), \(\langle x,u\rangle=4-4=0\). So \(P_Wx=\dfrac{0}{5}(1,2)=(0,0)\). Check: \(x-P_Wx=(4,-2)\), and \(\langle(4,-2),(1,2)\rangle=4-4=0\). Confirmed orthogonal — in fact \(x\) was already orthogonal to \(W\), so its projection is \(0\), consistent with the theorem (the closest point in a subspace to a vector already orthogonal to it is the origin).
  3. Prove directly from the orthogonality characterisation (not by recomputing from scratch) that if \(x\in W\) already, then \(P_Wx=x\).
    SolutionIf \(x\in W\), take \(p=x\). Then \(x-p=0\), and \(\langle 0,w\rangle=0\) for all \(w\in W\) trivially (by linearity of the inner product, \(\langle 0,w\rangle=\langle 0\cdot v,w\rangle=0\cdot\langle v,w\rangle=0\) for any \(v\)). So \(p=x\) satisfies the orthogonality characterisation of the theorem, and by the uniqueness proved in Step 10, \(x\) itself must be the unique minimiser: \(P_Wx=x\). This also reconfirms idempotence, \(P_W^2=P_W\), since \(P_Wx\in W\) always.
  4. Let \(V=\ell^2\) (square-summable real sequences) and let \(W_0\) be the subspace of sequences with only finitely many nonzero terms (not closed, as in "Fails without"). Explain precisely which step of the proof breaks down for \(x=(1,\tfrac12,\tfrac14,\tfrac18,\dots)\) and \(W=W_0\), and what goes wrong numerically.
    SolutionThe minimising sequence construction (Step 1) still works: take \(w_n=(1,\tfrac12,\dots,\tfrac1{2^{n-1}},0,0,\dots)\in W_0\), and \(\|x-w_n\|^2=\sum_{k\ge n}4^{-k}\to0\), so \(d=\inf_{w\in W_0}\|x-w\|=0\) and \((w_n)\) is indeed Cauchy (Steps 2–3 go through unchanged, since they only use the parallelogram law and the value of \(d\)). The failure is exactly at Step 4: completeness of \(W_0\) is invoked to conclude the Cauchy sequence \((w_n)\) converges to a limit \(p\in W_0\). But \((w_n)\) converges in \(\ell^2\) to \(x\) itself, which has infinitely many nonzero terms, so the limit is not in \(W_0\). No \(p\in W_0\) exists with \(\|x-p\|=0\), since that would force \(p=x\notin W_0\). Existence fails purely because \(W_0\) is not closed/complete — every other step of the proof is unaffected.
  5. Let \(P\) be a linear operator on an inner product space \(V\) with \(P^2=P\) and \(\operatorname{range}(P)=W\) finite-dimensional. Show that \(P=P_W\) (the orthogonal projection of the theorem) if and only if \(P\) is self-adjoint, i.e. \(\langle Pv,u\rangle=\langle v,Pu\rangle\) for all \(u,v\in V\).
    Solution(\(\Rightarrow\)) If \(P=P_W\), then for any \(u,v\): write \(v=Pv+(v-Pv)\) with \(v-Pv\perp W\) (orthogonality characterisation) and similarly for \(u\). Then \(\langle Pv,u\rangle=\langle Pv,Pu+(u-Pu)\rangle=\langle Pv,Pu\rangle+\langle Pv,u-Pu\rangle=\langle Pv,Pu\rangle+0\) since \(Pv\in W\) and \(u-Pu\perp W\). By symmetry \(\langle v,Pu\rangle=\langle Pv,Pu\rangle\) too (swap roles), so \(\langle Pv,u\rangle=\langle v,Pu\rangle\): \(P\) is self-adjoint. (\(\Leftarrow\)) Suppose \(P^2=P\), \(\operatorname{range}(P)=W\), and \(P\) is self-adjoint. For any \(v\in V\) and \(w\in W\), write \(w=Pw'\) for some \(w'\); then \(\langle v-Pv,w\rangle=\langle v-Pv,Pw'\rangle=\langle P(v-Pv),w'\rangle\) (self-adjointness) \(=\langle Pv-P^2v,w'\rangle=\langle Pv-Pv,w'\rangle=0\), using \(P^2=P\). So \(v-Pv\perp W\) for every \(v\), and since \(Pv\in W=\operatorname{range}(P)\), \(Pv\) satisfies exactly the orthogonality characterisation of \(P_Wv\); by the uniqueness in the theorem (Step 10), \(Pv=P_Wv\) for all \(v\), i.e. \(P=P_W\).