Concept Lab · Week 4 · Prerequisites
Dot product → cosine similarity
Rotate two vectors and see projection, dot product and cosine update live.
The idea: Dot product and cosine similarity
Algebraically, the dot product multiplies matching coordinates and sums: . Geometrically, it equals : positive when the vectors point the same way, zero when perpendicular, negative when opposed.
Divide by both lengths and you get cosine similarity, which depends only on the angle. This is the standard measure of semantic similarity between embeddings, because direction encodes meaning and length often encodes things you don't care about (like text length).
If embeddings are already normalised to length 1, cosine similarity is the dot product, which is why many vector databases normalise once at insert time and then use the cheaper dot product.
Next simulation: Eigenvectors