Skip to content

What the dot product means, geometrically

5 min read

Short answer

Algebraically, a⋅b=a1b1+a2b2+⋯+anbn\mathbf a\cdot\mathbf b=a_1b_1+a_2b_2+\cdots+a_nb_n. Geometrically, a⋅b=∣a∣∣b∣cos⁡θ\mathbf a\cdot\mathbf b=|\mathbf a||\mathbf b|\cos\theta: it measures how much the two vectors point in the same direction. It is positive if they agree, zero if they are perpendicular, and negative if they oppose.

Projection of vector a onto vector b, the shadow of a on the line through ba = (1, 2)b = (3, 1)projection (1.5, 0.5)a · b = 5, θ = 45°
The projection of a onto b is the shadow of a on the line through b. Its length times |b| is the dot product.

Angle and perpendicularity

Rearranging the geometric formula gives cos⁡θ=a⋅b∣a∣∣b∣\cos\theta=\dfrac{\mathbf a\cdot\mathbf b}{|\mathbf a||\mathbf b|}, which finds the angle between any two vectors. In particular a⋅b=0\mathbf a\cdot\mathbf b=0 exactly when the vectors are perpendicular (orthogonal), which is the standard test.

Projection: the shadow

The component of a\mathbf a along b\mathbf b is the length of its shadow on the line through b\mathbf b. The projection vector is proj⁡ba=a⋅bb⋅b b.\operatorname{proj}_{\mathbf b}\mathbf a=\frac{\mathbf a\cdot\mathbf b}{\mathbf b\cdot\mathbf b}\,\mathbf b. This is how physics computes work (W=F⋅dW=\mathbf F\cdot\mathbf d, the force component along the motion times the distance).

Worked example

Find the angle between a=(1,2)\mathbf a=(1,2) and b=(3,1)\mathbf b=(3,1), and the projection of a\mathbf a onto b\mathbf b.

a⋅b=1⋅3+2⋅1=5\mathbf a\cdot\mathbf b=1\cdot3+2\cdot1=5, ∣a∣=5|\mathbf a|=\sqrt5, ∣b∣=10|\mathbf b|=\sqrt{10}. cos⁡θ=5510=12 ⇒ θ=45∘.\cos\theta=\frac{5}{\sqrt5\sqrt{10}}=\frac1{\sqrt2}\ \Rightarrow\ \theta=45^\circ. Projection: 510(3,1)=(1.5, 0.5)\dfrac{5}{10}(3,1)=(1.5,\ 0.5).

Try it yourself

Find the angle between u=(1,1,0)\mathbf u=(1,1,0) and v=(0,1,1)\mathbf v=(0,1,1).

Show the answer

u⋅v=1\mathbf u\cdot\mathbf v=1 and ∣u∣=∣v∣=2|\mathbf u|=|\mathbf v|=\sqrt2, so cos⁡θ=12\cos\theta=\tfrac12 and θ=60∘\theta=60^\circ.

Keep going with practice

Dot products, projections and orthogonality are in Vidi's Linear Algebra & Probability course, with an interactive vector playground.