Why is the dot product connected to projection?
Rotate a vector and watch its shadow change. Discover what the dot product measures, and when it equals a projection.
Imagine a vector a pointing diagonally and a vector b pointing horizontally. Shine a light perpendicular to b: a casts a shadow onto the line along b. That shadow is its vector projection.
The dot product is closely related, but it gives a number, not a vector. Let’s see exactly what that number measures.
How much of the length falls along b?
Keep a at length 10 and rotate it. Its signed projection onto the direction of b is:
The cosine converts the vector’s total length into the amount pointing along the chosen direction. Try , then , then .
Blue: vector aGreen: projectionOrange: vector b
b points right and is drawn below the line for visibility. Both vectors use the same scale.
The projection is positive: part or all of a points in the direction of b. Since b is a unit vector, the dot product equals the signed projection.
At 0°, all 10 units point along b. At 60°, only 5 do. At 90°, the projection is zero even though a still has length 10. At 180°, it is −10: the vector points entirely in the opposite direction.
The projection falls on the line through b, so it can extend beyond the tip of b or point backward.
Where the dot product comes in
The dot product multiplies the signed projection length by the length of b:
When b is a unit vector (), the dot product equals the signed projection length. Change from 1 to 2 in the explorer. The shadow stays in place, but the dot product doubles.
For a concrete example, select . With :
Now set the length of b to 2, so :
The signed projection length is still 3, and the projection vector is still (3, 0). Only the dot product changed.
Three related quantities
For a nonzero reference vector b:
| Quantity | Formula | What you get |
|---|---|---|
| Dot product | Signed projection length multiplied by | |
| Scalar projection | Signed length along b | |
| Vector projection | A vector on the line through b |
If b is the zero vector, the dot product is zero, but projection onto its direction is undefined: it has no direction to project onto.
Coordinates are projections, too
The horizontal coordinate of is 3 because its dot product with the horizontal unit vector is 3. Its vertical coordinate is 4 because its dot product with is 4.
More generally, in an orthonormal basis (perpendicular unit vectors), each coordinate is a dot product:
Choosing a different orthonormal basis means measuring the same vector along different directions. This is the geometry behind the projection steps in PCA and SVD.
Why this matters for a neuron
A neuron’s weighted sum measures the signed projection of the input x onto the weight direction w, scaled by . A bias shifts that result, and an activation function transforms it.
For inputs of the same length, stronger alignment with w gives a larger weighted sum. That’s the geometric sense in which a neuron can detect a direction in its input space.
Takeaway: the angle controls how much of one vector falls along another direction. The dot product measures that amount, scaled by the reference vector’s length.
Keep learning
To see how a matrix uses dot products to produce each output coordinate, continue with Dot products: building the output one row at a time.