Norms

Measures of vector and matrix size — L1, L2, and Frobenius norms — and their role in regularization and distance.

Diagram · Unit Balls
x₁x₂(0,1)▲(1,0)▶ℓ₂-1-0.50.51

ℓ₁ unit ball: diamond — corners on axes. ℓ₂ unit ball: circle. ℓ∞ unit ball: square. The shape of the unit ball determines what "small" means under each norm.

Definition

A norm is a function that assigns a non-negative "length" or "size" to a vector. The most common is the Euclidean norm (2\ell_2 norm):

x2=x12+x22++xn2\|\mathbf{x}\|_2 = \sqrt{x_1^2 + x_2^2 + \cdots + x_n^2}

More generally, the p\ell_p norm for p1p \geq 1:

xp=(ixip)1/p\|\mathbf{x}\|_p = \left(\sum_i |x_i|^p\right)^{1/p}

Common cases:

  • p=1p=1: x1=ixi\|\mathbf{x}\|_1 = \sum_i |x_i| (Manhattan / taxicab norm)
  • p=2p=2: x2=ixi2\|\mathbf{x}\|_2 = \sqrt{\sum_i x_i^2} (Euclidean norm)
  • p=p=\infty: x=maxixi\|\mathbf{x}\|_\infty = \max_i |x_i| (Chebyshev norm)

A norm must satisfy: (1) x0\|\mathbf{x}\| \geq 0, with x=0x=0\|\mathbf{x}\|=0 \Leftrightarrow \mathbf{x}=\mathbf{0}; (2) cx=cx\|c\mathbf{x}\| = |c|\|\mathbf{x}\|; (3) triangle inequality x+yx+y\|\mathbf{x}+\mathbf{y}\| \leq \|\mathbf{x}\| + \|\mathbf{y}\|.

Key properties
  • Positive definiteness: x0\|\mathbf{x}\| \geq 0, and x=0\|\mathbf{x}\|=0 only for x=0\mathbf{x}=\mathbf{0}
  • Absolute homogeneity: cx=cx\|c\mathbf{x}\| = |c|\,\|\mathbf{x}\| for any scalar cc
  • Triangle inequality: x+yx+y\|\mathbf{x}+\mathbf{y}\| \leq \|\mathbf{x}\|+\|\mathbf{y}\| — never longer than the sum of the parts
  • All p\ell_p norms agree on a single nonzero coordinate vector, but differ in how they combine multiple nonzero entries
Common mistakes
  • Treating all norms as interchangeable: while finite-dimensional norms are equivalent (within constant factors of each other), they behave very differently for optimization — Lasso (1\ell_1) and Ridge (2\ell_2) regularization give qualitatively different solutions for exactly this reason
  • Forgetting p1p \geq 1 is required: for 0<p<10 < p < 1, the formula (xip)1/p\left(\sum|x_i|^p\right)^{1/p} violates the triangle inequality and isn't a true norm
Computing norms for x = (3, -4)
  • x1=3+4=7\|\mathbf{x}\|_1 = |3| + |-4| = 7
  • x2=9+16=5\|\mathbf{x}\|_2 = \sqrt{9+16} = 5
  • x=max(3,4)=4\|\mathbf{x}\|_\infty = \max(3,4) = 4

The 2\ell_2 norm gives the straight-line distance; the 1\ell_1 norm gives the distance if you can only walk along grid lines.

Try it

The unit ball under a norm is the set of vectors {x:x1}\{\mathbf{x}: \|\mathbf{x}\| \leq 1\}. Describe the shape of the unit ball for the 1\ell_1, 2\ell_2, and \ell_\infty norms in R2\mathbb{R}^2.

Solution
  • 1\ell_1 unit ball: x1+x21|x_1|+|x_2| \leq 1 — a diamond (rotated square) with vertices at (±1,0)(\pm1,0) and (0,±1)(0,\pm1).
  • 2\ell_2 unit ball: x12+x221x_1^2+x_2^2 \leq 1 — a disk (circle of radius 1).
  • \ell_\infty unit ball: max(x1,x2)1\max(|x_1|,|x_2|) \leq 1 — a square with vertices at (±1,±1)(\pm1,\pm1).

As pp increases from 1 to \infty, the unit ball interpolates from diamond → circle → square.

Related concepts