21.4 Spectra in Practice

In Section 21.3, our matrices were small enough to factor by hand, and their eigenvalues delivered on every promise: the surfer's error shrank by 1/41/4 at every click, just as the second eigenvalue predicted. Outside textbook examples, both comforts vanish. The link matrix of the web has billions of rows, so nobody writes down its characteristic polynomial or computes a full eigendecomposition. Even when eigenvalues are known, they promise less than they appear to. A Jordan block whose eigenvalues are both 0.990.99 still grew to norm 37 before decaying (Section 21.3.1.5), and backpropagation through a recurrent network multiplies a gradient by fifty different matrices rather than applying one matrix fifty times.

This section takes up those two problems in turn. First, what can we learn about the eigenvalues of a matrix that is far too large to factor? Surprisingly much: the entries alone confine all eigenvalues to a few discs in the complex plane, and repeated matrix--vector multiplication, the one operation that remains cheap at scale, finds the largest eigenvalue and its eigenvector. That is how PageRank was originally computed. Second, what do eigenvalues leave unsaid about a finite number of steps, or about a product of changing matrices? Here the answer is sobering. Eigenvalues govern the long-run behavior of powers of a single matrix; for anything else we need matrix norms, and ultimately the singular values of Section 21.5.

Not every topic below carries the same weight in deep learning, and it helps to know where to focus. Three ideas recur throughout the book. Power iteration (Section 21.4.1.2) estimates the largest stretch of a layer, which is the workhorse behind spectral normalization (Section 21.5.4.3). Transient growth and products of Jacobians (Section 21.4.2.3, Section 21.4.2.5) supply the mathematics behind the exploding and vanishing gradients of Section 8.5. And the random matrices of Section 21.4.2.6 model the weight matrices of Section 4.4 at initialization. Gershgorin's theorem and PageRank are classical highlights that appear less often in deep learning, so a reader in a hurry may skim both; pseudospectra (Section 21.4.2.4) are a specialized diagnostic that can likewise be skipped on a first reading. All numerical examples below use NumPy.

import numpy as np

21.4.1 Locating and Computing Eigenvalues#

21.4.1.1 Gershgorin Discs#

Can we tell roughly where the eigenvalues of a matrix lie without ever computing them? For a diagonal matrix, the eigenvalues are simply the diagonal entries. Intuition suggests that if the off-diagonal entries are small, the eigenvalues should stay close to those diagonal entries. The following theorem makes that intuition exact, and its proof takes only three lines.

Theorem (Gershgorin (Gershgorin, 1931)). Let A=(aij)\mathbf{A}=(a_{ij}) be any n×nn\times n matrix, and for each row ii let ri=∑j≠i∣aij∣r_i=\sum_{j\neq i}|a_{ij}| be the sum of the absolute values of its off-diagonal entries. Let Di\mathcal{D}_i be the closed disc in the complex plane with centre aiia_{ii} and radius rir_i. Then every eigenvalue of A\mathbf{A} lies in the union ⋃iDi\bigcup_i\mathcal{D}_i.

Proof. Suppose Av=λv\mathbf{A}\mathbf{v}=\lambda\mathbf{v} with v≠0\mathbf{v}\neq\mathbf 0, and pick an index ii where v\mathbf{v} has its largest entry in magnitude, so that ∣vi∣≥∣vj∣|v_i|\ge|v_j| for all jj and vi≠0v_i\neq0. Reading off row ii of Av=λv\mathbf{A}\mathbf{v}=\lambda\mathbf{v} gives

∑jaijvj=λvi⟹(λ−aii) vi=∑j≠iaijvj.\sum_j a_{ij}v_j = \lambda v_i \quad\Longrightarrow\quad (\lambda - a_{ii})\,v_i = \sum_{j\neq i} a_{ij} v_j .

Dividing both sides by viv_i and taking absolute values, we use the fact that ∣vj/vi∣≤1|v_j/v_i|\le 1 for every jj:

∣λ−aii∣=∣∑j≠iaij vjvi∣≤∑j≠i∣aij∣=ri,|\lambda - a_{ii}| = \Bigl|\sum_{j\neq i} a_{ij}\,\tfrac{v_j}{v_i}\Bigr| \le \sum_{j\neq i} |a_{ij}| = r_i ,

which says that λ∈Di\lambda\in\mathcal{D}_i. ■\blacksquare

Notice what the proof actually tells us: each eigenvalue falls into the disc of the row where its eigenvector is largest. Because we do not know that row in advance, the theorem guarantees only that every eigenvalue lies somewhere in the union of all nn discs. To see this in action, consider the non-symmetric matrix

A=(410−140.50.501).(21.4.1)\mathbf A=\begin{pmatrix}4&1&0\\-1&4&0.5\\0.5&0&1\end{pmatrix}. \tag{21.4.1}

Its three discs have centres 44, 44, and 11, with radii 11, 1.51.5, and 0.50.5. The two discs centred at 44 overlap (in fact, one sits inside the other), whereas the disc centred at 11 is completely separated from them, because ∣4−1∣=3>1.5+0.5|4-1|=3>1.5+0.5. The actual eigenvalues are 3.99±0.96i3.99\pm0.96i and 1.031.03: the complex conjugate pair sits inside the two discs centred at 44, and the real eigenvalue sits inside the isolated disc centred at 11. Figure 21.4.1 displays the discs alongside the eigenvalues.

Figure 21.4.1:

Gershgorin discs of the 3×33\times3 matrix in the text (centres at the diagonal entries, radii given by the sums of the absolute off-diagonal entries in each row) and its eigenvalues (crosses). The two overlapping discs centred at 4 together hold two eigenvalues, the complex pair; the disjoint disc centred at 1 holds the third.

That split, with two eigenvalues in the overlapping pair and one in the isolated disc, is no accident. If a union of mm discs is connected and disjoint from all the remaining discs, it contains exactly mm eigenvalues, counted with multiplicity. The reason is continuity: as we scale the off-diagonal entries from zero up to their actual values, the eigenvalues start at the diagonal entries and move continuously, so they can never jump across the empty gap between separated groups of discs (Horn and Johnson, 2012). Let us verify the centres, radii, and eigenvalues numerically.

A = np.array([[4.0, 1.0, 0.0],
              [-1.0, 4.0, 0.5],
              [0.5, 0.0, 1.0]])
centres = np.diag(A)
radii = np.abs(A).sum(axis=1) - np.abs(centres)
print('centres:', centres, '  radii:', radii)
for z in np.linalg.eigvals(A):
    print(f'eigenvalue {z:.3f}   distances to the centres: '
          f'{np.abs(z - centres).round(2)}')
centres: [4. 4. 1.]   radii: [1.  1.5 0.5]
eigenvalue 3.987+0.961j   distances to the centres: [0.96 0.96 3.14]
eigenvalue 3.987-0.961j   distances to the centres: [0.96 0.96 3.14]
eigenvalue 1.025+0.000j   distances to the centres: [2.97 2.97 0.03]

Here the complex pair sits at distance 0.960.96 from 44, right near the rim of the inner disc of radius 11, showing that Gershgorin's bound can be nearly tight.

One immediate corollary requires no computation at all. If A\mathbf{A} is strictly diagonally dominant with positive diagonal entries, meaning aii>ria_{ii}>r_i for every ii, then every disc lies strictly in the open right half-plane. Zero cannot be an eigenvalue, so A\mathbf{A} is automatically invertible. If A\mathbf{A} is also symmetric, its eigenvalues are real and strictly positive, which makes it positive definite.

21.4.1.2 Power Iteration#

Gershgorin discs locate eigenvalues only roughly. What if we want an accurate eigenvalue of a matrix with a billion rows? Factoring such a matrix is out of the question, yet if it is sparse we can still multiply it by a vector cheaply. What happens if we start with a vector v0\mathbf{v}_0 and simply multiply by A\mathbf{A} over and over again?

The power expansion Akx=∑iciλikvi\mathbf{A}^k\mathbf{x} = \sum_i c_i\lambda_i^k\mathbf{v}_i of Section 21.3.1.3 gives the answer. Suppose A\mathbf{A} is diagonalizable with eigenvectors vi\mathbf{v}_i, ordered by the magnitude of their eigenvalues, and suppose the largest eigenvalue is strictly dominant, meaning ∣λ1∣>∣λ2∣≥⋯≥∣λn∣|\lambda_1|>|\lambda_2|\ge\cdots\ge|\lambda_n|. (When A\mathbf{A} is real, strict dominance forces λ1\lambda_1 to be real as well, because a complex eigenvalue would share its modulus with its complex conjugate.) Expanding v0=∑icivi\mathbf{v}_0=\sum_i c_i\mathbf{v}_i and factoring out λ1k\lambda_1^k yields

Akv0=∑i=1nciλikvi=λ1k(c1v1+∑i≥2ci(λiλ1)kvi).(21.4.2)\mathbf{A}^k\mathbf{v}_0 = \sum_{i=1}^{n} c_i\lambda_i^k\mathbf{v}_i = \lambda_1^k\Bigl(c_1\mathbf{v}_1 + \sum_{i\ge2} c_i\Bigl(\tfrac{\lambda_i}{\lambda_1}\Bigr)^{k}\mathbf{v}_i\Bigr). \tag{21.4.2}

Every ratio ∣λi/λ1∣|\lambda_i/\lambda_1| for i≥2i\ge 2 is strictly less than 11, so every trailing term vanishes as kk grows. Provided c1≠0c_1\neq 0, the bracket converges to c1v1c_1\mathbf{v}_1. Thus the direction of Akv0\mathbf{A}^k\mathbf{v}_0 approaches the dominant eigenvector v1\mathbf{v}_1 with an error decaying like ∣λ2/λ1∣k|\lambda_2/\lambda_1|^k, while its length scales by a factor approaching ∣λ1∣|\lambda_1| at each step. To keep the entries from overflowing or underflowing, we normalize the vector back to unit length after every multiplication; this simple loop is power iteration (Golub and Van Loan, 1996). When A\mathbf{A} is symmetric, we can do even better for the eigenvalue itself: the Rayleigh quotient of the current iterate converges to λ1\lambda_1 at the squared rate ∣λ2/λ1∣2k|\lambda_2/\lambda_1|^{2k}. Because the eigenvectors of a symmetric matrix are orthogonal, a directional misalignment of size δ\delta shifts the Rayleigh quotient only by O(δ2)O(\delta^2) (Exercise 2).

We can see both rates in a concrete 2×22\times 2 example. In Section 1.3, we computed the iterates of S=(2112)\mathbf{S}=\left(\begin{smallmatrix}2&1\\1&2\end{smallmatrix}\right) starting from e1\mathbf{e}_1: (2,1)(2,1), (5,4)(5,4), (14,13)(14,13), and in general ((3k+1)/2, (3k−1)/2)\bigl((3^k+1)/2,\,(3^k-1)/2\bigr). In terms of the unit eigenvectors v1=(1,1)/2\mathbf{v}_1=(1,1)/\sqrt2 and v2=(1,−1)/2\mathbf{v}_2=(1,-1)/\sqrt2, we have e1=(v1+v2)/2\mathbf{e}_1=(\mathbf{v}_1+\mathbf{v}_2)/\sqrt2, so

Ske1=3kv1+v22,tan⁡∠(Ske1,v1)=3−k,3−R(Ske1)=29k+1.\mathbf S^k\mathbf e_1=\frac{3^k\mathbf v_1+\mathbf v_2}{\sqrt2}, \qquad \tan\angle(\mathbf S^k\mathbf e_1,\mathbf v_1)=3^{-k}, \qquad 3-R(\mathbf S^k\mathbf e_1)=\frac{2}{9^k+1}.

With ∣λ2/λ1∣=1/3|\lambda_2/\lambda_1|=1/3, the directional error drops by a factor of 33 at every step: the sine of the angle to v1\mathbf{v}_1 is 0.3160.316, 0.1100.110, and 0.0370.037 for k=1,2,3k=1,2,3. Meanwhile the Rayleigh-quotient error drops by a factor of 99 per step: 0.20.2, 0.0240.024, and 0.00270.0027. Figure 21.4.2 plots both curves on a logarithmic scale.

Figure 21.4.2:

Power iteration on S=(2112)\mathbf S=\left(\begin{smallmatrix}2&1\\1&2\end{smallmatrix}\right) starting from e1\mathbf e_1. The direction error drops by a factor of 3 per step, whereas the eigenvalue estimate improves by a factor of 9 per step, the squared rate that comes from orthogonal eigenvectors. Dashed lines show 3−k3^{-k} and 2⋅9−k2\cdot9^{-k}.

When can power iteration fail? Two assumptions in (21.4.2) matter. First, the starting vector needs a nonzero component along v1\mathbf{v}_1 (c1≠0c_1\neq 0); choosing v0\mathbf{v}_0 at random guarantees this with probability one. Second, the largest eigenvalue must be strictly dominant. If the largest modulus is shared by a complex conjugate pair, the dominant component of the iterate rotates indefinitely instead of settling on a single line. The ratio of consecutive norms then oscillates forever, just as it did for the running matrix of Section 21.3.1.6. Even in that case, however, the geometric average ∥Akv0∥1/k\|\mathbf A^k\mathbf v_0\|^{1/k} still converges to the largest modulus.

Matrices with strictly positive entries avoid this trouble altogether: as we will see in Section 21.4.1.3, the Perron--Frobenius theorem guarantees a real, simple, strictly dominant eigenvalue. Let us test this by running 200 steps of power iteration on a random 5×55\times 5 matrix with entries drawn uniformly from [0,1][0,1], starting from a random vector, and comparing the final norm ratio with the true largest eigenvalue modulus.

A = np.random.rand(5, 5)                 # positive entries
v = np.random.randn(5)
for _ in range(200):
    Av = A @ v
    ratio = np.linalg.norm(Av) / np.linalg.norm(v)
    v = Av / np.linalg.norm(Av)
mods = np.sort(np.abs(np.linalg.eigvals(A)))[::-1]
print(f'norm ratio after 200 steps = {ratio:.10f}')
print(f'largest |eigenvalue|       = {mods[0]:.10f}')
print(f'|lambda_2| / |lambda_1|    = {mods[1] / mods[0]:.3f}')
norm ratio after 200 steps = 2.5254088042
largest |eigenvalue|       = 2.5254088042
|lambda_2| / |lambda_1|    = 0.299

On every draw, the norm ratio matches the largest eigenvalue modulus to all printed digits. To see how typical this fast convergence is, let us compute the gap ratio ∣λ2/λ1∣|\lambda_2/\lambda_1| across 10,000 such positive matrices. For comparison, we also draw 10,000 matrices with standard Gaussian entries, which have no positivity guarantee, and measure how often their dominant eigenvalues form a complex conjugate pair.

mods = np.sort(np.abs(np.linalg.eigvals(np.random.rand(10000, 5, 5))), axis=1)
print('uniform entries, gap ratio |lambda_2| / |lambda_1|, 5% and 95% quantiles:',
      np.quantile(mods[:, -2] / mods[:, -1], [0.05, 0.95]).round(2))
lam = np.linalg.eigvals(np.random.randn(10000, 5, 5))
top = lam[np.arange(10000), np.abs(lam).argmax(axis=1)]   # a dominant eigenvalue
print('Gaussian entries, fraction with a complex dominant pair:',
      np.mean(top.imag != 0).round(2))
uniform entries, gap ratio |lambda_2| / |lambda_1|, 5% and 95% quantiles: [0.14 0.37]
Gaussian entries, fraction with a complex dominant pair: 0.43

For uniform positive entries, the gap ratio falls between roughly 0.140.14 and 0.370.37 in nine draws out of ten, so 200 iterations drive the direction error far below floating-point precision. For Gaussian entries, by contrast, about four draws in ten have a complex dominant pair, and on those matrices the norm ratio never settles.

21.4.1.3 PageRank#

For matrices with non-negative entries, the dominant eigenvector is often the very object we care about, and power iteration is how we compute it. To state when that eigenvector is unique and well behaved, call a non-negative matrix irreducible if, in the directed graph that places an edge j→ij\to i whenever aij>0a_{ij}>0, every node can reach every other node. The Perron--Frobenius theorem (Horn and Johnson, 2012) guarantees that any irreducible non-negative matrix has a real, positive eigenvalue equal to the largest modulus among all its eigenvalues, that this eigenvalue is simple, and that its eigenvector can be chosen with strictly positive entries. If every entry of the matrix is strictly positive, this eigenvalue is also strictly dominant, meaning every other eigenvalue has strictly smaller modulus.

Google's original PageRank algorithm (Brin and Page, 1998) turns web ranking into exactly such an eigenvector problem. Consider a miniature web of three pages with links 1→21\to2, 2→12\to1, and 2→32\to3. A random surfer follows an outgoing link chosen uniformly at random. Page 33 has no outgoing links, so we repair that dead end by letting the surfer jump from page 33 to any page with equal probability. The repaired transition matrix P\mathbf{P} is column-stochastic, with column jj holding the click probabilities out of page jj:

P=(01213101301213).\mathbf P=\begin{pmatrix}0&\tfrac12&\tfrac13\\1&0&\tfrac13\\0&\tfrac12&\tfrac13\end{pmatrix}.

In the long run, the fraction of time the surfer spends on each page is the stationary distribution π\boldsymbol{\pi} satisfying Pπ=π\mathbf{P}\boldsymbol{\pi}=\boldsymbol{\pi}. We can solve this by hand: rows 11 and 33 both give π1=12π2+13π3=π3\pi_1=\tfrac12\pi_2+\tfrac13\pi_3=\pi_3, and substituting π1=π3\pi_1=\pi_3 back into row 11 gives π2=43π3\pi_2=\tfrac43\pi_3. Normalizing the entries to sum to 11 yields π=(0.3,0.4,0.3)\boldsymbol{\pi}=(0.3,0.4,0.3). Page 22 ranks first because page 11 sends it all of its clicks, whereas page 22 splits its clicks between pages 11 and 33. The eigenvalues of P\mathbf{P} are 11, −23-\tfrac23, and 00, so power iteration from any initial distribution converges at the rate 2/32/3 per step.

In fact, every column-stochastic matrix has 11 as an eigenvalue of largest modulus. First, because every column sums to 11, we have 1⊤P=1⊤\mathbf{1}^\top\mathbf{P}=\mathbf{1}^\top, which means 11 is an eigenvalue of P⊤\mathbf{P}^\top, and therefore also of P\mathbf{P} (a matrix and its transpose share the same characteristic polynomial, because det⁡X⊤=det⁡X\det\mathbf{X}^\top=\det\mathbf{X}). Second, applying Gershgorin's theorem to P⊤\mathbf{P}^\top, whose rows are the columns of P\mathbf{P}, places every eigenvalue inside a disc with centre pii≥0p_{ii}\ge 0 and radius 1−pii1-p_{ii}; every such disc sits inside the unit disc.

The real web, however, is messier than our three-page example: it contains link cycles and isolated pockets of pages from which a surfer cannot escape. The repaired matrix P\mathbf{P} can then fail to be irreducible or can have several eigenvalues of modulus 11. For instance, a simple cycle of four pages has eigenvalues ±1\pm 1 and ±i\pm i, so undamped power iteration on it never settles (Exercise 4). PageRank solves both problems at once by iterating the damped matrix

G=αP+(1−α)1n11⊤,α=0.85,\mathbf G=\alpha\mathbf P+(1-\alpha)\tfrac1n\mathbf 1\mathbf 1^\top, \qquad \alpha=0.85,

which describes a surfer who follows a random link with probability 0.850.85 and teleports to a uniformly random page with probability 0.150.15. Because every entry of G\mathbf{G} is strictly positive, the Perron--Frobenius theorem applies by construction. Better still, Haveliwala and Kamvar (2003) show that ∣λ2(G)∣≤α|\lambda_2(\mathbf{G})|\le\alpha, so the error of power iteration shrinks by at least a factor of 0.850.85 at every step, no matter how tangled the link graph is. That single bound made web-scale PageRank practical: fifty sweeps cut the error by more than a factor of 30003000 (0.8550≈3×10−40.85^{50}\approx 3\times 10^{-4}), regardless of how many billions of pages are in the graph.

At web scale, P\mathbf{P} is stored sparsely as one entry per link, and the dense matrix G\mathbf{G} is never formed explicitly. For any probability vector p\mathbf{p} (where 1⊤p=1\mathbf{1}^\top\mathbf{p}=1), we can evaluate Gp=αPp+(1−α)1n1\mathbf{G}\mathbf{p}=\alpha\mathbf{P}\mathbf{p}+(1-\alpha)\tfrac1n\mathbf{1} using just one sparse matrix--vector product plus a constant shift. The dead-end repair for pages with no outgoing links is a rank-one term handled in the same way.

21.4.2 Iteration and Stability#

21.4.2.1 The Spectral Radius#

Power iteration singled out one number: the largest eigenvalue modulus. That number is called the spectral radius, ρ(A)=max⁡i∣λi∣\rho(\mathbf{A})=\max_i|\lambda_i|, and it governs the long-run growth rate of the powers of a single fixed matrix. Gelfand's formula makes this exact: for every square matrix A\mathbf{A} and every matrix norm,

lim⁡k→∞∥Ak∥1/k=ρ(A).\lim_{k\to\infty}\|\mathbf A^k\|^{1/k}=\rho(\mathbf A).

The easier half of this statement, ρ(A)≤∥Ak∥1/k\rho(\mathbf{A})\le\|\mathbf{A}^k\|^{1/k} for every k≥1k\ge 1, is Exercise 1.

What Gelfand's formula does not tell us is what happens at any fixed, finite step kk, and we have already met two matrices where that gap matters. The shear T=(1101)\mathbf{T}=\left(\begin{smallmatrix}1&1\\0&1\end{smallmatrix}\right) has ρ(T)=1\rho(\mathbf{T})=1, yet its powers Tk=(1k01)\mathbf{T}^k=\left(\begin{smallmatrix}1&k\\0&1\end{smallmatrix}\right) grow without bound, so ρ≤1\rho\le 1 does not even keep the iterates bounded. The Jordan block J2(0.99)\mathbf{J}_2(0.99) has ρ<1\rho\lt 1 and must eventually decay to zero, yet its powers climb to norm 3737 before turning downward, so ρ<1\rho\lt 1 does not rule out large transient growth. When, then, do the eigenvalues control every step rather than only the distant limit?

21.4.2.2 Normal Matrices#

Both of our counterexamples, the shear and the Jordan block, are defective: they lack enough eigenvectors to form a basis. Let us go straight to the opposite extreme and consider matrices that admit an orthonormal basis of eigenvectors. Such a matrix acts independently along mutually perpendicular directions, so its eigenvalues ought to tell the whole story at every step.

A real matrix is called normal if it commutes with its transpose, A⊤A=AA⊤\mathbf{A}^\top\mathbf{A}=\mathbf{A}\mathbf{A}^\top (for a complex matrix, we replace the transpose by the conjugate transpose A∗\mathbf{A}^*, requiring A∗A=AA∗\mathbf{A}^*\mathbf{A}=\mathbf{A}\mathbf{A}^*). Symmetric matrices, orthogonal matrices, and the rotation--scaling blocks rRθr\mathbf{R}_\theta of Section 21.3.1.6 are all normal. By contrast, our running example A=(12−13)\mathbf{A}=\left(\begin{smallmatrix}1&2\\-1&3\end{smallmatrix}\right) is not normal: AA⊤=(55510)\mathbf{A}\mathbf{A}^\top=\left(\begin{smallmatrix}5&5\\5&10\end{smallmatrix}\right), whereas A⊤A=(2−1−113)\mathbf{A}^\top\mathbf{A}=\left(\begin{smallmatrix}2&-1\\-1&13\end{smallmatrix}\right). That failure to commute is the reason its iterates spiraled along ellipses rather than circles.

The complex spectral theorem (Horn and Johnson, 2012) characterizes this class completely: a matrix is normal if and only if it has an orthonormal eigenbasis over C\mathbb{C}, meaning A=UΛU∗\mathbf{A}=\mathbf{U}\boldsymbol{\Lambda}\mathbf{U}^* with U\mathbf{U} unitary (U∗U=I\mathbf{U}^*\mathbf{U}=\mathbf{I}). The proof follows the same inductive argument as the real spectral theorem in Section 21.3.2.1.

To measure the worst-case amplification in a single step, write ∥X∥2=max⁡∥x∥=1∥Xx∥\|\mathbf{X}\|_2=\max_{\|\mathbf{x}\|=1}\|\mathbf{X}\mathbf{x}\| for the spectral norm of X\mathbf{X}, the largest factor by which X\mathbf{X} can stretch a vector. Because a unitary change of basis preserves Euclidean lengths, every power of a normal matrix satisfies

∥Ak∥2=∥UΛkU∗∥2=max⁡i∣λi∣k=ρ(A)k.(21.4.3)\|\mathbf A^k\|_2 =\|\mathbf U\boldsymbol\Lambda^k\mathbf U^*\|_2 =\max_i|\lambda_i|^k =\rho(\mathbf A)^k . \tag{21.4.3}

For a normal matrix, the eigenvalues control the worst-case amplification at every single step kk, not just asymptotically.

What happens when A\mathbf{A} is diagonalizable, A=VΛV−1\mathbf{A}=\mathbf{V}\boldsymbol{\Lambda}\mathbf{V}^{-1}, but not normal? Now the eigenvector matrix V\mathbf{V} is no longer orthogonal, and submultiplicativity of the spectral norm gives only the upper bound

∥Ak∥2≤∥V∥2∥V−1∥2⏟κ2(V)ρ(A)k.(21.4.4)\|\mathbf A^k\|_2 \le \underbrace{\|\mathbf V\|_2\|\mathbf V^{-1}\|_2}_{\kappa_2(\mathbf V)} \rho(\mathbf A)^k . \tag{21.4.4}

The prefactor κ2(V)\kappa_2(\mathbf{V}) is the condition number (Section 21.5.3.2) of the eigenvector matrix. It equals 11 when the eigenvectors are orthogonal, and grows arbitrarily large when two eigenvectors point in nearly the same direction. The transient growth it permits has a clean geometric cause: cancellation. When eigenvectors are nearly parallel, an ordinary unit vector can only be expressed as a combination of huge eigen-components that nearly cancel each other out. As we apply A\mathbf{A} repeatedly, those components decay at different rates, the delicate cancellation comes undone, and the iterate balloons in length before the common exponential decay finally takes over.

21.4.2.3 Transient Growth#

The simplest matrix that displays this transient growth is the upper-triangular 2×22\times 2 matrix

M=(0.9400.8).(21.4.5)\mathbf M=\begin{pmatrix}0.9&4\\0&0.8\end{pmatrix}. \tag{21.4.5}

Its eigenvalues are its diagonal entries 0.90.9 and 0.80.8. Both lie safely inside the unit circle, and because they are distinct, M\mathbf{M} is diagonalizable. Let us compute its eigenvectors by hand and expand the unit vector e2=(0,1)\mathbf{e}_2=(0,1) in them. For λ=0.9\lambda=0.9, the second row of M−0.9I\mathbf{M}-0.9\mathbf{I} reads −0.1v2=0-0.1v_2=0, giving v1=(1,0)\mathbf{v}_1=(1,0). For λ=0.8\lambda=0.8, the first row of M−0.8I\mathbf{M}-0.8\mathbf{I} reads 0.1v1+4v2=00.1v_1+4v_2=0, giving v2=(−40,1)\mathbf{v}_2=(-40,1). Notice how close these two directions are: the angle between them is only arctan⁡(1/40)≈1.4∘\arctan(1/40)\approx 1.4^\circ. Expanding e2\mathbf{e}_2 in this nearly parallel basis gives e2=40v1+v2\mathbf{e}_2=40\mathbf{v}_1+\mathbf{v}_2, and applying the eigenvector power expansion (Section 21.3.1.3) yields

Mke2=40⋅0.9k v1+0.8k v2=(40 (0.9k−0.8k)0.8k).(21.4.6)\mathbf M^k\mathbf e_2=40\cdot0.9^k\,\mathbf v_1+0.8^k\,\mathbf v_2 =\begin{pmatrix}40\,(0.9^k-0.8^k)\\0.8^k\end{pmatrix}. \tag{21.4.6}

At k=0k=0, a vector of length 11 is formed as the difference of two eigen-components of length roughly 4040. Both components decay at every step, yet because 0.8k0.8^k falls faster than 0.9k0.9^k, their cancellation unravels and the sum initially grows. The first coordinate 40(0.9k−0.8k)40(0.9^k-0.8^k) peaks where its derivative with respect to kk vanishes, namely where (9/8)k=ln⁡0.8/ln⁡0.9(9/8)^k=\ln 0.8/\ln 0.9, which occurs at k≈6.4k\approx 6.4 with a height of about 10.810.8. Figure 21.4.3 illustrates the two components at k=0k=0 and at k=6k=6. For comparison, the general bound (21.4.4) with unit eigenvectors has κ2(V)=80\kappa_2(\mathbf{V})=80 and predicts ∥M6∥2≤80⋅0.96≈42.5\|\mathbf{M}^6\|_2\le 80\cdot 0.9^6\approx 42.5. The bound holds, though it is conservative by a factor of four compared with the true peak of 10.810.8.

Figure 21.4.3:

Growth of Mke2\mathbf M^k\mathbf e_2 before decay. Left: at k=0k=0, the unit vector e2\mathbf e_2 is the difference of two eigen-components of length about 40 that nearly cancel. Right: six steps later the two components have decayed by 0.960.9^6 and 0.860.8^6, breaking the cancellation and producing a vector more than ten times longer. The vertical axis is stretched about 30-fold; drawn to scale, v1\mathbf v_1 and v2\mathbf v_2 are only 1.4∘1.4^\circ apart.

Let us check this calculation numerically and compare M\mathbf{M} against the diagonal matrix Λ=diag⁡(0.9,0.8)\boldsymbol{\Lambda}=\operatorname{diag}(0.9,0.8), which has the exact same eigenvalues but is normal.

M = np.array([[0.9, 4.0], [0.0, 0.8]])
Lam = np.diag([0.9, 0.8])                   # same eigenvalues, normal
lam, V = np.linalg.eig(M)                   # unit eigenvectors as columns
print('eigenvalues:', lam)
print('coefficients of e_2 on the unit eigenvectors:',
      np.linalg.solve(V, [0., 1.]))
ks = np.arange(61)
norm_M = [np.linalg.norm(np.linalg.matrix_power(M, k), 2) for k in ks]
norm_L = [np.linalg.norm(np.linalg.matrix_power(Lam, k), 2) for k in ks]
k_peak = int(np.argmax(norm_M))
print(f'max ||M^k|| = {norm_M[k_peak]:.3f} at k = {k_peak};  '
      f'max ||Lambda^k|| = {max(norm_L):.3f}')
print(f'kappa_2(V) = {np.linalg.cond(V):.1f}')
eigenvalues: [0.9 0.8]
coefficients of e_2 on the unit eigenvectors: [40.         40.01249805]
max ||M^k|| = 10.788 at k = 6;  max ||Lambda^k|| = 1.000
kappa_2(V) = 80.0

Expressed in the unit eigenvectors, e2\mathbf{e}_2 carries two coefficients of magnitude about 4040, matching the lengths of 40v140\mathbf{v}_1 and v2\mathbf{v}_2. The spectral norm ∥Mk∥2\|\mathbf{M}^k\|_2 climbs to 10.810.8 at k=6k=6, whereas ∥Λk∥2\|\boldsymbol{\Lambda}^k\|_2 never exceeds its starting value of 11. Even though both matrices share the same eigenvalues, the normal matrix contracts from the very first step while the non-normal matrix grows more than ten-fold before decaying. The left panel of Figure 21.4.4 plots both trajectories on a logarithmic scale; past the peak, both curves eventually descend with the same slope log⁡0.9\log 0.9, just as Gelfand's formula guarantees.

Figure 21.4.4:

Left: ∥Mk∥2\|\mathbf M^k\|_2 and ∥Λk∥2\|\boldsymbol\Lambda^k\|_2 for the same eigenvalues 0.9 and 0.8; M\mathbf M climbs to 10.8 at k=6k=6 before both curves decay with slope log⁡0.9\log 0.9. Right: the ε\varepsilon-pseudospectra for ε=0.05,0.1,0.2,0.4\varepsilon=0.05,0.1,0.2,0.4; around the normal matrix Λ\boldsymbol\Lambda they are simply discs of radius ε\varepsilon, whereas around M\mathbf M they bulge far past the unit circle.

21.4.2.4 Pseudospectra#

This subsection adds a diagnostic for non-normality rather than a new phenomenon, and may be skipped on a first pass. Beyond transient growth, a second symptom of non-normality is extreme sensitivity of the eigenvalues to small perturbations. To make that sensitivity visible, the ε\varepsilon-pseudospectrum collects every complex number that becomes an eigenvalue of A+E\mathbf{A}+\mathbf{E} for some perturbation E\mathbf{E} of spectral norm at most ε\varepsilon. Conveniently, the same set can be computed directly from the resolvent (zI−A)−1(z\mathbf{I}-\mathbf{A})^{-1}:

Λε(A)={z∈C:z is an eigenvalue of A+E for some ∥E∥2≤ε}={z∈C:∥(zI−A)−1∥2≥1/ε},(21.4.7)\begin{aligned} \Lambda_\varepsilon(\mathbf A) &=\{z\in\mathbb C:z\text{ is an eigenvalue of }\mathbf A+\mathbf E \text{ for some }\|\mathbf E\|_2\le\varepsilon\} \\ &=\{z\in\mathbb C:\|(z\mathbf I-\mathbf A)^{-1}\|_2\ge1/\varepsilon\}, \end{aligned} \tag{21.4.7}

where the resolvent norm is taken to be infinite at the eigenvalues of A\mathbf{A} itself. Proving the equivalence of these two descriptions is Exercise 3. For a normal matrix, the resolvent norm at zz is simply the reciprocal of the distance from zz to the nearest eigenvalue, so Λε(A)\Lambda_\varepsilon(\mathbf{A}) is just the union of discs of radius ε\varepsilon around the eigenvalues. For a non-normal matrix like M\mathbf{M}, the resolvent norm can be vastly larger, as we can check at z=1z=1 on the unit circle.

I = np.eye(2)
print(f'||(I - M)^-1||      = {np.linalg.norm(np.linalg.inv(I - M), 2):.1f}')
print(f'||(I - Lambda)^-1|| = {np.linalg.norm(np.linalg.inv(I - Lam), 2):.1f}')
||(I - M)^-1||      = 200.3
||(I - Lambda)^-1|| = 10.0

For Λ\boldsymbol{\Lambda} the resolvent norm is 1010, the reciprocal of the distance 0.10.1 from 11 to the eigenvalue 0.90.9. For M\mathbf{M} it jumps to 200.3200.3: a tiny perturbation of size 1/200.3≈0.0051/200.3\approx 0.005 already pushes an eigenvalue of M\mathbf{M} onto the unit circle, whereas Λ\boldsymbol{\Lambda} requires a perturbation twenty times larger, of size 0.10.1 (right panel of Figure 21.4.4). Because floating-point rounding acts like a small perturbation to the matrix entries, the numerically computed eigenvalues of a strongly non-normal matrix can be surprisingly inaccurate. Section 21.6 follows this thread further with the Kreiss matrix theorem.

21.4.2.5 Products of Jacobians#

So far we have multiplied a vector by the same matrix repeatedly. Recurrent neural networks (Section 8.5) break even that assumption. A recurrent layer updates its hidden state as ht=ϕ(Wht−1+⋯ )\mathbf{h}_t=\phi(\mathbf{W}\mathbf{h}_{t-1}+\cdots), using the same weight matrix W\mathbf{W} at every step, yet backpropagation through time multiplies the gradient by the sequence of per-step Jacobians Dt=∂ht/∂ht−1\mathbf{D}_t=\partial\mathbf{h}_t/\partial\mathbf{h}_{t-1}:

∇h0L=D1⊤D2⊤⋯DT⊤ ∇hTL.\nabla_{\mathbf{h}_0}\mathcal{L} = \mathbf{D}_1^\top\mathbf{D}_2^\top\cdots\mathbf{D}_T^\top \,\nabla_{\mathbf{h}_T}\mathcal{L}.

Because the nonlinearity ϕ\phi is evaluated at a different hidden state at each time step, the Jacobians D1,…,DT\mathbf{D}_1,\ldots,\mathbf{D}_T are different matrices, and the theory of powers of a single matrix no longer applies.

In fact, the spectral radii of the individual factors tell us nothing at all about their product. Consider the two 2×22\times 2 matrices

D1=(0200),D2=(0020),D2D1=(0004).\mathbf D_1=\begin{pmatrix}0&2\\0&0\end{pmatrix}, \qquad \mathbf D_2=\begin{pmatrix}0&0\\2&0\end{pmatrix}, \qquad \mathbf D_2\mathbf D_1=\begin{pmatrix}0&0\\0&4\end{pmatrix}.

Both D1\mathbf{D}_1 and D2\mathbf{D}_2 are nilpotent with ρ=0\rho=0, so every power of either matrix vanishes by the second step. Yet their product has ρ=4\rho=4: D1\mathbf{D}_1 copies the second coordinate into the first while doubling it, and D2\mathbf{D}_2 copies it straight back while doubling it again.

It is therefore helpful to keep three distinct quantities straight when studying iterated linear maps. The spectral radius gives the asymptotic growth rate of powers of one fixed matrix. The spectral norm bounds any finite product of changing matrices, because submultiplicativity gives ∥DT⋯D1∥2≤∏t∥Dt∥2\|\mathbf{D}_T\cdots\mathbf{D}_1\|_2\le\prod_t\|\mathbf{D}_t\|_2 (in our example, 4≤2⋅24\le 2\cdot 2). Finally, the top Lyapunov exponent

μ=lim⁡T→∞1Tlog⁡∥DT⋯D1x0∥\mu=\lim_{T\to\infty}\frac1T\log\|\mathbf D_T\cdots\mathbf D_1\mathbf x_0\|

measures the average logarithmic growth rate per step along a long product of changing matrices. When the factors are independent and identically distributed random matrices, this limit exists with probability one under mild conditions (Furstenberg and Kesten, 1960).

When a gradient passes backward through a sequence of Jacobians with μ>0\mu>0, it grows exponentially and explodes; when μ<0\mu\lt 0, it shrinks exponentially and vanishes (Bengio et al., 1994; Pascanu et al., 2013). Notice that the standard remedies in deep learning target norms and Jacobians rather than eigenvalues. Orthogonal initialization (Saxe et al., 2014) chooses an orthogonal weight matrix so that a linear recurrence preserves the Euclidean length of every vector at every step, a much stronger guarantee than ρ=1\rho=1. Gradient clipping caps the norm of the gradient directly after backpropagation. Gated architectures such as LSTMs and GRUs alter the Jacobians themselves, creating pathways along which selected directions pass through with factors close to 11 (Section 8.5.1.1).

21.4.2.6 Random Matrices at Initialization#

How large are the spectral radius and spectral norm for the random weight matrices of a freshly initialized neural network? Consider an n×nn\times n matrix A\mathbf{A} with independent standard Gaussian entries, known as the real Ginibre ensemble (Ginibre, 1965). As n→∞n\to\infty, the eigenvalues rescaled by 1/n1/\sqrt{n} spread uniformly over the unit disc in the complex plane. This is the circular law, which Tao and Vu (2010) proved in general for independent, identically distributed entries of mean 00 and variance 11. The circular law tells us where almost all eigenvalues live, though by itself it does not rule out a few stray outliers. A separate theorem establishes that no outlier escapes the unit circle, so ρ(A)/n→1\rho(\mathbf{A})/\sqrt{n}\to 1 with probability one (Geman, 1986).

The spectral norm behaves quite differently: ∥A∥2/n→2\|\mathbf{A}\|_2/\sqrt{n}\to 2 (Yin et al., 1988). This is a special case of the Marchenko--Pastur law (Section 21.3.2.4) at aspect ratio c=1c=1: the largest eigenvalue of 1nA⊤A\tfrac1n\mathbf{A}^\top\mathbf{A} converges to the upper edge (1+c)2=4(1+\sqrt{c})^2=4, and ∥A∥22\|\mathbf{A}\|_2^2 is simply nn times that eigenvalue. Even at n=1000n=1000, a single random draw sits right next to both asymptotic limits.

n = 1000
A = np.random.randn(n, n)
print(f'rho(A) / sqrt(n)       = {np.abs(np.linalg.eigvals(A)).max() / n ** 0.5:.3f}')
print(f'sigma_max(A) / sqrt(n) = {np.linalg.norm(A, 2) / n ** 0.5:.3f}')
rho(A) / sqrt(n)       = 1.030
sigma_max(A) / sqrt(n) = 1.990

At large nn, the spectral radius lands within a few percent of n\sqrt{n} while the largest stretch sits close to 2n2\sqrt{n}: a random Gaussian matrix stretches certain vectors twice as far as its eigenvalues would lead you to expect. Standard initialization schemes divide random weights by fan-in\sqrt{\textrm{fan-in}} for a different reason altogether. With entries of variance 1/n1/n, we get E∥Ax∥2=∥x∥2\mathbb{E}\|\mathbf{A}\mathbf{x}\|^2=\|\mathbf{x}\|^2 for every fixed vector x\mathbf{x}, so squared lengths are preserved on average. Having a spectral radius near 11 is merely a side effect, and as Section 21.4.2.5 showed, it does not control a product of different matrices. Surprisingly, a long product of independent matrices with this exact scaling shrinks a typical vector, giving μ<0\mu\lt 0, even though every individual factor preserves squared length on average. The reason is the concavity of the logarithm: for a unit vector x\mathbf{x}, the expectation of log⁡∥Ax∥2\log\|\mathbf{A}\mathbf{x}\|^2 lies strictly below the logarithm of the expectation of ∥Ax∥2\|\mathbf{A}\mathbf{x}\|^2 (which is log⁡1=0\log 1 = 0), and it is the logarithms that add up along a deep product (Exercise 5).

Both the non-normal matrix M\mathbf{M} and the random Gaussian matrix point to the same conclusion: eigenvalues tell us little about how much a matrix stretches vectors over a finite number of steps, and for rectangular matrices eigenvalues do not even exist. To measure stretching directly, for any matrix of any shape, we turn next to the singular values of Section 21.5.

21.4.3 Summary#

Even without factoring a matrix, Gershgorin discs locate its eigenvalues directly from its entries, and power iteration extracts the dominant eigenpair at the geometric rate ∣λ2/λ1∣|\lambda_2/\lambda_1|, the mechanism behind PageRank. The spectral radius ρ(A)\rho(\mathbf{A}) governs the long-run rate of powers of a single fixed matrix and nothing more: a non-normal matrix can grow dramatically before it decays, and the eigenvalues of individual factors reveal nothing about a product of changing matrices. For products of changing maps, the spectral norm bounds finite steps and the top Lyapunov exponent gives the average long-run rate. A random n×nn\times n Gaussian matrix at initialization makes the gap between eigenvalues and stretching concrete: its spectral radius is close to n\sqrt{n}, whereas its spectral norm is close to 2n2\sqrt{n}.

21.4.4 Exercises#

  1. Spectral radius and norms. The spectral radius bounds every power of a matrix from below, and for normal matrices it also bounds them from above.

    1. Show that ρ(A)≤∥Ak∥21/k\rho(\mathbf{A})\le\|\mathbf{A}^k\|_2^{1/k} for every square matrix A\mathbf{A} and every k≥1k\ge1.
    2. The chain (21.4.3) uses two facts without proof. Show that ∥UXU∗∥2=∥X∥2\|\mathbf{U}\mathbf{X}\mathbf{U}^*\|_2=\|\mathbf{X}\|_2 for every unitary U\mathbf{U} and every square X\mathbf{X}, and that the spectral norm of a diagonal matrix is the largest modulus of its diagonal entries.
    3. Show that the converse of (21.4.3) fails: find a 3×33\times3 matrix that is not normal but satisfies ∥Ak∥2=ρ(A)k\|\mathbf{A}^k\|_2=\rho(\mathbf{A})^k for every k≥1k\ge1.
    4. For a given t>0t>0, construct a diagonalizable 2×22\times2 matrix with spectral radius 1/21/2 and ∥A∥2>t\|\mathbf{A}\|_2>t.
  2. [code] Power-iteration rates. Let S\mathbf{S} be the matrix of Figure 21.4.2.

    1. By (21.4.2), the misalignment between the iterate and v1\mathbf{v}_1 decays at the rate ∣λ2/λ1∣=1/3|\lambda_2/\lambda_1|=1/3. How many iterations reduce it by a factor of 100100?
    2. Let A\mathbf{A} be symmetric with unit eigenvector v1\mathbf{v}_1 for λ1\lambda_1, and let x=v1+δu\mathbf{x}=\mathbf{v}_1+\delta\mathbf{u} for a unit vector u\mathbf{u} orthogonal to v1\mathbf{v}_1. Show that the Rayleigh quotient of Section 21.3.2.3 satisfies R(x)−λ1=O(δ2)R(\mathbf{x})-\lambda_1=O(\delta^2), with no term linear in δ\delta. At which rate does the Rayleigh quotient of the power iterates therefore approach λ1\lambda_1? Where does the argument use that A\mathbf A is symmetric?
    3. Repeat the experiment of Figure 21.4.2 for (10.10.11)\left(\begin{smallmatrix}1&0.1\\0.1&1\end{smallmatrix}\right), which has the same eigenvectors as S\mathbf S and the eigenvalues 1.1 and 0.9, from a random start. Plot the sine of the angle to v1\mathbf v_1 and the error of the Rayleigh quotient on a logarithmic scale for 30 steps. Predict both slopes and the number of steps each error needs to shrink by a factor of 100, and explain why this matrix converges so much more slowly than S\mathbf S.
  3. [code] Pseudospectra and transient growth. ● Let M\mathbf{M} be the non-normal matrix (21.4.5) and Λ=diag⁡(0.9,0.8)\boldsymbol\Lambda=\operatorname{diag}(0.9,0.8) the normal matrix with the same eigenvalues, as in Section 21.4.2.3.

    1. Prove the equality of the two sets in (21.4.7). First show that ∥(zI−A)−1∥2=1/σmin⁡(zI−A)\|(z\mathbf I-\mathbf A)^{-1}\|_2=1/\sigma_{\min}(z\mathbf I-\mathbf A), where σmin⁡(X)=min⁡∥x∥=1∥Xx∥\sigma_{\min}(\mathbf X)=\min_{\|\mathbf x\|=1}\|\mathbf X\mathbf x\|. For one inclusion, take unit vectors u\mathbf u, v\mathbf v with (zI−A)v=σu(z\mathbf{I}-\mathbf{A})\mathbf{v}=\sigma\mathbf{u}, σ=σmin⁡(zI−A)\sigma=\sigma_{\min}(z\mathbf I-\mathbf A), and show that zz is an eigenvalue of A+σuv∗\mathbf{A}+\sigma\mathbf{u}\mathbf{v}^*. For the other, apply (zI−A)x=Ex(z\mathbf I-\mathbf A)\mathbf x=\mathbf E\mathbf x to an eigenvector x\mathbf x of A+E\mathbf A+\mathbf E. Using the resolvent norms printed in Section 21.4.2.4, how large a perturbation makes z=1z=1 an eigenvalue of a perturbed M\mathbf{M}, and how large for Λ\boldsymbol\Lambda?
    2. Suppose that ∥Ak∥2≤K0\|\mathbf{A}^k\|_2\le K_0 for all k≥0k\ge0. Show that for ∣z∣>1|z|>1 the series ∑k≥0Ak/zk+1\sum_{k\ge0}\mathbf{A}^k/z^{k+1} converges to (zI−A)−1(z\mathbf{I}-\mathbf{A})^{-1}, and conclude that
sup⁡k≥0∥Ak∥2  ≥  K(A)=sup⁡∣z∣>1 (∣z∣−1) ∥(zI−A)−1∥2.\sup_{k\ge0}\|\mathbf{A}^k\|_2\;\ge\;K(\mathbf{A})=\sup_{|z|>1}\,(|z|-1)\,\|(z\mathbf{I}-\mathbf{A})^{-1}\|_2 .

The quantity K(A)K(\mathbf{A}) is called the Kreiss constant. Restate the bound in terms of pseudospectra: if Λε(A)\Lambda_\varepsilon(\mathbf{A}) contains a point at distance δ\delta outside the unit circle, how large must some power of A\mathbf{A} be?

  1. Evaluate K(M)K(\mathbf{M}) numerically on a grid of points zz with ∣z∣>1|z|>1, and compare it with the largest ∥Mk∥2\|\mathbf{M}^k\|_2 printed in Section 21.4.2.3. Find K(Λ)K(\boldsymbol\Lambda) by hand.
  1. [code] Damping in PageRank. ● Let P\mathbf{P} be a column-stochastic n×nn\times n matrix and G=αP+(1−α)1n11⊤\mathbf{G}=\alpha\mathbf{P}+(1-\alpha)\tfrac1n\mathbf{1}\mathbf{1}^\top with 0<α<10\lt \alpha\lt 1, the damped matrix of Section 21.4.1.3.

    1. Let Px=λx\mathbf{P}\mathbf{x}=\lambda\mathbf{x}. Show that 1⊤x=0\mathbf{1}^\top\mathbf{x}=0 whenever λ≠1\lambda\neq1, and that Gx=αλx\mathbf{G}\mathbf{x}=\alpha\lambda\mathbf{x} whenever 1⊤x=0\mathbf{1}^\top\mathbf{x}=0.
    2. The eigenvalue 11 of P\mathbf{P} can be repeated, as it is when the links split into disconnected pockets. You may use that every column-stochastic P\mathbf P has a non-negative eigenvector for the eigenvalue 1 (a stationary distribution). Show that the vectors x\mathbf{x} of this eigenspace with 1⊤x=0\mathbf{1}^\top\mathbf{x}=0 form a subspace of dimension one less than the eigenspace. Conclude that for diagonalizable P\mathbf{P} the eigenvalues of G\mathbf{G} are 11 and αλ2(P),…,αλn(P)\alpha\lambda_2(\mathbf{P}),\ldots,\alpha\lambda_n(\mathbf{P}), which gives the bound ∣λ2(G)∣≤α|\lambda_2(\mathbf{G})|\le\alpha of Haveliwala and Kamvar (2003).
    3. Four pages link in a cycle, 1→2→3→4→11\to2\to3\to4\to1. Find the eigenvalues of their link matrix P\mathbf{P}. Why does undamped power iteration started at page 11 never converge?
    4. With α=0.85\alpha=0.85 and the cycle of (c), run power iteration on G\mathbf{G} from page 11, and count the iterations until the ℓ1\ell_1 distance to the stationary distribution falls below 10−810^{-8}. Compare with the prediction 0.85k≤10−80.85^k\le10^{-8} from (b).
    5. Check numerically on the three-page example of Section 21.4.1.3 that the eigenvalues of G\mathbf G are α\alpha times those of P\mathbf P, apart from the eigenvalue 1, and that the stationary distribution moves from (0.3,0.4,0.3)(0.3,0.4,0.3) to about (0.303,0.394,0.303)(0.303,0.394,0.303). Why does damping move it toward uniform?
  2. [code] Lyapunov exponents of random products. ●● Let D1,D2,…\mathbf{D}_1,\mathbf{D}_2,\ldots be independent n×nn\times n matrices with independent N(0,1/n)\mathcal{N}(0,1/n) entries, a linear model of the Jacobians of a deep network at fan-in initialization, and let x0\mathbf{x}_0 be a unit vector. By Section 21.4.2.6, each factor has spectral radius close to 11 for large nn. Section 21.4.2.5 summarizes the growth of the product by its top Lyapunov exponent

μ=lim⁡T→∞1Tlog⁡∥DT⋯D1x0∥,\mu=\lim_{T\to\infty}\frac1T\log\|\mathbf{D}_T\cdots\mathbf{D}_1\mathbf{x}_0\|,

which exists with probability one by the theorem of Furstenberg and Kesten.

  1. Show that E∥Dx∥2=∥x∥2\mathbb{E}\|\mathbf{D}\mathbf{x}\|^2=\|\mathbf{x}\|^2 for every fixed x\mathbf{x}, so that this scaling preserves squared norms on average.
  2. Let u0=x0\mathbf{u}_0=\mathbf{x}_0 and ut=xt/∥xt∥\mathbf{u}_t=\mathbf{x}_t/\|\mathbf{x}_t\| for the iterates xt=Dt⋯D1x0\mathbf{x}_t=\mathbf{D}_t\cdots\mathbf{D}_1\mathbf{x}_0. Given D1,…,Dt−1\mathbf{D}_1,\ldots,\mathbf{D}_{t-1}, what is the distribution of n∥Dtut−1∥2n\|\mathbf{D}_t\mathbf{u}_{t-1}\|^2? Use the answer to write log⁡∥DT⋯D1x0∥\log\|\mathbf{D}_T\cdots\mathbf{D}_1\mathbf{x}_0\| as a sum of independent terms. With Elog⁡χn2=ψ(n/2)+log⁡2\mathbb{E}\log\chi^2_n=\psi(n/2)+\log2, where ψ\psi is the digamma function, derive the closed form of Cohen and Newman (1984)
μ=12(ψ(n/2)+log⁡2−log⁡n).\mu=\tfrac12\bigl(\psi(n/2)+\log2-\log n\bigr).
  1. Show that μ<0\mu\lt 0 for every nn, although (a) holds. Evaluate μ\mu in closed form for n=1n=1, using ψ(1/2)=−γE−2log⁡2\psi(1/2)=-\gamma_{\textrm{E}}-2\log2 with Euler's constant γE≈0.5772\gamma_{\textrm{E}}\approx0.5772. Using ψ(x)=log⁡x−12x+O(x−2)\psi(x)=\log x-\tfrac1{2x}+O(x^{-2}), show that μ≈−1/(2n)\mu\approx-1/(2n) for large nn.
  2. Simulate T=104T=10^4 steps with renormalization for n∈{1,2,5,50}n\in\{1,2,5,50\}, and compare the measured exponent with (b) and with the logarithms of the spectral radius and of the largest singular value of single factors. By which factor does a typical input shrink in a linear network of width 5050 and depth 100100 at this initialization? What does the comparison say about the three quantities of Section 21.4.2.5?

Discussions