Orthogonality means $\langle u,v\rangle=0$. For $u\ne0$, the projection of $v$ onto its line is $u\langle u,v\rangle/\|u\|^2$ under the convention conjugating the first slot. For an orthonormal basis matrix $Q$ of a subspace $W$, $P_Wv=QQ^*v$.

The residual $v-P_Wv$ lies in $W^\perp$, giving the unique closest point in $W$. This leads directly to [least squares](https://knowen.md/nodes/23945), [Gram–Schmidt](https://knowen.md/nodes/23935), and [QR](https://knowen.md/nodes/23631).