The dot product is an operation on two vectors and is a scalar value (not a vector). Given two vectors and , the dot product is calculated as follows:
Let us calculate the dot product of the three dimensional vectors and :
If one of the vectors has unit length (length of one), then the dot product is the length of the other vector projected onto the unit vector. In the following graphic, is a unit vector and the dot product is length of the red line which is the projection of on :
The dot product can also be used to calculate the angle between two vectors. For two vectors and , we can calculate the angle between them as follows:
The denominator of the fraction is only necessary if the vectors are not unit length vectors. If the vectors are perpendicular to each other, the dot product is zero. We can see this both from this equation as as well as from the projection.