Finding the projection matrix onto a subspace $V$ of $\mathbb R^n$ given an orthonormal basis of $V$ Let $V\subset \mathbb R^n$ be spanned by an orthonormal basis $\{v_1,\dots, v_d\}$, with each vector represented by a column vector under the canonical basis of $\mathbb R^n$. How can I find a projection matrix $P:\mathbb R^n \to V$ in terms of $\{v_1,\dots, v_d\}$?
I have noticed many similar questions asked before, but they didn't seem address the special case here (there are no specific numbers. i.e. $n\ge d$ are general.).

You can show that $P(v) = \sum\limits_{k=1}^d \langle v_k,v\rangle v_k$ is a formula for $P$ by noting that it works on an orthonormal basis for $\mathbb R^n$ extending $\{v_1,\ldots,v_d\}$, and you can use this to find the matrix entries $\langle P(e_i),e_j\rangle = \sum\limits_{k=1}^d\langle v_k,e_i\rangle\langle v_k,e_j\rangle$.
