Type at least 2 letters. Enter opens the first result, Esc closes.

    Linear Algebra · Lesson 11 · Factorizations, norms and least squares

    The norm zoo: ℓp\ell_p, spectral, Frobenius, nuclear and Schatten norms

    Intermediate 70 min 5 interactive figures 2 videos Colab notebook

    Before this lesson: lesson 08 (the SVD, Eckart–Young–Mirsky, polar decomposition and the pseudoinverse) and lesson 03 (inverse, determinant, dot product and orthogonal projection). Time: about 70 minutes, plus the notebook.


    Why this matters #

    A norm is a choice of how to measure size, and the choice changes the answer. Penalizing ∥w∥1\|w\|_1 gives sparse models (lasso); penalizing ∥w∥22\|w\|_2^2 gives small, dense ones (ridge). For matrices, the spectral norm measures the worst-case stretch: it is the Lipschitz constant of a linear layer and the basis of spectral normalization. The nuclear norm is the convex stand-in for rank, used for matrix completion and low-rank recovery. Error budgets for compression (lesson 08) and condition numbers (lesson 13) are also stated in these norms.

    1. Predict first #

    2. The picture #

    The unit ball of a norm is the set {x:∥x∥≤1}\{x : \|x\| \le 1\}. In the plane it looks like this:

    • ℓ2\ell_2: a disk.
    • ℓ1\ell_1: a diamond with corners on the axes, (±1,0)(\pm1, 0) and (0,±1)(0, \pm1).
    • ℓ∞\ell_\infty: a square with corners at (±1,±1)(\pm1, \pm1).
    Interactive figure: loading…

    Change pp and watch the ball. The green region is the unit ball of ∥⋅∥p\|\cdot\|_p; the thin outlines are the ℓ1\ell_1, ℓ2\ell_2 and ℓ∞\ell_\infty balls. As pp grows, the ball grows from the diamond to the square. Move pp below 1: the ball becomes a star, and the midpoint of e1e_1 and e2e_2 falls outside it. A set that does not contain the midpoints of its points is not convex, so for p<1p < 1 the formula is not a norm. Drag xx to see ∥x∥∞≤∥x∥2≤∥x∥1\|x\|_\infty \le \|x\|_2 \le \|x\|_1.

    To find the point of a line with the smallest norm, inflate the ball until it first touches the line. The disk touches at the foot of the perpendicular, which in general has no zero coordinate. The diamond almost always touches first at a corner, and corners lie on the axes: one coordinate is exactly zero. This one picture is the main reason why ℓ1\ell_1 gives sparse solutions.

    Interactive figure: loading…

    Inflate the balls. Press Inflate to grow the ℓ1\ell_1, ℓ2\ell_2 and ℓ∞\ell_\infty balls until each touches the line x1+2x2=4x_1 + 2x_2 = 4 of section 1. The touching points are the minimizers. Drag the grey points to tilt the line: the ℓ1\ell_1 answer jumps from one axis to the other but always keeps a zero coordinate, while the ℓ2\ell_2 answer moves smoothly and has no zeros.

    For a matrix AA, the singular values σ1≥σ2≥⋯≥0\sigma_1 \ge \sigma_2 \ge \dots \ge 0 are the axis lengths of the ellipse {Ax:∥x∥2=1}\{Ax : \|x\|_2 = 1\} (lesson 08). The three main matrix norms are three ways to summarize these lengths: the longest one, the root of the sum of squares, and the sum.

    Quick check

    For x=(3,4)x = (3, 4), which list gives ∥x∥∞\|x\|_\infty, ∥x∥2\|x\|_2, ∥x∥1\|x\|_1 in this order?

    3. Definitions and main results #

    Norms #

    A norm on Rn\mathbb{R}^n is a function ∥⋅∥\|\cdot\| with, for all x,yx, y and scalars cc:

    1. ∥x∥≥0\|x\| \ge 0, and ∥x∥=0\|x\| = 0 only for x=0x = 0 (definiteness);
    2. ∥cx∥=∣c∣ ∥x∥\|cx\| = |c|\,\|x\| (homogeneity);
    3. ∥x+y∥≤∥x∥+∥y∥\|x + y\| \le \|x\| + \|y\| (triangle inequality).

    The ℓp\ell_p norms, for p≥1p \ge 1: ∥x∥p=(∑i∣xi∣p)1/p\|x\|_p = \big(\sum_i |x_i|^p\big)^{1/p}, and ∥x∥∞=max⁡i∣xi∣\|x\|_\infty = \max_i |x_i| (the limit p→∞p \to \infty). Facts you will use:

    • ∥x∥p\|x\|_p is non-increasing in pp: ∥x∥∞≤∥x∥2≤∥x∥1\|x\|_\infty \le \|x\|_2 \le \|x\|_1.
    • In the other direction: ∥x∥1≤n ∥x∥2\|x\|_1 \le \sqrt n\,\|x\|_2 and ∥x∥2≤n ∥x∥∞\|x\|_2 \le \sqrt n\,\|x\|_\infty.
    • A bound used below: ∣a⊤x∣≤∥a∥∞∥x∥1|a^\top x| \le \|a\|_\infty\|x\|_1. Proof: ∣∑iaixi∣≤∑i∣ai∣ ∣xi∣≤max⁡i∣ai∣∑i∣xi∣|\sum_i a_i x_i| \le \sum_i |a_i|\,|x_i| \le \max_i |a_i| \sum_i |x_i|.
    • For a symmetric positive definite (SPD) matrix SS, ∥x∥S=x⊤Sx\|x\|_S = \sqrt{x^\top S x} is also a norm (the energy norm).

    Not norms. For 0<p<10 < p < 1 the triangle inequality fails: with x=(1,0)x = (1,0), y=(0,1)y = (0,1), ∥x+y∥1/2=(1+1)2=4>2=∥x∥1/2+∥y∥1/2\|x+y\|_{1/2} = (1 + 1)^2 = 4 > 2 = \|x\|_{1/2} + \|y\|_{1/2}; the unit ball is not convex. The count of nonzeros, "∥x∥0\|x\|_0", fails homogeneity: ∥2x∥0=∥x∥0\|2x\|_0 = \|x\|_0, not 2∥x∥02\|x\|_0.

    Dual norms and Hölder's inequality

    Hölder's inequality: ∣x⊤y∣≤∥x∥p∥y∥q|x^\top y| \le \|x\|_p\|y\|_q when 1/p+1/q=11/p + 1/q = 1 (with 1/∞=01/\infty = 0). For p=q=2p = q = 2 it is the Cauchy–Schwarz inequality. For p=1p = 1, q=∞q = \infty it is the bound ∣a⊤x∣≤∥a∥∞∥x∥1|a^\top x| \le \|a\|_\infty\|x\|_1 above.

    The dual norm of a norm ∥⋅∥\|\cdot\| is ∥y∥∗=max⁡∥x∥≤1x⊤y\|y\|_* = \max_{\|x\| \le 1} x^\top y: the largest "score" x⊤yx^\top y over the unit ball. Hölder's inequality is sharp, so the dual of ℓp\ell_p is ℓq\ell_q. So ℓ1\ell_1 and ℓ∞\ell_\infty are dual to each other, and ℓ2\ell_2 is its own dual.

    For ℓ1\ell_1 the maximizer of x⊤yx^\top y over the unit ball is a corner ±ej\pm e_j with j=arg⁡max⁡i∣yi∣j = \arg\max_i |y_i|, so max⁡∥x∥1≤1x⊤y=∥y∥∞\max_{\|x\|_1 \le 1} x^\top y = \|y\|_\infty. This is the same "corner" picture as in section 2. Dual norms appear in optimality conditions (the subgradient of ∥x∥\|x\| is a vector of dual norm at most 1) and in steepest descent: the steepest-descent step in ℓ∞\ell_\infty is −sign⁡(∇f)-\operatorname{sign}(\nabla f), the step of signSGD and close to Adam's early steps.

    Why ℓ1\ell_1 promotes sparsity #

    Theorem 1 (one constraint). Let a≠0a \neq 0. Among all xx with a⊤x=ba^\top x = b, the smallest ℓ1\ell_1 norm is ∣b∣/∥a∥∞|b|/\|a\|_\infty, reached by the 1-sparse vector x=(b/aj) ejx = (b/a_j)\,e_j with j=arg⁡max⁡i∣ai∣j = \arg\max_i |a_i|. The smallest ℓ2\ell_2 norm is reached at x=b a/∥a∥22x = b\,a/\|a\|_2^2, which (for b≠0b \neq 0) is nonzero wherever aa is.

    Proof.

    1. By the bound above, ∣b∣=∣a⊤x∣≤∥a∥∞∥x∥1|b| = |a^\top x| \le \|a\|_\infty \|x\|_1. So every feasible xx has ∥x∥1≥∣b∣/∥a∥∞\|x\|_1 \ge |b|/\|a\|_\infty.
    2. x=(b/aj)ejx = (b/a_j)e_j is feasible (a⊤x=aj⋅b/aj=ba^\top x = a_j \cdot b/a_j = b) and has ∥x∥1=∣b∣/∣aj∣=∣b∣/∥a∥∞\|x\|_1 = |b|/|a_j| = |b|/\|a\|_\infty: the lower bound is reached.
    3. For ℓ2\ell_2, the minimizer is the orthogonal projection of 00 onto the line (lesson 03), which is along the normal vector aa: x=b a/∥a∥22x = b\,a/\|a\|_2^2. ■\blacksquare

    Soft-thresholding. Lasso solvers reduce the problem to one coordinate at a time. For one coordinate, the question is: given a number zz (what the data want) and a penalty weight λ>0\lambda > 0, which xx minimizes

    g(x)=12(x−z)2+λ∣x∣  ?g(x) = \tfrac12(x - z)^2 + \lambda|x| \;?

    Theorem 2 (soft-thresholding). The minimizer of gg is x⋆=Sλ(z)=sign⁡(z)max⁡(∣z∣−λ,0)x^\star = S_\lambda(z) = \operatorname{sign}(z)\max(|z| - \lambda, 0). The minimizer of the ridge objective 12(x−z)2+λ2x2\tfrac12(x - z)^2 + \tfrac\lambda2 x^2 is z/(1+λ)z/(1 + \lambda).

    Proof, step by step. gg is a parabola plus a "V". Both are convex, so gg is convex, and a point where gg stops going down and starts going up is the global minimum. The V has a kink at x=0x = 0, so we look at three cases.

    1. Case x>0x > 0. Here ∣x∣=x|x| = x, so g(x)=12(x−z)2+λxg(x) = \tfrac12(x - z)^2 + \lambda x and g′(x)=x−z+λg'(x) = x - z + \lambda. Setting g′(x)=0g'(x) = 0 gives x=z−λx = z - \lambda. This point is in the case (x>0x > 0) only when z>λz > \lambda.
    2. Case x<0x < 0. Here ∣x∣=−x|x| = -x, so g′(x)=x−z−λg'(x) = x - z - \lambda, and g′(x)=0g'(x) = 0 gives x=z+λx = z + \lambda. This point is in the case (x<0x < 0) only when z<−λz < -\lambda.
    3. Case x=0x = 0 (the kink). gg has no derivative at 0, but it has two one-sided slopes: g′(0−)=−z−λg'(0^-) = -z - \lambda from the left and g′(0+)=−z+λg'(0^+) = -z + \lambda from the right. The point x=0x = 0 is the minimum when gg goes down into it and up after it: g′(0−)≤0≤g′(0+)g'(0^-) \le 0 \le g'(0^+), that is, −λ≤z≤λ-\lambda \le z \le \lambda.
    4. The three conditions z>λz > \lambda, z<−λz < -\lambda and ∣z∣≤λ|z| \le \lambda cover every zz exactly once. Together: x⋆=z−λx^\star = z - \lambda, z+λz + \lambda or 00, which is the formula sign⁡(z)max⁡(∣z∣−λ,0)\operatorname{sign}(z)\max(|z| - \lambda, 0).
    5. Ridge. The ridge objective has no kink: its derivative x−z+λx=0x - z + \lambda x = 0 gives x=z/(1+λ)x = z/(1 + \lambda), which is zero only if z=0z = 0. ■\blacksquare

    In the language of convex analysis, step 3 says 0∈−z+λ ∂∣x∣(0)0 \in -z + \lambda\,\partial|x|(0), where the subdifferential ∂∣x∣(0)=[−1,1]\partial|x|(0) = [-1, 1] is the set of slopes of lines that touch the V at 0 from below.

    Interactive figure: loading…

    Move zz and λ\lambda. Top: the lasso objective gg with its minimizer, the ridge objective with its minimizer, and the two slopes of gg at the kink. Bottom: the output x⋆x^\star against the input zz. Move zz into the band −λ≤z≤λ-\lambda \le z \le \lambda: the left slope becomes ≤0\le 0 and the right slope ≥0\ge 0, so the lowest point of gg sits exactly at the kink and the lasso output is exactly 0. The ridge output z/(1+λ)z/(1 + \lambda) only gets smaller.

    The reason in one sentence: ∣x∣|x| keeps slope ±1\pm1 near 0, so a small data term cannot pull xx away from 0; x2x^2 has slope 0 at 0, so it never holds xx exactly at 0 (unless z=0z = 0). Lasso solvers (ISTA, coordinate descent) apply this step to each coordinate.

    Quick check

    With λ=1\lambda = 1, what does soft-thresholding give for z=0.7z = 0.7 and for z=−2.5z = -2.5?

    The same picture works for a full least-squares loss. Lasso and ridge can be written as constrained problems: minimize ∥Xw−y∥22\|Xw - y\|_2^2 subject to ∥w∥1≤t\|w\|_1 \le t or ∥w∥2≤t\|w\|_2 \le t (each value of the penalty λ\lambda matches some radius tt). The level sets of the loss are ellipses around the unconstrained solution w^\hat w.

    Interactive figure: loading…

    Where the ellipse meets the ball. The grey ellipses are level sets of the least-squares loss around w^\hat w. The solution under a constraint is the point where the smallest ellipse reaches the diamond (lasso) or the disk (ridge). Drag w^\hat w around: for a large range of positions the lasso answer sits on a corner, with one weight exactly 0, while the ridge answer only shrinks. Make tt large enough and both answers equal w^\hat w. The tilt slider turns the ellipses (correlated features).

    Matrix norms from singular values #

    Let A∈Rm×nA \in \mathbb{R}^{m\times n} with SVD A=UΣV⊤A = U\Sigma V^\top and rank rr.

    Norm Definition Through singular values
    spectral (operator 2-norm) ∥A∥2\lVert A\rVert_2 max⁡x≠0∥Ax∥2/∥x∥2\max_{x\neq0} \lVert Ax\rVert_2/\lVert x\rVert_2 σ1\sigma_1
    Frobenius ∥A∥F\lVert A\rVert_F (∑ijaij2)1/2=tr⁡(A⊤A)\big(\sum_{ij} a_{ij}^2\big)^{1/2} = \sqrt{\operatorname{tr}(A^\top A)} (∑iσi2)1/2\big(\sum_i \sigma_i^2\big)^{1/2}
    nuclear (trace norm) ∥A∥∗\lVert A\rVert_* max⁡∥B∥2≤1tr⁡(B⊤A)\max_{\lVert B\rVert_2 \le 1}\operatorname{tr}(B^\top A) ∑iσi\sum_i \sigma_i

    The spectral norm is the largest stretch factor of AA. The Frobenius norm treats AA as a long vector of mnmn entries. The nuclear norm is the sum of the singular values.

    Theorem 3. ∥A∥2=σ1\|A\|_2 = \sigma_1 and ∥A∥F2=∑iσi2\|A\|_F^2 = \sum_i \sigma_i^2.

    Proof.

    1. Orthogonal matrices keep lengths. Put y=V⊤xy = V^\top x, so ∥y∥=∥x∥\|y\| = \|x\|, and ∥Ax∥=∥UΣy∥=∥Σy∥\|Ax\| = \|U\Sigma y\| = \|\Sigma y\|.
    2. ∥Σy∥2=∑iσi2yi2≤σ12∥y∥2\|\Sigma y\|^2 = \sum_i \sigma_i^2 y_i^2 \le \sigma_1^2\|y\|^2. So ∥Ax∥/∥x∥≤σ1\|Ax\|/\|x\| \le \sigma_1.
    3. Equality at x=v1x = v_1: Av1=σ1u1Av_1 = \sigma_1 u_1. Hence ∥A∥2=σ1\|A\|_2 = \sigma_1.
    4. ∥A∥F2=tr⁡(A⊤A)=tr⁡(VΣ⊤ΣV⊤)=tr⁡(Σ⊤ΣV⊤V)=∑iσi2\|A\|_F^2 = \operatorname{tr}(A^\top A) = \operatorname{tr}(V\Sigma^\top\Sigma V^\top) = \operatorname{tr}(\Sigma^\top\Sigma V^\top V) = \sum_i \sigma_i^2 (the trace is cyclic: tr⁡(XY)=tr⁡(YX)\operatorname{tr}(XY) = \operatorname{tr}(YX)). ■\blacksquare

    The induced 1- and ∞\infty-norms, by hand #

    Any vector norm gives an induced (operator) matrix norm: ∥A∥p=max⁡x≠0∥Ax∥p/∥x∥p\|A\|_p = \max_{x \ne 0} \|Ax\|_p/\|x\|_p, the largest stretch measured in ℓp\ell_p. For p=2p = 2 this is σ1\sigma_1, which needs the SVD. For p=1p = 1 and p=∞p = \infty there are simple formulas.

    ∥A∥1\|A\|_1 = largest absolute column sum. Let cj=∑i∣aij∣c_j = \sum_i |a_{ij}| be the absolute sum of column jj. Step 1: use ∣a+b∣≤∣a∣+∣b∣|a + b| \le |a| + |b| inside, then swap the order of the two sums. Step 2: bound every cjc_j by the largest one.

    ∥Ax∥1=∑i∣∑jaijxj∣≤∑j(∑i∣aij∣)∣xj∣=∑jcj∣xj∣≤(max⁡jcj) ∥x∥1.\begin{aligned} \|Ax\|_1 &= \sum_i \Big|\sum_j a_{ij}x_j\Big| \le \sum_j \Big(\sum_i |a_{ij}|\Big)|x_j| \\ &= \sum_j c_j|x_j| \le \big(\max_j c_j\big)\,\|x\|_1 . \end{aligned}

    Step 3: equality holds at x=ejx = e_j for the best column jj, because ∥Aej∥1=cj\|Ae_j\|_1 = c_j. So ∥A∥1=max⁡jcj\|A\|_1 = \max_j c_j.

    ∥A∥∞\|A\|_\infty = largest absolute row sum. Let ρi=∑j∣aij∣\rho_i = \sum_j |a_{ij}| be the absolute sum of row ii. Step 1: bound each entry of AxAx.

    ∣(Ax)i∣=∣∑jaijxj∣≤∑j∣aij∣ ∣xj∣≤ρi∥x∥∞.|(Ax)_i| = \Big|\sum_j a_{ij}x_j\Big| \le \sum_j |a_{ij}|\,|x_j| \le \rho_i\|x\|_\infty .

    Step 2: take the largest entry: ∥Ax∥∞=max⁡i∣(Ax)i∣≤(max⁡iρi)∥x∥∞\|Ax\|_\infty = \max_i |(Ax)_i| \le (\max_i \rho_i)\|x\|_\infty.

    Step 3: equality holds at xj=sign⁡(aij)x_j = \operatorname{sign}(a_{ij}) for the best row ii. Then every term is aijxj=∣aij∣a_{ij}x_j = |a_{ij}|, so (Ax)i=ρi(Ax)_i = \rho_i, and ∥x∥∞=1\|x\|_\infty = 1.

    Example. A=(1−234)A = \begin{pmatrix} 1 & -2 \\ 3 & 4 \end{pmatrix}.

    • Column sums: ∣1∣+∣3∣=4|1| + |3| = 4 and ∣−2∣+∣4∣=6|-2| + |4| = 6. So ∥A∥1=6\|A\|_1 = 6, reached at e2e_2: Ae2=(−2,4)Ae_2 = (-2, 4) and ∥Ae2∥1=6\|Ae_2\|_1 = 6.
    • Row sums: ∣1∣+∣−2∣=3|1| + |-2| = 3 and ∣3∣+∣4∣=7|3| + |4| = 7. So ∥A∥∞=7\|A\|_\infty = 7, reached at the signs of row 2, x=(1,1)x = (1, 1): Ax=(−1,7)Ax = (-1, 7) and ∥Ax∥∞=7\|Ax\|_\infty = 7.
    Interactive figure: loading…

    The largest stretch. The grey region is the unit ball of ∥⋅∥p\|\cdot\|_p and the green region is its image under AA. The dashed ball has radius ∥A∥p\|A\|_p: it is the smallest pp-ball around the image, and it touches the image at Ax⋆Ax^\star. For p=1p = 1 the maximizer x⋆x^\star is a corner eje_j (largest column sum); for p=∞p = \infty it is a corner (±1,±1)(\pm1, \pm1) (the signs of the largest row); for p=2p = 2 it is v1v_1. The matrix is half of the one in section 4, so every norm is half as large.

    The Frobenius and nuclear norms are not induced norms: every induced norm has ∥I∥=max⁡x∥x∥/∥x∥=1\|I\| = \max_x \|x\|/\|x\| = 1, but ∥In∥F=n\|I_n\|_F = \sqrt n and ∥In∥∗=n\|I_n\|_* = n.

    Quick check

    What is the spectral norm ∥A∥2\|A\|_2 of A=(300−5)A = \begin{pmatrix} 3 & 0 \\ 0 & -5 \end{pmatrix}?

    Useful properties:

    • Unitary invariance: ∥QAZ∥=∥A∥\|QAZ\| = \|A\| for orthogonal QQ, ZZ, for all three norms (the singular values do not change).
    • Inequalities (vector norm inequalities applied to σ∈Rr\sigma \in \mathbb{R}^r): ∥A∥2≤∥A∥F≤r ∥A∥2\|A\|_2 \le \|A\|_F \le \sqrt r\,\|A\|_2 and ∥A∥F≤∥A∥∗≤r ∥A∥F\|A\|_F \le \|A\|_* \le \sqrt r\,\|A\|_F.
    • Submultiplicativity: ∥AB∥≤∥A∥ ∥B∥\|AB\| \le \|A\|\,\|B\| for induced norms and for Frobenius; also the mixed bound ∥AB∥F≤∥A∥2 ∥B∥F\|AB\|_F \le \|A\|_2\,\|B\|_F.

    The spectral norm as a Lipschitz constant #

    A function ff is LL-Lipschitz if ∥f(x)−f(y)∥≤L∥x−y∥\|f(x) - f(y)\| \le L\|x - y\| for all x,yx, y: outputs move at most LL times as much as inputs. The smallest such LL is the Lipschitz constant Lip⁡(f)\operatorname{Lip}(f). Here we build the bound for a network step by step.

    1. A linear layer. ∥Wx−Wy∥2=∥W(x−y)∥2≤∥W∥2 ∥x−y∥2\|Wx - Wy\|_2 = \|W(x - y)\|_2 \le \|W\|_2\,\|x - y\|_2, with equality when x−yx - y is parallel to v1v_1. So Lip⁡(x↦Wx)=σ1(W)\operatorname{Lip}(x \mapsto Wx) = \sigma_1(W) exactly.
    2. An activation. ReLU acts entry by entry, and ∣max⁡(a,0)−max⁡(b,0)∣≤∣a−b∣|\max(a, 0) - \max(b, 0)| \le |a - b| for numbers. Square and add over the entries: ReLU is 1-Lipschitz. The same holds for tanh.
    3. A composition. If gg is LgL_g-Lipschitz and hh is LhL_h-Lipschitz, then ∥h(g(x))−h(g(y))∥≤Lh∥g(x)−g(y)∥≤LhLg∥x−y∥\|h(g(x)) - h(g(y))\| \le L_h\|g(x) - g(y)\| \le L_hL_g\|x - y\|.
    4. A network. For f=WL∘ϕ∘⋯∘ϕ∘W1f = W_L \circ \phi \circ \dots \circ \phi \circ W_1 with 1-Lipschitz activations ϕ\phi, step 3 applied layer by layer gives Lip⁡(f)≤∏l∥Wl∥2\operatorname{Lip}(f) \le \prod_l \|W_l\|_2.

    A 2-layer example. Let W1=(2001/2)W_1 = \begin{pmatrix} 2 & 0 \\ 0 & 1/2 \end{pmatrix}, W2=(1/2002)W_2 = \begin{pmatrix} 1/2 & 0 \\ 0 & 2 \end{pmatrix} and f(x)=W2ReLU⁡(W1x)f(x) = W_2\operatorname{ReLU}(W_1x). The bound is ∥W2∥2∥W1∥2=2⋅2=4\|W_2\|_2\|W_1\|_2 = 2 \cdot 2 = 4. But W1W_1 stretches the e1e_1 direction by 2 and W2W_2 shrinks the same direction by 1/21/2, so f(x)=(ReLU⁡(x1),ReLU⁡(x2))f(x) = (\operatorname{ReLU}(x_1), \operatorname{ReLU}(x_2)), and the true constant is 1. With W2=W1W_2 = W_1 instead, f(x)=(4ReLU⁡(x1),14ReLU⁡(x2))f(x) = (4\operatorname{ReLU}(x_1), \tfrac14\operatorname{ReLU}(x_2)): two points on the positive x1x_1-axis move 4 times apart, so the bound 4 is reached. The product bound is tight only when the top directions of consecutive layers line up.

    Spectral normalization (Miyato et al., 2018) uses W/σ^1(W)W/\hat\sigma_1(W) in each layer, so every layer is (up to the estimation error of σ^1\hat\sigma_1) 1-Lipschitz and the bound is at most 1. The estimate σ^1\hat\sigma_1 comes from one power-iteration step per training step, reusing the vector from the previous step. Two limits: the product bound is often loose (as in the example), and for a convolution the paper normalizes the reshaped dout×(dinhw)d_\text{out}\times(d_\text{in}hw) kernel matrix, which is only a proxy for the operator norm of the convolution.

    The nuclear norm and low rank #

    rank⁡(A)\operatorname{rank}(A) is the number of nonzero σi\sigma_i (an "ℓ0\ell_0" of σ\sigma), while ∥A∥∗\|A\|_* is the ℓ1\ell_1 norm of σ\sigma. So the nuclear norm plays the role of ℓ1\ell_1 for rank.

    Why not minimize the rank directly? The rank is not a convex function. A convex ff satisfies f(12A+12B)≤12f(A)+12f(B)f(\tfrac12 A + \tfrac12 B) \le \tfrac12 f(A) + \tfrac12 f(B). Take A=E11=diag⁡(1,0)A = E_{11} = \operatorname{diag}(1, 0) and B=E22=diag⁡(0,1)B = E_{22} = \operatorname{diag}(0, 1). Each has rank 1, but 12A+12B=12I\tfrac12 A + \tfrac12 B = \tfrac12 I has rank 2>12⋅1+12⋅1=12 > \tfrac12 \cdot 1 + \tfrac12 \cdot 1 = 1. Problems like "find the matrix of smallest rank that fits these entries" are NP-hard in general. The nuclear norm is a norm, so it is convex: here ∥12I∥∗=1=12∥A∥∗+12∥B∥∗\|\tfrac12 I\|_* = 1 = \tfrac12\|A\|_* + \tfrac12\|B\|_*, and convex problems with it can be solved efficiently.

    Quick check

    A=diag⁡(1,0)A = \operatorname{diag}(1, 0) and B=diag⁡(0,1)B = \operatorname{diag}(0, 1). Which statement is true?

    The proximal step of the nuclear norm (the matrix version of soft-thresholding) is singular value soft-thresholding: UΣV⊤↦Umax⁡(Σ−λ,0)V⊤U\Sigma V^\top \mapsto U\max(\Sigma - \lambda, 0)V^\top. It sets the small singular values exactly to zero, so it gives low rank in the same way that soft-thresholding gives zeros. On the set {∥A∥2≤1}\{\|A\|_2 \le 1\}, ∥A∥∗\|A\|_* is the convex envelope (the largest convex function below) of the rank (Fazel), which is why it is the standard convex surrogate (matrix completion, robust PCA).

    Schatten pp-norms #

    Definition. For p≥1p \ge 1, the Schatten pp-norm is ∥A∥Sp=(∑iσip)1/p\|A\|_{S_p} = \big(\sum_i \sigma_i^p\big)^{1/p}, the ℓp\ell_p norm of the singular value vector.

    • p=1p = 1: nuclear norm. p=2p = 2: Frobenius norm. p=∞p = \infty: spectral norm.
    • They are norms for p≥1p \ge 1 (the triangle inequality needs a real proof, via von Neumann's trace inequality); for 0<p<10 < p < 1 they are not (non-convex rank surrogates).
    • All are unitarily invariant, and non-increasing in pp.
    • Eckart–Young–Mirsky holds in every unitarily invariant norm: the truncated SVD AkA_k is the best approximation of rank at most kk in every SpS_p, with error (∑j>kσjp)1/p\big(\sum_{j>k}\sigma_j^p\big)^{1/p}.
    Duality of the Schatten norms

    SpS_p and SqS_q are dual for 1/p+1/q=11/p + 1/q = 1: ∥A∥Sq=max⁡∥B∥Sp≤1tr⁡(B⊤A)\|A\|_{S_q} = \max_{\|B\|_{S_p} \le 1}\operatorname{tr}(B^\top A), with the matrix inner product tr⁡(B⊤A)=∑ijbijaij\operatorname{tr}(B^\top A) = \sum_{ij} b_{ij}a_{ij}. So the nuclear and the spectral norm are dual (this is the definition of ∥A∥∗\|A\|_* in the table), and Frobenius is self-dual. The maximizer for the nuclear norm is B=UV⊤B = UV^\top (the orthogonal factor of the polar decomposition, lesson 08): tr⁡(VU⊤UΣV⊤)=tr⁡Σ=∑iσi\operatorname{tr}(VU^\top U\Sigma V^\top) = \operatorname{tr}\Sigma = \sum_i\sigma_i. The proof of the general case uses von Neumann's trace inequality ∣tr⁡(B⊤A)∣≤∑iσi(A)σi(B)|\operatorname{tr}(B^\top A)| \le \sum_i \sigma_i(A)\sigma_i(B) and then Hölder's inequality for the singular value vectors.

    Answers to section 1. (1) ℓ2\ell_2: (0.8,1.6)(0.8, 1.6), no zero. ℓ1\ell_1: (0,2)(0, 2), by Theorem 1 (∥a∥∞=2\|a\|_\infty = 2 at j=2j = 2). (2) All three are equal: a rank-one matrix has one nonzero singular value, σ1=∥u∥2∥v∥2\sigma_1 = \|u\|_2\|v\|_2.

    4. Worked example #

    Vectors. x=(1,−2,2)x = (1, -2, 2): ∥x∥1=5\|x\|_1 = 5, ∥x∥2=1+4+4=3\|x\|_2 = \sqrt{1+4+4} = 3, ∥x∥∞=2\|x\|_\infty = 2. Check ∥x∥∞≤∥x∥2≤∥x∥1≤3 ∥x∥2≈5.196\|x\|_\infty \le \|x\|_2 \le \|x\|_1 \le \sqrt3\,\|x\|_2 \approx 5.196. ✓

    Minimum norms on the line x1+2x2=4x_1 + 2x_2 = 4 (a=(1,2)a = (1,2), b=4b = 4; the second figure):

    Norm Minimizer Why
    ℓ2\ell_2 b a/∥a∥2=(0.8,1.6)b\,a/\lVert a\rVert^2 = (0.8, 1.6) projection; norm 4/5≈1.7894/\sqrt5 \approx 1.789
    ℓ1\ell_1 (0,2)(0, 2) corner of the diamond; ℓ1\ell_1 norm 22 (the ℓ2\ell_2 answer has 2.42.4)
    ℓ∞\ell_\infty (4/3,4/3)(4/3, 4/3) corner of the square: equal coordinates

    Soft-thresholding with λ=1\lambda = 1: z=(3,0.5,−1.5)↦(2,0,−0.5)z = (3, 0.5, -1.5) \mapsto (2, 0, -0.5). The first entry is in case 1 (3>13 > 1, so 3−13 - 1), the second in case 3 (∣0.5∣≤1|0.5| \le 1, so 0), the third in case 2 (−1.5<−1-1.5 < -1, so −1.5+1-1.5 + 1). Ridge with λ=1\lambda = 1 gives z/2=(1.5,0.25,−0.75)z/2 = (1.5, 0.25, -0.75): smaller, but no zeros.

    A matrix. A=(3045)A = \begin{pmatrix} 3 & 0 \\ 4 & 5 \end{pmatrix}. A⊤A=(25202025)A^\top A = \begin{pmatrix} 25 & 20 \\ 20 & 25 \end{pmatrix} has eigenvalues 4545 and 55, so σ1=35≈6.708\sigma_1 = 3\sqrt5 \approx 6.708 and σ2=5≈2.236\sigma_2 = \sqrt5 \approx 2.236 (check: σ1σ2=15=∣det⁡A∣\sigma_1\sigma_2 = 15 = |\det A|).

    • Spectral: ∥A∥2=35≈6.708\|A\|_2 = 3\sqrt5 \approx 6.708, reached at v1=(1,1)/2v_1 = (1,1)/\sqrt2: Av1=(3,9)/2Av_1 = (3, 9)/\sqrt2, length 90/2=45\sqrt{90/2} = \sqrt{45}. ✓
    • Frobenius: 9+16+25=50=45+5≈7.071\sqrt{9 + 16 + 25} = \sqrt{50} = \sqrt{45 + 5} \approx 7.071. ✓
    • Nuclear: 35+5=45≈8.9443\sqrt5 + \sqrt5 = 4\sqrt5 \approx 8.944.
    • Schatten-4: (σ14+σ24)1/4=(452+52)1/4=20501/4≈6.729(\sigma_1^4 + \sigma_2^4)^{1/4} = (45^2 + 5^2)^{1/4} = 2050^{1/4} \approx 6.729, between S2S_2 and S∞S_\infty.
    • Induced ∥A∥1=max⁡(3+4, 0+5)=7\|A\|_1 = \max(3 + 4,\ 0 + 5) = 7 (columns), ∥A∥∞=max⁡(3+0, 4+5)=9\|A\|_\infty = \max(3 + 0,\ 4 + 5) = 9 (rows).
    • Inequalities with r=2r = 2: 6.708≤7.071≤9.4876.708 \le 7.071 \le 9.487 and 7.071≤8.944≤107.071 \le 8.944 \le 10. ✓
    • Nuclear soft-thresholding with λ=3\lambda = 3: σ↦(35−3,0)≈(3.708,0)\sigma \mapsto (3\sqrt5 - 3, 0) \approx (3.708, 0), a rank-one matrix.
    Quick check

    For A=(3045)A = \begin{pmatrix} 3 & 0 \\ 4 & 5 \end{pmatrix}, ∥A∥∞=9\|A\|_\infty = 9. Which vector xx with ∥x∥∞=1\|x\|_\infty = 1 reaches ∥Ax∥∞=9\|Ax\|_\infty = 9?

    5. In code #

    The libraries confirm the numbers. The notebook for this lesson has these cells and the exercises.

    import numpy as np
    import torch
    from sklearn.linear_model import Lasso, Ridge
    
    x = np.array([1.0, -2.0, 2.0])
    print([float(np.linalg.norm(x, p)) for p in (1, 2, np.inf)])   # [5.0, 3.0, 2.0]
    
    A = np.array([[3.0, 0.0], [4.0, 5.0]])
    print(np.linalg.svd(A, compute_uv=False))                      # [6.708 2.236] = 3√5, √5
    print([round(float(np.linalg.norm(A, o)), 3) for o in (2, "fro", "nuc", 1, np.inf)])
    # [6.708, 7.071, 8.944, 7.0, 9.0]: spectral, Frobenius, nuclear, max column sum, max row sum
    
    # The spectral norm is the largest stretch: random directions never beat v1 = (1,1)/√2.
    rng = np.random.default_rng(0)
    Z = rng.standard_normal((2, 10_000))
    print((np.linalg.norm(A @ Z, axis=0) / np.linalg.norm(Z, axis=0)).max())   # just below 6.708
    
    # Soft-thresholding versus ridge, lambda = 1
    z = np.array([3.0, 0.5, -1.5])
    print(np.sign(z) * np.maximum(np.abs(z) - 1, 0), z / 2)       # [ 2.  0.  -0.5] [ 1.5  0.25 -0.75]
    
    # ℓ1 gives exact zeros, ℓ2 does not (3 true nonzeros out of 20).
    X = rng.standard_normal((50, 20))
    w_true = np.zeros(20)
    w_true[:3] = [2.0, -3.0, 1.5]
    y = X @ w_true + 0.1 * rng.standard_normal(50)
    print((Lasso(alpha=0.1).fit(X, y).coef_ == 0).sum(),     # 17: exactly the 17 unused features
          (Ridge(alpha=1.0).fit(X, y).coef_ == 0).sum())     # 0
    
    # Spectral normalization: W / σ̂1, with σ̂1 from one power-iteration step per forward pass.
    torch.manual_seed(0)
    layer = torch.nn.utils.parametrizations.spectral_norm(torch.nn.Linear(64, 32))
    xb = torch.randn(8, 64)
    for _ in range(50):                  # training mode: each call refines σ̂1
        layer(xb)
    print(torch.linalg.matrix_norm(layer.weight.detach(), ord=2).item())   # ≈ 1.0
    

    6. Where it shows up #

    • Sparse models. Lasso and compressed sensing (exact recovery of a sparse signal from few random measurements by minimizing ∥x∥1\|x\|_1). In science: sparse regression of governing equations (SINDy), sparse sensor placement.
    • Low rank. Matrix completion, robust PCA (low rank + sparse), low-rank regularization of weights. The nuclear norm is the convex tool; LoRA instead bounds the rank (≤r\le r) by construction.
    • Lipschitz control. Spectral normalization in GAN discriminators; Lipschitz bounds for robustness certificates and for stable long rollouts of learned time-stepping models.
    • Error budgets. Compress a weight matrix to rank kk: the spectral error is σk+1\sigma_{k+1} (worst-case output change for a unit input); the squared Frobenius error ∑j>kσj2\sum_{j>k}\sigma_j^2 is the mean squared output change E∥(A−Ak)x∥2\mathbb{E}\|(A - A_k)x\|^2 for x∼N(0,I)x \sim \mathcal{N}(0, I).
    • Numerical analysis. Condition numbers κ(A)=∥A∥∥A−1∥\kappa(A) = \|A\|\|A^{-1}\| and error bounds (lesson 13); ∥A∥1\|A\|_1 and ∥A∥∞\|A\|_\infty are cheap, ∥A∥2\|A\|_2 needs the SVD or power iteration.

    7. Common mistakes #

    • Forgetting definiteness (∥x∥=0⇒x=0\|x\| = 0 \Rightarrow x = 0) when checking the norm axioms.
    • Calling "ℓ0\ell_0" or ℓ1/2\ell_{1/2} a norm. "ℓ0\ell_0" fails homogeneity; ℓ1/2\ell_{1/2} fails the triangle inequality.
    • Confusing the matrix 2-norm with the Frobenius norm. np.linalg.norm(A) on a matrix returns the Frobenius norm; the spectral norm needs ord=2.
    • Thinking the spectral norm is the largest entry. (1111)\begin{pmatrix}1&1\\1&1\end{pmatrix} has entries ≤1\le 1 but ∥⋅∥2=2\|\cdot\|_2 = 2.
    • Mixing up rows and columns in ∥A∥1\|A\|_1 and ∥A∥∞\|A\|_\infty. ∥A∥1\|A\|_1 uses column sums (the maximizer is eje_j); ∥A∥∞\|A\|_\infty uses row sums (the maximizer is a sign vector).
    • Overflow in ∑xi2\sqrt{\sum x_i^2}. For x=(10200,10200)x = (10^{200}, 10^{200}) the squares overflow to inf. Scale by max⁡i∣xi∣\max_i|x_i| first (the way BLAS nrm2 avoids it).
    • Treating ∏l∥Wl∥2\prod_l \|W_l\|_2 as the true Lipschitz constant. It is an upper bound, often loose (the 2-layer example: bound 4, true value 1).

    8. Check yourself #

    1. Give ∥x∥1,∥x∥2,∥x∥∞\|x\|_1, \|x\|_2, \|x\|_\infty for x=(2,−1,0,2)x = (2, -1, 0, 2).
      Answer55, 33, 22.
    2. AA has singular values 4,3,04, 3, 0. Give ∥A∥2\|A\|_2, ∥A∥F\|A\|_F, ∥A∥∗\|A\|_* and ∥A∥S3\|A\|_{S_3}.
      Answer44; 16+9=5\sqrt{16 + 9} = 5; 77; (64+27)1/3=911/3≈4.498(64 + 27)^{1/3} = 91^{1/3} \approx 4.498.
    3. Why is the minimizer of 12(x−z)2+λ∣x∣\tfrac12(x - z)^2 + \lambda|x| exactly zero for ∣z∣≤λ|z| \le \lambda?
      AnswerAt x=0x = 0 the left slope is −z−λ≤0-z - \lambda \le 0 and the right slope is −z+λ≥0-z + \lambda \ge 0: the convex function goes down into the kink and up after it. In subgradient form: 0∈(x−z)+λ ∂∣x∣0 \in (x - z) + \lambda\,\partial|x| at x=0x = 0 reads z∈[−λ,λ]z \in [-\lambda, \lambda].
    4. A 3-layer ReLU network has weight matrices with spectral norms 22, 0.50.5, 33. Give an upper bound on its Lipschitz constant (in ℓ2\ell_2). Is it attained in general?
      Answer2⋅0.5⋅3=32 \cdot 0.5 \cdot 3 = 3. Not in general: it needs the top singular directions of consecutive layers to line up, and ReLU to pass them unchanged.
    5. Show ∥A∥2≤∥A∥F≤r ∥A∥2\|A\|_2 \le \|A\|_F \le \sqrt r\,\|A\|_2, and say when each side is an equality.
      Answerσ12≤∑i≤rσi2≤rσ12\sigma_1^2 \le \sum_{i\le r}\sigma_i^2 \le r\sigma_1^2. Left equality iff rank ≤1\le 1; right equality iff all rr nonzero singular values are equal (e.g. an orthogonal matrix, r=nr = n).
    6. Compute ∥A∥1\|A\|_1 and ∥A∥∞\|A\|_\infty for A=(2−1−30)A = \begin{pmatrix} 2 & -1 \\ -3 & 0 \end{pmatrix}, and give a maximizing xx for each.
      AnswerColumn sums 55 and 11: ∥A∥1=5\|A\|_1 = 5 at x=e1x = e_1, Ae1=(2,−3)Ae_1 = (2, -3). Row sums 33 and 33: ∥A∥∞=3\|A\|_\infty = 3, for example at the signs of row 1, x=(1,−1)x = (1, -1): Ax=(3,−3)Ax = (3, -3).
    Recall cardsAnswer in your head first, then reveal. Add the cards to your review deck to see them again just before you would forget.
    1. What three rules make a function ∥⋅∥\|\cdot\| a norm?

    2. Why is ∥x∥1/2=(∑i∣xi∣1/2)2\|x\|_{1/2} = (\sum_i |x_i|^{1/2})^2 not a norm?

    3. Why does an ℓ1\ell_1 penalty give exact zeros, while an ℓ2\ell_2 penalty does not?

    4. Give the soft-thresholding formula Sλ(z)S_\lambda(z).

    5. Compute S1(z)S_1(z) for z=(3,0.5,−1.5)z = (3, 0.5, -1.5).

    6. What is ∥A∥2\|A\|_2 in terms of the SVD, and which xx reaches it?

    7. Write ∥A∥F2\|A\|_F^2 in three ways.

    8. What are the induced norms ∥A∥1\|A\|_1 and ∥A∥∞\|A\|_\infty?

    9. What is the nuclear norm, and why is it used?

    10. What is the Lipschitz constant of x↦Wxx \mapsto Wx, and what bound holds for a ReLU network?

    Open the review →

    9. Interview angle #

    • "Why does L1 regularization give sparse solutions?" — Corners of the ℓ1\ell_1 ball on the axes; soft-thresholding sets small coefficients exactly to 0; ∣x∣|x| keeps slope at 0.
    • "What is the spectral norm and why do we care in deep learning?" — σ1\sigma_1, the maximum stretch, the Lipschitz constant of a linear layer; spectral normalization, stability.
    • "Spectral vs Frobenius vs nuclear?" — ℓ∞\ell_\infty, ℓ2\ell_2, ℓ1\ell_1 of the singular values: worst case, total energy, convex surrogate for rank.
    • "Is the Frobenius norm an operator norm?" — No: ∥I∥F=n≠1\|I\|_F = \sqrt n \neq 1.

    10. Practice #

    The notebook for this lesson runs in Colab. It has five exercises, each with a check cell and a folded solution:

    1. Write an overflow-safe ℓp\ell_p norm (including p=∞p = \infty) and plot the unit balls.
    2. Find the minimum-ℓ1\ell_1 and minimum-ℓ2\ell_2 points on a hyperplane a⊤x=ba^\top x = b (Theorem 1).
    3. Write soft-thresholding, then use it in ISTA to solve a lasso problem and compare with scikit-learn.
    4. Compute the spectral, Frobenius, nuclear, Schatten and induced 1 and ∞ norms of a matrix.
    5. Recover a sparse vector from few measurements by minimizing ∥x∥1\|x\|_1 with a linear program, and compare with the minimum-ℓ2\ell_2 solution.

    The notebook also estimates σ1\sigma_1 by power iteration, the step inside spectral normalization.

    11. Watch and read #

    Open on YouTube · the player loads from youtube-nocookie.com when you press play
    Open on YouTube · the player loads from youtube-nocookie.com when you press play