The Dot Product
The dot product of two vectors is the sum of their entry-wise products: . The result is a single real number — not a vector.
Using matrix notation, the dot product is simply a matrix product: . This is one pass of the "two-finger rule" — exactly as we compute any matrix-vector product, but the output is .
The dot product captures how much two vectors "agree in direction." When both vectors point the same way, the dot product is large and positive. When they point in opposite directions, it is large and negative. When they are perpendicular, it is exactly zero.
Formal View
Commutativity also gives linearity in the second argument: .
Interactive Visualization
Dot Product and Angle
Why This Matters
The dot product is the foundation of all geometric concepts in linear algebra — length, angle, and projection all derive from it.
- Recommendation systems compute dot products between user and item vectors to score how well a movie matches a viewer's preferences
- In physics, work done by a force along displacement is the dot product
- Cosine similarity — the backbone of search engines and NLP embeddings — is a normalized dot product
- Convolutional neural networks compute dot products between filter weights and input patches at every position
Quiz
Compute for and .
The dot product is commutative: for all vectors.
If , what can you conclude?
Common Mistakes
- Treating the dot product as a vector operation — is a scalar, not a vector.
- Confusing (a scalar) with (an outer product matrix).
- Assuming means and point in the same direction — they just point within 90° of each other.