Norms — L1, L2, Frobenius

Measuring the size of vectors and matrices

Why

Any time you need to measure how "big" a vector or matrix is — how far it is from zero, how different two vectors are — you need a norm. Different norms measure differently, and choosing the right one changes what gets penalized and what doesn't.

Intuition

A norm is a way to measure the "size" of a vector or matrix — how far it is from zero. L2 is straight-line distance: square each component, sum, take the root. L1 is taxicab distance: just sum the absolute values. Frobenius is L2 applied to every element of a matrix — flatten it, then take L2.

Explanation
L1 Norm (Manhattan Norm)
‖v‖₁ = |v₁| + |v₂| + … + |vₙ| = Σ |vᵢ|

Sum of absolute values. Geometrically: the distance you'd travel on a grid — each step must be horizontal or vertical, no diagonals. All dimensions are treated equally regardless of magnitude.

L2 Norm (Euclidean Norm)
‖v‖₂ = √(v₁² + v₂² + … + vₙ²) = √(vᵀv)

Straight-line distance from the origin. Large components are penalized more heavily than small ones because of the squaring. Dividing a vector by its L2 norm gives a unit vector — direction preserved, magnitude set to 1.

Frobenius Norm
‖A‖_F = √( Σᵢ Σⱼ aᵢⱼ² ) = √( trace(AᵀA) ) = √( Σ σᵢ² )

The matrix equivalent of L2 — square every entry, sum them all, take the root. Equivalent to flattening the matrix into one long vector and computing its L2 norm. The third form connects to SVD: ‖A‖_F² equals the sum of squared singular values.

L1 vs L2 — The Key Difference

The two norms treat large vs small values differently:

  • L2: squaring amplifies large values — one big component dominates the total. The norm is smooth everywhere, so its gradient is proportional to the value itself.
  • L1: absolute values treat all magnitudes equally. The gradient is constant (just the sign) regardless of how large or small the value is — the pull toward zero never weakens.