Math

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.

5 minLevel 1/3The interactive stage stays ad-free.
||u||₁1.900||u||₂1.389||u||∞1.200SelectedL2 = 1.389

||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

1

The L1 norm is |x| + |y|. Its unit ball is a diamond because every point with total coordinate distance 1 lies on the boundary.

2

The L2 norm is sqrt(x² + y²), the usual Euclidean length. Its unit ball is a circle.

3

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.