The dot product multiplies corresponding vector components and adds the products. It measures a combination of magnitude and alignment, so comparing dot products requires attention to the scale of the inputs.
Worked example
For vectors (1, 2) and (3, 4), the dot product is one times three plus two times four, which equals eleven. Doubling the second vector doubles the dot product even though its direction stays the same. When both vectors have unit length, their dot product equals the cosine of the angle between them.
What to check
If a task is intended to compare directions, normalize nonzero vectors or use cosine similarity explicitly. The zero vector cannot be normalized to unit length, so define how it should be handled. In an embedding system, the training objective and the retrieval implementation determine whether magnitude contains useful information. Establish that contract before substituting one similarity calculation for another.
Continue with the book
Explore the full treatment, worked examples, and exercises in Mathematics for AI and Machine Learning.
Companion article for Mathematics for AI and Machine Learning, published by Choral Software. Article text and original examples © 2026 Choral Software. All rights reserved.
