On unit vectors, the dot product equals the cosine similarity, with -1 meaning opposite directions and +1 meaning the same direction.
Picture two arrows of equal length pointing on a clock face. If they both point at 12 they are pointing the same way and their dot product is the maximum, 1. If one points at 12 and the other at 6 they are exactly opposite and their dot product is -1. Halfway in between, at 3 o'clock, the answer is 0. The number tells you 'how much do they agree' on a tidy scale from minus one to plus one.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Unit vectors are the special case where the dot product is the cosine of the angle between them. The relationship is exact and the bound is geometric: the angle between two real vectors lies in [0, π], so its cosine lies in [-1, 1]. Production stacks lean on this fact constantly, but the empirical distribution of cosine values in trained embedding spaces looks very different from what the algebraic bound might suggest.
This short deep dive states the identity, walks through the geometric origin of the bound, and ends with how to interpret cosine scores in real retrieval indexes.
The identity and its bound
The identity
For vectors u and v with ||u|| = ||v|| = 1:
The dot product is the cosine of the angle θ between the two vectors.
Where the bound comes from
The angle θ between two real vectors is by convention in [0, π]. The cosine function over [0, π] has range [-1, 1]. So the dot product on unit vectors lies in [-1, 1] by pure geometry.
What each endpoint means
- +1: vectors point the same direction, θ = 0.
- 0: vectors are perpendicular, θ = π/2.
- -1: vectors point exactly opposite directions, θ = π.
Score ranges on non-unit vectors
If vectors are not unit norm, the dot product can be any real number. The cosine on those same vectors is still in [-1, 1] but is no longer equal to the dot product. The bound is a property of cosine, not of dot product.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
Real products, models, and research that use this idea.
- OpenAI text-embedding-3 returns vectors whose pairwise cosines rarely fall below 0 in real corpora.
- Pinecone Hybrid Search documentation notes that cosine scores below 0.4 typically mean 'unrelated' in trained encoder spaces.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy are truly negative cosines so rare in trained embedding spaces?
Contrastive training pulls positives together and pushes negatives apart but does not enforce anti-direction. Most embedders end up using only a hemisphere of the unit sphere; the other hemisphere is undertrained.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Stating the cosine range as [0, 1] instead of [-1, 1]; cosine includes negative values when vectors point in opposing directions.
60 second bullets to scan on the way to the call.
Why cosine equals dot product on unit vectors
Geometric origin of the [-1, 1] bound
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.