Dot product, cosine, and distance

Drag two vectors and watch the dot product, cosine similarity, angle, and distance update, with the arithmetic shown.

IntermediateExplained in Vectors and similarity

Dot product, cosine, and distance

Drag the tips of a and b. Three ways to compare two vectors update as you move them.

Dot product a · b6.50
Cosine similarity0.82
Angle35°
Distance ‖a − b‖1.80

Try this

  • Make the angle 90 degrees. What happens to the dot product and the cosine?
  • Choose Same direction, then drag b farther out. Which measures change?
  • Turn on Scale both to length 1 and check that a smaller distance always means a larger cosine.

Try "embedding", "softmax", "overfitting", or "backpropagation".