Vectors & Spaces · Lesson 2 of 3 · ~6 min

The dot product

Predict

The number $\mathbf{u} \cdot \mathbf{v} = u_1 v_1 + u_2 v_2$ is computed from components alone. Suppose you drag $\mathbf{u}$ until it stands exactly perpendicular to $\mathbf{v}$. What does that readout do?

Hold that thought. Press set orthogonal in the instrument and watch the u · v readout at the instant θ hits 90°.
Try
Try itDrag either tip and watch u · v and |u||v| cos θ move in lockstep. Then press set orthogonal, set aligned, and set opposed in turn, watching θ, the sign of u · v, and the dotted proj segment.
Notice

The opening pair $\mathbf{u} = (3, 1)$, $\mathbf{v} = (1, 2.5)$ gives $3(1) + 1(2.5) = 5.50$ — and the readout $|u||v|\cos\theta$ shows $5.50$ as well, at $\theta = 49.8°$. Press set orthogonal: $\mathbf{v}$ jumps to $(-0.85, 2.55)$, the readout $u \cdot v$ shows $0.00$, $\theta$ reads $90.0°$, and the proj segment shrinks to a point. Press set opposed and $u \cdot v$ swings to $-8.50$. The component recipe tracked the angle the whole time.

Explain

That is the whole surprise. The dot product has two faces — a recipe on components, and a statement about geometry — and they are always the same number:

$$\mathbf{u} \cdot \mathbf{v} = u_1 v_1 + u_2 v_2 = \|\mathbf{u}\|\,\|\mathbf{v}\|\cos\theta$$

Why they agree: dotting a vector with itself gives $v_1^2 + v_2^2 = \|\mathbf{v}\|^2$, which is Pythagoras. Expand the tip-to-tip distance $\|\mathbf{u} - \mathbf{v}\|^2$ with dot-product algebra, expand it again with the law of cosines, cancel the matching terms, and the two faces collapse into one fact. Since $\cos\theta$ carries the sign, the dot product is an alignment meter: positive for acute angles, negative for obtuse, and exactly zero at $90°$ — the vectors are orthogonal. The dotted segment in the instrument is the projection, the shadow $\mathbf{u}$ casts on the line through $\mathbf{v}$: the part of $\mathbf{u}$ that acts along $\mathbf{v}$, marked with a right-angle tick at its foot.

Apply
Checkpoint — prove it to yourself

Two nonzero vectors satisfy $\mathbf{u} \cdot \mathbf{v} = 0$. What does that tell you?

With $\mathbf{u} = (3, 1)$ and $\mathbf{v} = (1, 2.5)$ the readout showed $5.50$. Now double $\mathbf{v}$ to $(2, 5)$. What does $\mathbf{u} \cdot \mathbf{v}$ become?

Transfer: $\mathbf{w} = (2, -4)$ and $\mathbf{z} = (3, 1)$. Without drawing anything, is the angle between them acute, right, or obtuse?

Key idea

The dot product converts a geometric question — how aligned are these two directions — into arithmetic. Positive means broadly the same way, zero means perpendicular, negative means opposed; the projection is the aligned part made visible.

APPLICATIONA neuron computes exactly this: synaptic weights dotted with inputs, then a threshold. Try it on a simulated cell.
← Lesson 1