Dot Product as Projection

Category: Linear Algebra   Level: 301

u · v = ux vx + uy vy = |u| |v| cos θ

The dot product multiplies the length of the shadow that u casts on v by the length of v. Perpendicular vectors cast no shadow, so their dot product is zero.

Step through it

Watch it

Animated walkthrough

Step by step

Step 1: Draw two vectors and the angle between them

The vectors u and v share a tail at the origin. The angle θ between them controls how much u points along v.

u = (2, 4), v = (4, 3), θ ≈ 26.6°

Step 1: Draw two vectors and the angle between them

Step 2: Drop a perpendicular onto v

Shine light straight down onto the line through v. The dashed line from the tip of u meets that line at a right angle.

shadow foot = (3.2, 2.4)

Step 2: Drop a perpendicular onto v

Step 3: Measure the shadow

The shadow of u on v runs from the origin to the foot of the perpendicular. Its length is |u| cos θ.

|u| cos θ = √(20) · cos(26.6°) = 4

Step 3: Measure the shadow

Step 4: Multiply shadow by length

Scale the shadow by the length of v. The product equals the sum of the products of matching components.

u · v = 4 × 5 = 2·4 + 4·3 = 20

Step 4: Multiply shadow by length

Step 5: Perpendicular vectors give zero

The vector w meets v at a right angle, so it casts no shadow on v. Its dot product with v is zero.

w · v = (-3)·4 + 4·3 = 0

Step 5: Perpendicular vectors give zero

All steps at once

Storyboard

Generate it yourself

cd svg-generator
python3 -m svgmath render dot-product-projection --out /tmp/dot-product-projection

Source: svgmath/diagrams/vectors.py