How Norms & Distances Work
The L2 (Euclidean) Norm
Straight-line distance from the origin
This vector is far from the origin. The L2 norm grows as the straight-line distance from the origin increases.
Step 1 of 6: The L2 (Euclidean) Norm
Straight-line distance from the origin
This vector is far from the origin. The L2 norm grows as the straight-line distance from the origin increases.
Step 2 of 6: The L1 (Manhattan) Norm
Distance measured along axes — the taxicab metric
The L1 norm (5.00) is significantly larger than L2 (3.61). The taxi must travel along grid lines while the crow flies straight. L1 ≥ L2 always holds.
Step 3 of 6: Unit Balls & Lp Norms
Watch the unit ball morph as p changes
At p = 2, the unit ball is a perfect circle — the familiar Euclidean norm. All directions are treated equally, making it rotationally invariant.
Step 4 of 6: Distance Between Vectors
L1, L2, and L∞ — three ways to measure closeness
Three ways to measure the same gap: L1 (6.00) walks the grid, L2 (4.47) flies straight, and L∞ (4.00) only tracks the dominant axis. L∞ ≤ L2 ≤ L1 always holds.
Step 5 of 6: Cosine Similarity
Comparing direction, not magnitude
The vectors are nearly perpendicular — cosine similarity ≈ 0. In embedding spaces, this means the items are unrelated or orthogonal concepts.
Step 6 of 6: Norms in ML
How L1 and L2 regularization constrain weights
At λ = 0.50, the constraints tighten. Notice how the L1 diamond has corners on the axes — optimal solutions tend to land at those corners, zeroing out weights. L2's circle has no such preference.