JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

The Dot Product: Length and Angle

One little formula hides both the length of a vector and the angle between two of them. Learn the dot product, read its sign as alignment, and recover length and angle from it.

The formula and what it feels like

So far vectors have been arrows you can add and scale. The dot product is the first tool that compares two arrows and returns a single number telling you how much they point the same way. The recipe is simple: multiply matching coordinates, then add everything up.

u = (3,4)   v = (1,2)
u dot v = 3*1 + 4*2 = 3 + 8 = 11
Multiply matching coordinates, then add them.

The dot product is the everyday case of a more general idea, the inner product, which is just any sensible way of multiplying two vectors into a number. For ordinary arrows in the plane or in space, 'inner product' and 'dot product' mean the same thing.

Reading the sign

The single most useful habit is to read the sign of a dot product before its size. A positive result means the two vectors lean the same way; a negative result means they point apart; and a result of exactly zero means they are at a right angle.

(1,0) dot (1,0) =  1   same direction  (+)
(1,0) dot (0,1) =  0   right angle     (0)
(1,0) dot (-1,0)= -1   opposite        (-)
Sign first: positive aligns, zero is perpendicular, negative opposes.

Length and angle fall out

Dot a vector with itself and something nice happens: the cross terms vanish and you are left with the sum of squared coordinates. The square root of that is the vector's length, its norm. This is just the Pythagorean theorem wearing a new coat.

v = (3,4)
v dot v = 3*3 + 4*4 = 9 + 16 = 25
norm(v) = sqrt(25) = 5
A vector dotted with itself gives its length squared.

Length and sign combine into the full geometric law: u dot v = norm(u) * norm(v) * cos(theta), where theta is the angle between them. Rearrange it and you can recover the angle from coordinates alone — no protractor needed.

  1. Compute u dot v (multiply matching coordinates, add).
  2. Compute norm(u) and norm(v) using the self-dot trick.
  3. Then cos(theta) = (u dot v) / (norm(u) * norm(v)); take the inverse cosine for theta.