The componentwise definition
Given and , the dot product is:
Multiply corresponding components, then sum. In :
The result is a scalar — a single real number. This operation eats two vectors and produces a number. Shockingly, beautifully useful.
The first thing to check: what happens when you dot a vector with itself?
The dot product of a vector with itself is the square of its length. So . In other words: length is a special case of the dot product. The whole length formula from the Vectors lesson was secretly a dot product wearing a disguise.
The geometric formula — two definitions, one number
Here's the jaw-dropping part. The same dot product has a geometric interpretation:
where is the angle between the vectors. Same number, two formulas. This is not a coincidence — it's a theorem.
Proof via the law of cosines. Consider the triangle formed by , , and (the arrow from the tip of to the tip of ). The law of cosines says:
Now expand the left side using the componentwise definition and :
Substituting and simplifying:
The terms cancel, leaving:
This is what it looks like when algebra and geometry agree completely. Two independent paths to the same formula — that is mathematics telling you something real, something deep, something that is not an accident. When two completely different derivations converge on the same answer, pay the hell attention.
Reading the sign of the dot product
From the geometric formula, the sign of is entirely determined by :
- : , so — the vectors point in a generally similar direction. Acute angle.
- : , so — the vectors are perpendicular (orthogonal). Huge.
- : , so — the vectors point in a generally opposite direction. Obtuse angle.
The zero case deserves its own banner: if and only if . Perpendicularity — a geometric notion about arrows meeting at right angles in space — has been reduced to checking whether a sum of products equals zero. This is one of the greatest trades in mathematics. You have converted geometry into algebra, and that conversion is your ticket to working in any number of dimensions. Your visual cortex can only handle three; the dot product handles all of them. That matters enormously and we will use it relentlessly.
Projection: how much of lies along ?
Given vectors and , the projection of onto is the shadow that casts onto the line through (with a light source shining perpendicularly to ).
The scalar projection (just the signed length of the shadow) is:
From the geometric formula: , so this equals — exactly the adjacent-side-over-hypotenuse geometry of a right triangle.
The vector projection (the actual shadow vector, pointing along ) is:
The scalar tells you how many copies of fit in the shadow; multiplying by converts that count back into a vector.
Drag the vectors below and watch the projection shadow respond in real time:
The formula might look intimidating, but it's just: dot-product divided by squared-length, times the direction. Memorize the shape of the formula, not the symbols — if you forget it you can re-derive it in ninety seconds from the geometry. That's how you actually own a formula.