2-Norm Vector

Jul 20, 2025 · GitHub Twitter Slack LinkedIn Discord
2-Norm Vector
TL;DR

The 2‑norm (L₂ norm) measures the length of a vector in Euclidean space and is foundational to machine learning, optimization, and vector similarity calculations. It generalizes the Pythagorean theorem to n dimensions and is a building block for search, regularization, and high-dimensional distance computation.

Understanding the 2‑Norm Vector (L₂ 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:

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

NormFormulaShape (2D)Behavior
L₁∑ |xᵢ|DiamondPromotes sparsity
L₂√∑ xᵢ²CircleEvenly distributes error
L∞max |xᵢ|SquareDominated by largest component

Example Calculation

Let x = [1, 2] and y = [9, 8]. The L₂ distance between x and y is:

This represents the straight-line (Euclidean) distance between the two points.

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

For example, ZeroEntropy.dev offers tools that integrate semantic search and vector comparisons, where accurate norm calculations ensure optimal results.

Learn More

Related Blogs

Catch all the latest releases and updates from ZeroEntropy.

ZeroEntropy
The best AI teams retrieve with ZeroEntropy
Follow us on
GitHubTwitterSlackLinkedInDiscord