How to project a vector onto an orthonormal basis
An orthonormal basis makes projection easier because the basis vectors are perpendicular and each has length 1. A dot product gives the component along each basis vector directly. We can add those components to get the projection onto their span.
Use one dot product for each basis direction
For an orthonormal basis with more vectors, continue the sum. If the basis vectors are the columns of , the same formula is .
Find the two coefficients
Use and . Their lengths are 1 and their dot product is zero. For ,
Combine the two components
Multiply each coefficient by its basis vector and add component by component. The projection has components
The projection lies in the plane spanned by the two basis vectors. The part left over is perpendicular to both of them.