Lesson 3 of 13 8 min · 136 words
Inner products
The dot product and what it says about angle and similarity.
The inner (dot) product of two vectors is . It equals , where is the angle between them — so it measures how much two vectors point the same way.
Positive dot product: angle under 90°, vectors broadly agree. Zero: perpendicular (orthogonal), unrelated directions. Negative: they point in opposing directions. Cosine similarity is the cosine above; it ignores length and is used to compare documents, word embeddings and user profiles.
Dot products are everywhere in ML: a neuron computes , a linear model predicts , and attention in transformers scores tokens by dot products of query and key vectors.
Formula to remember
Euclidean distance
Slides
Straight-line distance (L2).
Quick check · +5 XP