Dot product and angle
Measure alignment and recover the angle between vectors.
Dot product and angle is one of 5 vectors formulas in the linear algebra section of this library, and it is used at high school · university level.
Why dot product and angle works
Apply the law of cosines to the triangle formed by u, v, and the vector between their tips. Expanding the squared lengths makes almost everything cancel, and the surviving piece is the sum of matched-up products. That is why a sum of coordinate products ends up carrying information about the angle between two arrows.
What each symbol means
$\theta$ is the angle between nonzero vectors.
Dot product and angle: when it holds
For the angle formula both vectors must be nonzero; dot product zero means orthogonal.
When it stops applying
Recovering the angle requires dividing by both magnitudes, so it collapses if either vector is zero, and the zero vector genuinely has no angle. In floating-point work the quotient can also land at 1.0000000002, which makes inverse cosine throw an error, so programs clamp it to the range −1 to 1 first.
Dot product and angle: a worked example
$(1,2)\cdot(3,4)=11$.
The mistake to avoid
What people do: Students expect a vector back and try to report the dot product as an ordered pair.
Why it goes wrong: The operation collapses two vectors into a single number, so there is nothing left to have components. (1, 2) dotted with (3, 4) is the number 11, not a point.
Do this instead: Multiply matching coordinates and add the results: 1(3) + 2(4) = 3 + 8 = 11. If you want a vector output in three dimensions, you are after the cross product instead.
Dot product and angle: step by step
- Name the unknown, and the unit the answer has to come out in.
- Match the symbols to your values. $\theta$ is the angle between nonzero vectors.
- Check the conditions before substituting. For the angle formula both vectors must be nonzero; dot product zero means orthogonal.
- Substitute, keep exact values to the last line, then test the sign, size, and unit against a rough estimate — the check that catches most linear algebra slips.
Where this formula fits
- Subject
- Linear Algebra formulas — 17 entries in this library
- Topic
- Vectors
- Level
- High school · University
Formulas are easiest to keep when they sit inside a method rather than on a list. Use the links below to see where dot product and angle comes from, to check a calculation against a tool, and to practise it until you can recall it without looking.
- The Dot Product — the lesson behind this formula: measure alignment and test orthogonality.
- Linear Algebra Calculator — check your substitution and the value it produces.
- Study linear algebra — the subject guide that explains the ideas these formulas compress.
- Linear Algebra Practice — questions that make you retrieve the formula instead of recognising it.
- All 17 linear algebra formulas — the full grouped reference, or the complete formula library.
Questions about dot product and angle
What does a negative dot product mean?
That the vectors point more away from each other than toward each other, with an angle greater than 90 degrees. The sign alone is often all you need, since it tells you which side of perpendicular you are on.
How do I test whether two vectors are perpendicular?
Dot them and check for zero, which is far faster than computing the angle. It works because cos 90 degrees is 0, so the product of the magnitudes gets multiplied away.
What angle do (1, 2) and (3, 4) actually make?
The dot product is 11 and the magnitudes are √5 and 5, so the cosine is 11/(5√5) = 0.9839 and the angle is about 10.3 degrees. They point in nearly the same direction.
Does the order of the two vectors matter?
No, u · v and v · u give the same number, because multiplying each pair of matching coordinates is symmetric. The cross product is the one that cares about order.