The dot product
Nathan Kamgang
If you interrogate the formula for the dot product, it will gift to you all the explanations you need. You’ve seen mathematicians define the same dot product in different ways.
The Geometric Definition of the Dot Product
In the two-dimensional plane, start with two vectors at the origin. Think of our vectors as line segments that we draw starting at coordinate $(0,0)$ (your origin). The dot product of those two line segments (vectors) equals:
$$\vec{u} \cdot \vec{v} = |\vec{u}| \cdot |\vec{v}| \cdot \cos\theta$$where $\theta$ is the angle between the two vectors.
[Figure Placeholder: Diagram showing two vectors $\vec{u}$ and $\vec{v}$ emanating from the origin with angle $\theta$ between them]
Economists have the Human Development Index (a composite statistic that measures life expectancy, education, and income to rank countries into tiers of human development). Biologists have the Body Mass Index (a measure that uses height and weight to estimate body fat and assess health risks). Mathematicians have the dot product. All of these are quantitative measures chosen to describe an object.
The geometric dot product is just an index made up of the lengths of two line segments multiplied by the cosine of the angle between them.
If the dot product is an index, what does it quantify?
To understand this, we must observe how the components behave.
The length of a line segment is always positive. (If you don’t believe me, try to visualize a ruler of $-15$ cm.)
On the other hand, $\cos\theta$ can be negative.
Our line segments above can be viewed as two sides of a triangle. The cosine measures how the ratio of the adjacent side to the hypotenuse changes. More fundamentally, $\cos\theta$ captures the relationship between the angle and the geometry of our vectors.
Take a piece of paper and draw two line segments with a common origin. Now draw the same line segments with a bigger angle between them. If you want to join the endpoints to form a triangle, notice how changing the angle determines changes in the third side of the triangle.
[Figure Placeholder: Two diagrams side by side showing the same two vectors with different angles between them, illustrating how the angle affects the triangle formed]
The range of the cosine function is $[-1, 1]$, so the cosine can be negative.
Now consider the components of our dot product:
- $|\vec{u}|$ is always positive
- $|\vec{v}|$ is always positive
- $\cos\theta$ can be positive, negative, or zero
By the rules of multiplication, since the magnitudes are always positive, the cosine will solely determine the sign of the dot product:
- When $0° \leq \theta < 90°$: $\cos\theta > 0$, so $\vec{u} \cdot \vec{v} > 0$ (vectors point in generally the same direction)
- When $\theta = 90°$: $\cos\theta = 0$, so $\vec{u} \cdot \vec{v} = 0$ (vectors are perpendicular)
- When $90° < \theta \leq 180°$: $\cos\theta < 0$, so $\vec{u} \cdot \vec{v} < 0$ (vectors point in generally opposite directions)
The lengths of the vectors scale the dot product: the longer the lengths, the larger the absolute value of the dot product. But the cosine, determined entirely by the angle $\theta$, controls whether the result is positive, negative, or zero.
Summary Rule: The dot product measures both the degree of alignment (through $\cos\theta$) and the combined magnitudes (through $|\vec{u}| \cdot |\vec{v}|$) of two vectors.
Geometric Interpretation: Vector Projection
Let’s explore how the geometric dot product helps us find the component of one vector onto another using projection.
Assume we have two vectors $\vec{a}$ and $\vec{b}$ with an angle $\theta$ between them. What trigonometry do we need to find the component of $\vec{a}$ onto $\vec{b}$?
[Figure Placeholder: Diagram showing vector $\vec{a}$ and vector $\vec{b}$ with angle $\theta$ between them, and a perpendicular dropped from the tip of $\vec{a}$ to the line containing $\vec{b}$]
Simple trigonometry gives us that the scalar component of $\vec{a}$ onto $\vec{b}$ equals:
$$\text{comp}_{\vec{b}}\vec{a} = |\vec{a}| \cos\theta$$Notice how strikingly similar this expression looks to the dot product formula. Indeed, simple algebra establishes that:
$$\text{comp}_{\vec{b}}\vec{a} = |\vec{a}| \cos\theta = \frac{|\vec{a}| \cdot |\vec{b}| \cos\theta}{|\vec{b}|} = \frac{\vec{a} \cdot \vec{b}}{|\vec{b}|}$$So the dot product can be interpreted as a scaled projection of one vector onto another. The component of $\vec{a}$ onto $\vec{b}$ is simply the dot product divided by the length of $\vec{b}$.
Notice the symmetric nature of this interpretation: we could equally well write:
$$\text{comp}_{\vec{a}}\vec{b} = \frac{\vec{b} \cdot \vec{a}}{|\vec{a}|}$$This symmetry reflects the commutative property of the dot product: $\vec{a} \cdot \vec{b} = \vec{b} \cdot \vec{a}$. Both vectors project onto each other, and the dot product encodes information about both projections simultaneously.
The component is just the size of the portion of $\vec{a}$ that goes in the $\vec{b}$ direction. If we want the actual vector (not just its magnitude) that goes in that direction, we need the projection vector.
[Figure Placeholder: Diagram showing vector $\vec{a}$, vector $\vec{b}$, and the projection vector $\text{proj}_{\vec{b}}\vec{a}$ along $\vec{b}$]
To get the projection vector, we take the component and multiply it by the unit vector in the direction of $\vec{b}$:
$$\text{proj}_{\vec{b}}\vec{a} = \left(\frac{\vec{a} \cdot \vec{b}}{|\vec{b}|}\right) \cdot \frac{\vec{b}}{|\vec{b}|} = \frac{\vec{a} \cdot \vec{b}}{|\vec{b}|^2} \vec{b} = \frac{\vec{a} \cdot \vec{b}}{\vec{b} \cdot \vec{b}} \vec{b}$$This formula gives us the actual vector that lies along $\vec{b}$ and represents how much of $\vec{a}$ points in the direction of $\vec{b}$.
The Algebraic Dot Product
The algebraic definition of the dot product for vectors $\vec{u} = (u_1, u_2, \ldots, u_n)$ and $\vec{v} = (v_1, v_2, \ldots, v_n)$ in $n$ dimensions is:
$$\vec{u} \cdot \vec{v} = \sum_{i=1}^{n} u_i v_i = u_1 v_1 + u_2 v_2 + \cdots + u_n v_n$$This algebraic definition is equivalent to the geometric definition. The proof uses the law of cosines and shows that both formulas yield the same result. For a detailed proof of this equivalence, see: Gregory Gundersen’s explanation or the Wikipedia article on dot products.