Search the complete library

What do you want to learn or calculate?

Quick linksAll calculatorsMath subjectsPractice questionsFormula library
← Linear Algebra formulas

Dot product and angle

Measure alignment and recover the angle between vectors.

Linear Algebra · Vectors
$$\mathbf u\cdot\mathbf v=\sum u_iv_i=\|\mathbf u\|\|\mathbf v\|\cos\theta$$

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

  1. Name the unknown, and the unit the answer has to come out in.
  2. Match the symbols to your values. $\theta$ is the angle between nonzero vectors.
  3. Check the conditions before substituting. For the angle formula both vectors must be nonzero; dot product zero means orthogonal.
  4. 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.

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.

Stuck on a problem?

Work a dot product and angle problem step by step

Type your own problem, or upload a photo of it. You get the method, the answer, and a check you can repeat yourself.