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.
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°
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)
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
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
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
cd svg-generator python3 -m svgmath render dot-product-projection --out /tmp/dot-product-projection
Source: svgmath/diagrams/vectors.py