Vectors and matrices

∥x∥2\|\mathbf{x}\|_2 Norm

The length (size) of a vector. With subscript 2 or none, the Euclidean length √(Σxᵢ²).

In ML papers

∥x∥\|\mathbf{x}\| is the size of x\mathbf{x}. With no subscript, or subscript 2, it is usually the Euclidean (L2) norm, ∑ixi2\sqrt{\sum_i x_i^2}. The squared norm ∥x∥22=∑ixi2\|\mathbf{x}\|_2^2 = \sum_i x_i^2 drops the square root; it is the L2 penalty in weight decay and the squared error in ∥y−y^∥2\|\mathbf{y} - \hat{\mathbf{y}}\|^2. ∥a−b∥\|\mathbf{a} - \mathbf{b}\| is the distance between two points. Other subscripts pick other norms: L1 norm, Frobenius norm, and ∥⋅∥∞\|\cdot\|_\infty (Infinity).

How to type it

LaTeXShows
\|\mathbf{x}\|∥x∥\|\mathbf{x}\|
\lVert \mathbf{x} \rVert cleaner spacing∥x∥\lVert \mathbf{x} \rVert
\|\mathbf{x}\|_2^2 squared L2∥x∥22\|\mathbf{x}\|_2^2

A worked example

∥(3,4)∥2=9+16=5,∥(3,4)∥22=25\|(3, 4)\|_2 = \sqrt{9 + 16} = 5, \quad \|(3, 4)\|_2^2 = 25

Common confusions

Equations that use it

Related

∥A∥F\|A\|_FFrobenius norm∥x∥1\|\mathbf{x}\|_1L1 norm∣x∣|x|Absolute value (bars)λ∥w∥22\lambda \|\mathbf{w}\|_2^2Lambda

Decode this example →