The vector dot product takes in two vectors and returns a number telling us how much the vectors are pointing in the same direction:
If they are pointing in the exact same direction, the dot product is the product of their lengths
If they are perpendicular, the dot product is zero
If they are pointing in the exact opposite direction, the dot product is negative the product of their lengths
In general, the dot product of two vectors A and B is |A||B|cos(θ) where θ is the angle between them.
Additionally, the dot product of two vectors is very easy to calculate. We just take corresponding components of our vectors and multiply them together. Multiply the x coordinates together, multiply the y coordinates together (and if there are any, multiply the z coordinates together) and then add up the results. So, for instance, to calculate .
This makes the dot product a very valuable tool for:
Measuring the length of vectors: A ⋅ A = |A|2.
Measuring the angle between vectors: cos(θ) = (A ⋅ B)/(|A||B|).
Measuring how much one vector is pointing in the direction of another: the length of the projection of A onto B is A cos(θ) = (A ⋅ B)/|B|. This is most useful if B already has length 1, as in the interactive below if you select "Length of B (while dragging): Fix to 1".
Using the interactive
Enter numbers or drag the arrowheads around to change A and B and see how their dot product changes
A = (, )
B = (, )
A⋅B =
Length of B (while dragging):
Show points p where p⋅B = (dotted line)
Show many such lines
Show values of p⋅B for p on the unit circle
Show projection of A onto B.
Label vectors
Draw grid