The dot product is an operation on two vectors and is a scalar value (not a vector). Given two vectors equation and equation, the dot product is calculated as follows:



Let us calculate the dot product of the three dimensional vectors equation and equation:



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, equation is a unit vector and the dot product is length of the red line which is the projection of equation on equation:



The dot product can also be used to calculate the angle between two vectors. For two vectors equation and equation, we can calculate the angle equation 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 equation as well as from the projection.