Let $\mathbf{u}_1, \ldots, \mathbf{u}_k$ be an orthonormal basis for the subspace $W \subset \mathbb{R}^m$. Let $A=\left(\mathbf{u}_1 \mathbf{u}_2 \ldots \mathbf{u}_k\right)$ be the $m \times k$ matrix whose columns are the orthonormal basis vectors, and define $P=A A^T$ to be the corresponding projection matrix. (a) Given $\mathbf{v} \in \mathbb{R}^n$, prove that its orthogonal projection $\mathbf{w} \in W$ is given by matrix multiplication: $\mathbf{w}=P \mathbf{v}$.
(b) Prove that $P=P^T$ is symmetric. (c) Prove that $P$ is idempotent: $P^2=P$. Give a geometrical explanation of this fact. (d) Prove that $\operatorname{rank} P=k$. (e) Write out the projection matrix corresponding to the subspaces spanned by
(i) $\left(\begin{array}{c}\frac{1}{\sqrt{2}} \\ \frac{1}{\sqrt{2}}\end{array}\right)$,
(ii)
$\left(\begin{array}{r}\frac{2}{3} \\ -\frac{2}{3} \\ \frac{1}{3}\end{array}\right)$
(iii)
$$
\left(\begin{array}{c}
\frac{1}{\sqrt{6}} \\
-\frac{2}{\sqrt{6}} \\
\frac{1}{\sqrt{6}}
\end{array}\right),\left(\begin{array}{c}
\frac{1}{\sqrt{3}} \\
\frac{1}{\sqrt{3}} \\
\frac{1}{\sqrt{3}}
\end{array}\right)
$$
(iv)
$$
\left(\begin{array}{r}
\frac{1}{2} \\
\frac{1}{2} \\
\frac{1}{2} \\
-\frac{1}{2}
\end{array}\right), \quad\left(\begin{array}{r}
\frac{1}{2} \\
-\frac{1}{2} \\
\frac{1}{2} \\
\frac{1}{2}
\end{array}\right), \quad\left(\begin{array}{r}
\frac{1}{2} \\
\frac{1}{2} \\
-\frac{1}{2} \\
\frac{1}{2}
\end{array}\right) .
$$