The vector projection of the vector v onto a non-zero vector d is the component of v that is parallel to d. In mathematical terms,

\mathrm{proj}_\vec{d} \vec{v} = \frac{ \vec{v} \cdot \vec{d}}{\| \vec{d} \|^2 } \vec{d} = \frac{ \vec{v} \cdot \vec{d}}{\| \vec{d} \| } \hat{d}

where \hat{d} is the unit vector in the direction of d. The projection can also be used to find component of v normal (or orthogonal) to d as follows:

 \vec{v}_n = \vec{v} - \mathrm{proj}_\vec{d} \vec{v}