Theorem: ${x_1,x_2, ... ,x_k}$ be an orthonormal basis of $S$. Then for any $x \in V$, $y$ defined as $$y = \sum_{i=1}^k \langle x, x_i\rangle x_i$$ is the orthogonal projection of $x$ into S and $x - y$ is the orthogonal projection of $x$ into $S^\perp$.
Question: Deduce above theorem by the fact that $P_A = AA^T$ if the columns of $A$ form an orthonormal set where $P_A$ is the orthogonal projection matrix.
In fact, \begin{eqnarray} P_Ax&=&AA^Tx\\ &=&(x_1,\cdots,x_k)\left(\begin{matrix}x_1^T\\\cdots\\x_k^T\end{matrix}\right)x\\ &=&\sum_{i=1}^k(x_ix_i^T)x\\ &=&\sum_{i=1}^kx_i(x_i^Tx)\\ &=&\sum_{i=1}^k(x^Tx_i)x_i\\ &=&\sum_{i=1}^k\left<x,x_i\right>x_i. \end{eqnarray}