SHARE
Understanding the 2‑Norm Vector (L₂ Norm)
What Is the 2‑Norm?
The 2‑norm (or L₂ norm) is a standard way of measuring the length or magnitude of a vector in Euclidean space. For a real vector x in ℝⁿ, the 2‑norm is defined as:
‖x‖₂ = √(x₁² + x₂² + ⋯ + xₙ²)
This is a generalization of the Pythagorean theorem to n dimensions.
Key Properties of the 2‑Norm
A valid norm must satisfy the following properties:
Non-negativity: ‖x‖₂ ≥ 0, and equals 0 if and only if x is the zero vector.
Homogeneity: For any scalar α, ‖αx‖₂ = |α| · ‖x‖₂.
Triangle Inequality: ‖x + y‖₂ ≤ ‖x‖₂ + ‖y‖₂.
Geometric Intuition
In 2D, the 2‑norm gives the straight-line distance from the origin to a point (x₁, x₂). In higher dimensions, it represents the same concept extended into n-dimensional space.
All vectors with a 2‑norm equal to 1 form a unit circle in 2D or a hypersphere in higher dimensions.
Why the 2‑Norm Matters
The 2‑norm is used widely in:
Machine learning: Calculating distances between data points.
Regularization: L₂ regularization (Ridge Regression) penalizes large coefficients.
Optimization: Gradient-based algorithms often minimize L₂ distances.
Linear algebra: Relates directly to the dot product: ‖x‖₂ = √(x · x).
L₁ vs. L₂ vs. L∞ Norms
Norm | Formula | Shape (2D) | Behavior |
---|---|---|---|
L₁ | ∑ |xᵢ| | Diamond | Promotes sparsity |
L₂ | √∑ xᵢ² | Circle | Evenly distributes error |
L∞ | max |xᵢ| | Square | Dominated by largest component |
Example Calculation
Let x = [1, 2] and y = [9, 8]. The L₂ distance between x and y is:
‖x − y‖₂ = √((1−9)² + (2−8)²) = √(64 + 36) = 10
This represents the straight-line (Euclidean) distance between the two points.
Advanced Usage
For complex vectors, the L₂ norm is defined as: ‖x‖₂ = √(xᴴx), where xᴴ is the conjugate transpose of x.
The matrix 2‑norm (also called spectral norm) is equal to the largest singular value of the matrix.
Why It Matters for Developers
Understanding the 2‑norm helps in writing reliable, efficient code in areas like search, machine learning, and high-dimensional optimization. It’s also a building block for advanced concepts in linear algebra and numerical methods.
For example, ZeroEntropy.dev offers tools that integrate semantic search and vector comparisons, where accurate norm calculations ensure optimal results.
Learn More
RELATED ARTICLES
