A projection
Projection Onto Lines
For vector
and assuming the dot product, the projection matrix
General Projections
Generalizing to any subspace
projection
and projection matrix
Also, note that to project onto an affine space, we can translate before and after the projection,