Multiplying Vectors
The dot product takes two vectors and returns a single number (a scalar). For and :
Multiply matching components and add.
Its geometric meaning is , where is the angle between them. It measures how aligned two vectors are:
| Alignment | Dot Product | Angle |
|---|---|---|
| Same direction | Positive | |
| Perpendicular | Zero | |
| Opposite | Negative |
Orthogonality and Angles
Two nonzero vectors are orthogonal (perpendicular) exactly when . No angle computation is needed.
The dot product recovers length via . You can find the angle between vectors using:
In machine learning, cosine similarity uses this exact formula to measure how similar two feature vectors are for search.
Pitfall: The dot product returns a number, never a vector. Orthogonal always means a dot product of zero.