This is an example of an ``existence and uniqueness’’ theorem, so there are two things to prove. If we have an orthogonal basis \(\{\mathbf{f}_{1}, \mathbf{f}_{2}, \dots, \mathbf{f}_{m}\}\) for \(W\text{,}\) then it is easy to show that our orthogonal decomposition exists for \(\mathbf{x}\text{.}\) We let \(\mathbf{w}=\mbox{proj}_W(\mathbf{x})\text{,}\) which is clearly in \(W\) and \(\mathbf{w}^\perp = \mathbf{x} - \mathbf{w}\text{.}\) We have
\begin{equation*}
\mathbf{w} + \mathbf{w}^\perp = \mathbf{w} + (\mathbf{x} - \mathbf{w}) = \mathbf{x},
\end{equation*}
so we need to see that \(\mathbf{w}^\perp \in W^\perp\text{.}\)
By T
Theorem 10.3.2~
Item 3, it suffices to show that
\(\mathbf{w}^\perp\) is orthogonal to each of the basis vectors
\(\mathbf{f}_i, i=1,\ldots,m\text{.}\) We compute for
\(i=1,\ldots,m\)
\begin{align*}
\mathbf{f}_i \cdot \mathbf{w}^\perp
\amp = \mathbf{f}_i \cdot (\mathbf{x} - \mathbf{w}) \\
\amp = \mathbf{f}_i \cdot \mathbf{x} - \mathbf{f}_i \cdot \left(\frac{\mathbf{x} \cdot \mathbf{f}_{1}}{\norm{\mathbf{f}_{1}}^2}\mathbf{f}_{1} + \frac{\mathbf{x} \cdot \mathbf{f}_{2}}{\norm{\mathbf{f}_{2}}^2}\mathbf{f}_{2}+ \dots +\frac{\mathbf{x} \cdot \mathbf{f}_{m}}{\norm{\mathbf{f}_{m}}^2}\mathbf{f}_{m}\right) \\
\amp = \mathbf{f}_i \cdot \mathbf{x} - \left(\frac{\mathbf{x} \cdot \mathbf{f}_{1}}{\norm{\mathbf{f}_{1}}^2}\mathbf{f}_i \cdot\mathbf{f}_{i} \right) = \mathbf{f}_i \cdot \mathbf{x} - (\mathbf{x} \cdot \mathbf{f}_i) = 0.
\end{align*}
This proves that \(\mathbf{w}^\perp \in W^\perp\text{.}\)
The reason we need to prove this decomposition is unique is because we started with the orthogonal basis \(\{\mathbf{f}_{1}, \mathbf{f}_{2}, \dots, \mathbf{f}_{m}\}\) for \(W\text{,}\) but what would happen if we chose a different orthogonal basis? Suppose that \(\{\mathbf{f}_1^\prime, \mathbf{f}_2^\prime, \dots, \mathbf{f}_m^\prime \}\) is another orthogonal basis of \(W\text{,}\) and let
\begin{equation*}
\mathbf{w}^{\prime} = \left(\frac{\mathbf{x} \cdot \mathbf{f}^{\prime}_{1}}{\norm{\mathbf{f}^{\prime}_{1}}^2}\right)\mathbf{f}^{\prime}_{1} + \left(\frac{\mathbf{x} \cdot \mathbf{f}^{\prime}_{2}}{\norm{\mathbf{f}^{\prime}_{2}}^2}\right)\mathbf{f}^{\prime}_{2} + \dots +\left(\frac{\mathbf{x} \cdot \mathbf{f}^{\prime}_{m}}{\norm{\mathbf{f}^{\prime}_{m}}^2}\right)\mathbf{f}^{\prime}_{m}.
\end{equation*}
As before, \(\mathbf{w}^{\prime} \in W\) and \(\mathbf{x} - \mathbf{w}^{\prime} \in W^\perp\text{,}\) and we must show that \(\mathbf{w}^{\prime} = \mathbf{w}\text{.}\) To see this, write the vector \(\mathbf{w} - \mathbf{w}^\prime\) as follows:
\begin{equation*}
\mathbf{w} - \mathbf{w}^{\prime} = (\mathbf{x} - \mathbf{w}^{\prime}) - (\mathbf{x} - \mathbf{w}).
\end{equation*}
This vector is in \(W\) (because \(\mathbf{w}\) and \(\mathbf{w}^\prime\) are in \(W\)) and it is in \(W^\perp\) (because \(\mathbf{x} - \mathbf{w}^\prime\) and \(\mathbf{x} - \mathbf{w}\) are in \(W^\perp\)), and so it must be the zero vector (it is orthogonal to itself!). This means \(\mathbf{w}^\prime = \mathbf{w}\) as desired.