Consider connecting the two vectors into a right triangle similar the picture to the right
. To get the component of onto , we follow like in the picture and take,
where is the angle between the vectors and and is a unit vector in the direction of . We can rewrite in terms of the dot (scalar) product as,
Therefore, the projection of onto is
where we have recognized that
Computing the dot product we get,
and for the magnitude of ,
Therefore we get that the projection of onto is,