Norms & Unit Balls
A norm assigns a length to every vector. L1, L2, and L∞ produce a diamond, a circle, and a square as their unit balls.
||u||₂ = sqrt(1.20² + 0.70²) = 1.389
L2 is the ordinary Euclidean length.
All three unit balls have norm 1, but their shapes differ. On the axes the three norms agree; off the axes they measure distance differently. The selected norm is highlighted and the vector stays fixed as you switch norms.
What you are seeing
The L1 norm is |x| + |y|. Its unit ball is a diamond because every point with total coordinate distance 1 lies on the boundary.
The L2 norm is sqrt(x² + y²), the usual Euclidean length. Its unit ball is a circle.
The L∞ norm is max(|x|, |y|). Its unit ball is a square. All three norms agree on the coordinate axes.
Why it matters
Norms define distance and error. L1 encourages sparsity, L2 is the standard Euclidean distance, and L∞ controls the worst coordinate error.
Complexity & details
In 2D, each norm takes O(1) time per vector.
Frequently asked questions
Why are the unit balls different shapes?+
A unit ball is the set of vectors with norm 1. Different formulas produce different boundaries: a diamond, a circle, or a square.
Which norm should I use?+
Use L2 for ordinary distance, L1 when sparsity or robust absolute error matters, and L∞ when the largest coordinate error is the priority.