Definition
Dot Product
The dot product is an inner product be defined as follows:
Let be vectors of vector space . The inner dot product is defined as the scalar:
Angle Formula
Let be two non-zero vectors, and let be the angle between them, then:
Derivation
We derive formula by comparing two ways to compute .
First, for any vector , its squared length is the dot product of the vector with itself:
Set , then:
Expand the right-hand side. In coordinates:
Note that each expands to . Hence:
Given associativity and commutativity, group terms like:
which can be rewritten as:
Using the definitions of norm and dot product, this becomes
and
Substituting these back gives
For the usual dot product, , so the middle two terms combine:
Now use and . This gives
On the other hand, and form two sides of a triangle with included angle , so the law of cosines gives
These are two expressions for the same quantity, so
Cancel and from both sides, then divide by . We get
Rearranging gives
so the angle can be recovered from the dot product.
Similarity
The dot product can be viewed as a measurement of similarity of two vectors because it quantifies how much two vectors are aligned. A higher dot product indicates greater degree of alignment or similarity between the vectors.
If is the angle between non-zero vectors and , then
So:
- if , then and the dot product is large and positive
- if , then and the dot product is
- if , then and the dot product is negative
This is why the dot product detects whether two vectors point in similar, orthogonal, or opposite directions.
Projections
Projection onto a Unit Vector
Start with a unit vector . Then is the signed scalar projection of onto the direction of .
If is the angle between and , then
Since is a unit vector, , so
This is exactly the signed length of the part of that points along .
The corresponding vector projection is
For a general non-zero vector , first make it a unit vector:
Then
and the projection onto is
This is why coefficients in an orthonormal basis can be recovered with the dot product. If
and the basis vectors satisfy
then for a fixed ,
So the dot product with picks out exactly the -th coefficient.