Chapter 4 of 8
Metrics on unit vectors
Once both operands have unit L2 norm, the dot product equals cosine similarity and Euclidean distance produces an identical ordering, which settles several questions at once. This chapter derives the two identities, checks them in code against a stated floating-point tolerance, and then works out what actually decides the metric in a vector database when it cannot change a single result: cost per comparison, what the index supports, and what happens the next time the write path changes.
Vector arithmetic — read the current version at https://daviddominguez.dev/learn/en/vector-arithmetic/euclidean-distance