BRAGA

02 Writing02-02 Notes02-02-196

Norm definition constraint

Published 16 Apr 20266 min read
Contents
  1. 01Deep Breakdown
  2. 02Flowchart
  3. 03Real-world use
  4. 04The formula, piece by piece
  5. 05The formula in words
  6. 06Critical Concepts
  7. 07Step-by-step calculation (tiny example)
  8. 08Code examples
∥x∥≥0\|x\| \ge 0
(1)

and ∥x∥=0  ⟺  x=0\|x\| = 0 \iff x = 0

Deep Breakdown

What it tells me (Situation Awareness): This is the first of the three axioms that define a valid norm: positive definiteness. It has two parts: (1) ∥x∥≥0\|x\| \geq 0 — the norm of any vector is non-negative (length is never negative), and (2) ∥x∥=0⇔x=0\|x\| = 0 \Leftrightarrow x = \mathbf{0} — a vector has zero length if and only if it is the zero vector. The second part is the identity of indiscernibles: distinct nonzero vectors must have positive length. Without this axiom, a "norm" could assign zero length to a non-zero vector, making it impossible to distinguish the vector from the origin. Combined with absolute homogeneity and the triangle inequality, this defines a valid norm. In DA/DS: this guarantees that ∥w∥2=0\|w\|_2 = 0 means all weights are zero, ∥∇L∥=0\|\nabla L\| = 0 means the gradient has vanished (local minimum), and ∥e∥=0\|e\| = 0 means zero residual error.

Flowchart

NoYes (always)Yes, but x != 0Yes, and x == 0No (||x|| 0)Input: vector x inR^nCompute norm:||x||||x|| = 0?INVALID: not anormIs ||x|| == 0?Correct: zerovector has zeronormCorrect: nonzerovector haspositive normAxiom 1satisfied:positivedefiniteness

Real-world use

Where it is used

Validating that a proposed function qualifies as a norm, interpreting convergence criteria in optimization (∥∇L∥2<ϵ\|\nabla L\|_2 < \epsilon means the gradient is approximately zero), computing regularization penalties (∥w∥1\|w\|_1 or ∥w∥2\|w\|_2 is always non-negative, so it can only increase the loss), and checking that a model's weight update actually changes the weights (∥Δw∥=0\|\Delta w\| = 0 means no update occurred).

Problem it solves

Without positive definiteness, a "norm" could assign length 0 to a nonzero vector. If ∥w∥2=0\|w\|_2 = 0 did not imply w=0w = 0, then regularization with an L2L_2 penalty could suppress nonzero weights to apparent zero norm, breaking the regularization guarantee. The axiom ensures norms provide a reliable measure of "how much" a vector differs from zero.

How it solves the problem

For the L2L_2 norm: ∥x∥2=∑ixi2\|x\|_2 = \sqrt{\sum_i x_i^2}. Since each xi2≥0x_i^2 \geq 0, the sum is ≥0\geq 0, and the square root is ≥0\geq 0. If ∥x∥2=0\|x\|_2 = 0, then ∑ixi2=0\sum_i x_i^2 = 0, which requires every xi=0x_i = 0 (a sum of non-negatives equals zero only when all terms are zero). So ∥x∥2=0⇔x=0\|x\|_2 = 0 \Leftrightarrow x = \mathbf{0}. The same argument applies to all LpL_p norms with p≥1p \geq 1.

Example in a business

A DS monitors gradient norm during training: if ∥∇L∥2=0\|\nabla L\|_2 = 0, training has converged (the gradient has vanished). This relies on positive definiteness: if ∥∇L∥2=0\|\nabla L\|_2 = 0, then the gradient vector itself is the zero vector — every partial derivative is zero. Without this axiom, a zero norm would not guarantee a zero gradient.

The formula, piece by piece

  • ∥x∥\|x\|: the norm of vector xx (any valid norm: L1L_1, L2L_2, L∞L_\infty, etc.)
  • ≥0\geq 0: non-negativity; the norm always returns a non-negative real number
  • =0= 0: zero norm
  •   ⟺  \iff: if and only if (biconditional); this is the strong form: zero norm is both necessary and sufficient for the zero vector
  • x=0x = \mathbf{0}: the zero vector; all components equal zero: x1=x2=⋯=xn=0x_1 = x_2 = \cdots = x_n = 0
  • Together: ∥x∥≥0\|x\| \geq 0, with equality iff xx is the zero vector

The formula in words

"The length (norm) of any vector is always non-negative. The only vector with zero length is the zero vector itself. Equivalently: if a vector has any nonzero component, its norm is strictly positive." Tiny examples with L2L_2 norm:

  • x=(3,4)x = (3, 4): ∥x∥2=5>0\|x\|_2 = 5 > 0. ✓\checkmark
  • x=(0,0)x = (0, 0): ∥x∥2=0\|x\|_2 = 0, and x=0x = \mathbf{0}. ✓\checkmark
  • x=(0,0.001)x = (0, 0.001): ∥x∥2=0.001>0\|x\|_2 = 0.001 > 0 even though one component is zero. ✓\checkmark

Critical Concepts

  • All LpL_p norms satisfy this: for p≥1p \geq 1, ∥x∥p=(∑i∣xi∣p)1/p=0\|x\|_p = (\sum_i |x_i|^p)^{1/p} = 0 iff all ∣xi∣p=0|x_i|^p = 0 iff all xi=0x_i = 0.
  • Seminorm vs norm: a seminorm satisfies all norm axioms except the identity part of positive definiteness (∥x∥=0\|x\| = 0 does NOT necessarily imply x=0x = 0). Useful theoretically but not a metric.
  • Floating point: in practice, ∥x∥2<ϵ\|x\|_2 < \epsilon (e.g., 10−810^{-8}) is used as a proxy for "effectively zero" due to numerical precision.
  • Convergence criterion: gradient descent stopping condition ∥∇L(θ)∥2<ϵ\|\nabla L(\theta)\|_2 < \epsilon relies on: if norm is small, gradient is small, so near a local minimum. This requires positive definiteness.
  • Connection to metric: the distance d(x,y)=∥x−y∥d(x, y) = \|x - y\| inherits positive definiteness: d(x,y)=0⇔∥x−y∥=0⇔x−y=0⇔x=yd(x,y) = 0 \Leftrightarrow \|x-y\| = 0 \Leftrightarrow x-y = 0 \Leftrightarrow x = y.

Step-by-step calculation (tiny example)

Step 1: Verify non-negativity for a nonzero vector x=(−3,0,4)x = (-3, 0, 4). ∥x∥2=9+0+16=25=5≥0\|x\|_2 = \sqrt{9+0+16} = \sqrt{25} = 5 \geq 0. ✓\checkmark

Step 2: Verify the zero case z=(0,0,0)z = (0, 0, 0). ∥z∥2=0+0+0=0\|z\|_2 = \sqrt{0+0+0} = 0. And z=0z = \mathbf{0}. ✓\checkmark

Step 3: Verify near-zero is not zero u=(0,0,0.0001)u = (0, 0, 0.0001). ∥u∥2=0.0001>0\|u\|_2 = 0.0001 > 0 even though uu is tiny. The norm is strictly positive for any nonzero vector. ✓\checkmark

Code examples

Beginner example (Python)

python
import numpy as np

# -- Positive definiteness of norms: verify ||x|| >= 0 and ||x|| = 0 iff x = 0 ---
test_vectors = [
    np.array([3.0, 4.0]),
    np.array([0.0, 0.0]),
    np.array([-5.0, 0.0, 12.0]),
    np.array([0.0, 0.0, 0.0]),
    np.array([0.0, 0.001]),
]
print(f"{'Vector':<30} {'L2 norm':>10} {'>=0':>6} {'=0 iff zero':>12}")
for x in test_vectors:
    norm_val = np.linalg.norm(x)
    is_zero_vec = np.all(x == 0)
    norm_is_zero = np.isclose(norm_val, 0)
    axiom_ok = (norm_val >= 0) and (norm_is_zero == is_zero_vec)
    print(f"{str(x):<30} {norm_val:>10.6f} {str(norm_val >= 0):>6} {str(axiom_ok):>12}")

Beginner example (R)

r
# -- Positive definiteness for L2 norm ---
test_vecs <- list(c(3, 4), c(0, 0), c(-5, 0, 12), c(0, 0, 0), c(0, 0.001))
for (x in test_vecs) {
  norm_val <- sqrt(sum(x^2))
  is_zero_vec <- all(x == 0)
  norm_is_zero <- isTRUE(all.equal(norm_val, 0))
  axiom_ok <- (norm_val >= 0) && (norm_is_zero == is_zero_vec)
  cat(sprintf("||%s|| = %.6f >=0: %s axiom: %s\n", paste(x, collapse=","), norm_val, as.character(norm_val >= 0), as.character(axiom_ok)))
}

Professional example (Python)

python
import numpy as np
import pandas as pd
np.random.seed(42)

# -- Business scenario: gradient convergence monitoring via norm ---
# Training stops when ||grad||_2 < epsilon (relies on positive definiteness).
# Track gradient norm across training iterations.
N_PARAMS = 20
N_ITERS = 40
LR = 0.15
EPSILON = 1e-4

# Simulate gradient descent: grad decays toward zero
theta = np.random.randn(N_PARAMS)
grad_log = []
for step in range(N_ITERS):
    # Simulate quadratic loss gradient: grad proportional to theta
    grad = theta + 0.05 * np.random.randn(N_PARAMS)
    theta = theta - LR * grad
    grad_norm = np.linalg.norm(grad)  # positive definiteness guarantees >= 0
    converged = grad_norm < EPSILON
    grad_log.append({
        "step": step + 1,
        "grad_norm": round(grad_norm, 6),
        "converged": converged,
    })
    if converged:
        break

grad_df = pd.DataFrame(grad_log)
print("Gradient norm convergence (||grad|| -> 0 means all partial derivatives -> 0):")
print(grad_df.to_string(index=False))
print(f"\nFinal grad_norm: {grad_df.iloc[-1]['grad_norm']}")
print(f"Converged (||grad|| < {EPSILON}): {grad_df.iloc[-1]['converged']}")
print(f"\nPositive definiteness guarantees: if norm == 0 => all gradients are exactly 0.")

Source: MML1 p. 76

#linear-algebra#spatial-distance-norms-and-analytic-geometry#distance-metrics-and-norms

Keyboard shortcuts

Single keys, ignored while typing in a field or with Cmd, Ctrl or Alt held.

0
Home
1 2 3 4
Work, Writing, Tools, About
j / k
Next / previous section on this page
n / p
Next / previous project or essay
u
Up one level
l
Deutsch
t
Light or dark theme
?
This list
Esc
Close