
📐 The dot product is more than a formula — it has beautiful geometry behind it
Why is the dot product of two unit vectors equal to cos(θ)? The answer lies in geometry, not arithmetic.
🔑 Three key concepts:
1. Unit vector — direction only, no magnitude:
$$\hat{v} = \frac{\vec{v}}{|\vec{v}|}$$2. Scalar projection — how much of a goes in the direction of b? Think of it as a shadow:
$$|\vec{a}|\cos\theta = \vec{a} \cdot \hat{b}$$3. General dot product:
$$\vec{a} \cdot \vec{b} = |\vec{a}||\vec{b}|\cos\theta$$🔄 The rotation trick: The most elegant proof: rotate the coordinate system until b̂ aligns with the x-axis. Then:
- b̂ = (1, 0)
- â = (cos θ, sin θ)
- â · b̂ = cos θ · 1 + sin θ · 0 = cos θ
The math simplifies itself. And it generalizes to any number of dimensions.
🌊 The path analogy: Vector projection answers “what is the closest point on direction B to point A?”
💡 Explanation in a nutshell#
The dot product measures how “aligned” two vectors are. If they point in the same direction, the result is large; if they’re perpendicular, it’s zero; if they’re opposite, it’s negative. This geometric intuition is fundamental for understanding cosine similarity in Machine Learning and vector search.
More information at the link 👇

