The orthogonal projection of onto the line spanned by a nonzero vector is given by the formula . This formula scales the vector by the ratio of the dot product of and to the dot product of with itself.
Conditions: The vector must be nonzero.; The projection is onto the line spanned by .