Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Open In Colab Binder

How to Use This Experiment

This experiment consists of two interactive modules:

Module 1 (§1): a unified dashboard in which you can switch among the five chains; seven panels update together:

  • Top left: the positions of the eigenvalues in the complex plane (the “fingerprint plot”)

  • Top middle: the evolution of the heat map of the matrix power Pk\mathbf{P}^k (the “convergence animation”)

  • Bottom left: the decay curve of the TV distance (the “mixing-speed curve”)

  • Bottom row, second panel: the stationary distribution π\boldsymbol{\pi}

Module 2 (§7): the perturbation experiment, comparing two models: a single perturbation vs injecting randomness at every step

Each of §2–§6 has a “concrete matrix” cell that uses a small matrix to show you clearly the structure of each chain.

Structure of the Experiment

SectionTopicIn one sentence
§0Theoretical frameworkMathematical definitions of the stationary distribution, the mixing time, and the TV distance
§1Unified dashboardSwitch among the five chains: eigenvalues + heat maps + TV curve
§2Birth-death chainMoves only one step at a time, like climbing stairs
§3Cycle chainWalks around a ring; even-length rings have a periodicity problem
§4Google MatrixWeb page ranking: irregular links + teleportation
§5Doubly stochastic matrixRow and column sums all equal 1, so the stationary distribution must be uniform
§6HypercubeA random walk that flips bits; the higher the dimension, the slower
§7Perturbation experimentHow the convergence behavior changes when noise is added

§0 Common Theoretical Framework

Before turning to the concrete examples, we first make a few key concepts clear. The material in this section is the “common language” of all the experiments that follow.

§0.1 What Is a Transition Matrix?

Suppose a system has NN possible states (for example, the weather may be “sunny,” “rainy,” or “cloudy”). The entry PijP_{ij} of the transition matrix P\mathbf{P} is “the probability of jumping to state jj at the next step, given that the system is in state ii.”

Since a system that starts from state ii must go to some state, all these probabilities must add up to 1:

∑j=0N−1Pij=1,Pij≥0\sum_{j=0}^{N-1} P_{ij} = 1, \quad P_{ij} \geq 0

This is called a transition matrix (stochastic matrix). Note that it is each row whose sum is 1, because the first subscript ii of PijP_{ij} is the “point of departure.”

Evolution of the state distribution: if the current state distribution is the row vector μ(k)\boldsymbol{\mu}^{(k)}, then after one step

μ(k+1)=μ(k)P\boldsymbol{\mu}^{(k+1)} = \boldsymbol{\mu}^{(k)} \mathbf{P}

and after kk steps

μ(k)=μ(0)Pk\boldsymbol{\mu}^{(k)} = \boldsymbol{\mu}^{(0)} \mathbf{P}^k

§0.2 What Is a Stationary Distribution?

After enough steps, the distribution no longer changes—this is the stationary distribution π\boldsymbol{\pi}:

π⊤P=π⊤\boldsymbol{\pi}^\top \mathbf{P} = \boldsymbol{\pi}^\top

This equation says that π\boldsymbol{\pi} multiplied by P\mathbf{P} is still π\boldsymbol{\pi}; that is, π\boldsymbol{\pi} is an eigenvector of P⊤\mathbf{P}^\top for the eigenvalue λ0=1\lambda_0 = 1.

In the language of linear systems:

(P⊤−I)π=0(\mathbf{P}^\top - \mathbf{I})\boldsymbol{\pi} = \mathbf{0}

That is, we find the null space of P⊤−I\mathbf{P}^\top - \mathbf{I}; adding the normalization condition ∑iπi=1\sum_i \pi_i = 1 then determines π\boldsymbol{\pi} uniquely (for an irreducible chain).

§0.3 Eigenvalues and the Speed of Convergence

For an irreducible aperiodic chain, the eigenvalues of P\mathbf{P} are ordered as follows:

1⏟λ0>∣λ1∣≥∣λ2∣≥⋯≥∣λN−1∣\underbrace{1}_{ \lambda_0 } > |\lambda_1| \geq |\lambda_2| \geq \cdots \geq |\lambda_{N-1}|

Diagonalizing P\mathbf{P}: Pk=1π⊤+∑i=1N−1λikviui⊤\mathbf{P}^k = \mathbf{1}\boldsymbol{\pi}^\top + \sum_{i=1}^{N-1} \lambda_i^k \mathbf{v}_i \mathbf{u}_i^\top

When kk is large, λik→0\lambda_i^k \to 0 (because ∣λi∣<1|\lambda_i| < 1), so every row of Pk\mathbf{P}^k tends to π⊤\boldsymbol{\pi}^\top.

The speed of convergence is determined by ∣λ1∣|\lambda_1|: the closer ∣λ1∣|\lambda_1| is to 1, the more slowly λ1k\lambda_1^k decays, and the more steps are needed to converge.

§0.4 The Spectral Gap and the Mixing Time

The spectral gap is the distance between λ0\lambda_0 and λ1\lambda_1:

gap=1−∣λ1∣∈(0,1]\text{gap} = 1 - |\lambda_1| \in (0, 1]

The larger the spectral gap → the farther the second-largest eigenvalue ∣λ1∣|\lambda_1| is from 1 → the faster the convergence.

The total variation distance (TV distance) quantifies “how far the current distribution is from the stationary distribution”:

∥μ(k)−π∥TV=12∑i=0N−1∣μi(k)−πi∣\|\boldsymbol{\mu}^{(k)} - \boldsymbol{\pi}\|_{\mathrm{TV}} = \frac{1}{2}\sum_{i=0}^{N-1}|\mu^{(k)}_i - \pi_i|

Intuitively: if you regard μ(k)\boldsymbol{\mu}^{(k)} and π\boldsymbol{\pi} as two probability distributions, the TV distance is “the total discrepancy between the two distributions”; its range is [0,1][0, 1], and 0 means they are identical.

The mixing time is the smallest number of steps needed for the TV distance to drop to the threshold ε=0.25\varepsilon = 0.25:

tmix=min⁡{k:∥μ(k)−π∥TV≤0.25}≈log⁡(1/2ε)gap=log⁡2gapt_{\mathrm{mix}} = \min\bigl\{k : \|\boldsymbol{\mu}^{(k)} - \boldsymbol{\pi}\|_{\mathrm{TV}} \leq 0.25\bigr\} \approx \frac{\log(1/2\varepsilon)}{\text{gap}} = \frac{\log 2}{\text{gap}}

This formula tells you that if the spectral gap shrinks by half, the mixing time roughly doubles.

§0.5 Mathematical Utility Functions

The following six functions are the computational foundation of the whole experiment; every later cell uses them. Next to each function is a description of the mathematical quantity it computes.

§0.6 Constructing the Five Transition Matrices

Below we define the transition matrices of five well-known Markov chains. Behind each function lies a different physical or mathematical motivation:

FunctionModelAn everyday analogy
make_birth_deathBirth-death chainRandom rises and falls in the length of a queue
make_cycleCycle chainWalking randomly around a ring
make_googleGoogle MatrixBrowsing randomly among web pages
make_doubly_stochasticDoubly stochastic matrixBalanced flows in a logistics network
make_hypercubeHypercube walkRandomly flipping one bit of a binary password

§1 Unified Comparison Dashboard

This dashboard lets you compare the five chains with the same “measuring stick.” Switch chains or adjust the parameters, and the seven plots update together.

How to Read the Seven Panels

Top row (matrix structure)

  • Eigenvalues (complex plane): each point is an eigenvalue. The orange star on the far right is always λ0=1\lambda_0 = 1 (the dominant eigenvalue). The closer the other points are to the origin = the faster the mixing; points lying on the unit circle = a periodicity problem.

  • Heat maps of Pk\mathbf{P}^k (four panels): the shade of each cell of the matrix indicates the size of the transition probability (white = 0, dark violet = high). From left to right, k=1,tmix/3,tmix,3tmixk = 1, t_{\text{mix}}/3, t_{\text{mix}}, 3t_{\text{mix}}. When the colors of all the rows become alike, the chain has converged.

Bottom row (convergence analysis)

  • TV distance decay: the horizontal axis is the number of steps kk, and the vertical axis is the distance from the stationary distribution. The orange dot marks the mixing time tmixt_{\text{mix}} (where the TV distance drops to 0.25). The green dashed line is the threshold ε=0.25\varepsilon = 0.25.

  • Stationary distribution π\boldsymbol{\pi}: the frequency with which each state is eventually visited. A uniform distribution = all states are on an equal footing; a skewed distribution = some states are more “important.”

The Metrics Bar

The title bar of the dashboard shows three numbers:

  • ∣λ1∣|\lambda_1|: the absolute value of the second-largest eigenvalue; the smaller, the better

  • Spectral gap =1−∣λ1∣= 1 - |\lambda_1|: the larger it is, the faster the convergence

  • tmixt_{\text{mix}}: the number of steps needed for the TV distance to drop to 0.25; the smaller, the better

§2 The Birth-Death Chain

Physical Intuition: Hospital Beds

Imagine a hospital with S+1S+1 beds numbered 0,1,…,S0, 1, \ldots, S. Each day one of two things happens at random: a new patient is admitted (a “birth,” a step to the right) with probability pp, or a current patient is discharged (a “death,” a step to the left) with probability q=1−pq = 1-p. At the boundary (bed 0 or bed S) the probabilities are the same; only the direction is restricted.

This is the birth-death chain—at each step it can only move between adjacent states.

Matrix Structure

P=(qp0⋯0q0p⋯00q0⋯0⋮⋱⋮000qp)\mathbf{P} = \begin{pmatrix} q & p & 0 & \cdots & 0 \\ q & 0 & p & \cdots & 0 \\ 0 & q & 0 & \cdots & 0 \\ \vdots & & & \ddots & \vdots \\ 0 & 0 & 0 & q & p \end{pmatrix}
  • Tridiagonal matrix: the nonzero entries lie only on the main diagonal and on the one diagonal on each side of it

  • White cells (zeros) = states that cannot be reached in one step

Detailed Balance: Why Are All the Eigenvalues Real?

The birth-death chain satisfies the detailed balance condition:

πi⋅Pi,i+1=πi+1⋅Pi+1,i\pi_i \cdot P_{i,i+1} = \pi_{i+1} \cdot P_{i+1,i}

Intuitively: the “flow” from state ii to i+1i+1 equals the “flow” from i+1i+1 back to ii. It is like balanced traffic on a two-way road—what goes in equals what comes out.

From detailed balance one can prove that P\mathbf{P} can be “symmetrized,” so its eigenvalues are all real, lying in [−1,1][-1, 1].

Stationary distribution: πi=π0(p/q)i\pi_i = \pi_0 (p/q)^i, a geometric distribution (skewed to one side when p≠0.5p \neq 0.5).

A Concrete Example (First, What the Matrix Looks Like)

§3 The Cycle Chain

Physical Intuition: A Circular Track

NN runners stand on a circular track; at each step each one independently moves forward one position with probability 1/21/2 and back one position with probability 1/21/2 (the lazy probability rr is the probability of staying in place).

The ring structure brings an important property: the “right neighbor” of the last state N−1N-1 is state 0.

Why Does the DFT Diagonalize It?

The transition matrix is a circulant matrix: each row is the previous row cyclically shifted one position to the right. Circulant matrices have a perfect property—the column vectors of the DFT (discrete Fourier transform) matrix are exactly their eigenvectors, and the eigenvalues can be computed exactly:

λk=r+(1−r)cos⁡ ⁣(2πkN),k=0,1,…,N−1\lambda_k = r + (1-r)\cos\!\left(\frac{2\pi k}{N}\right), \quad k = 0, 1, \ldots, N-1

This means that the eigenvalues are all real (the transition matrix is symmetric) and lie in the interval [2r−1,1][2r-1, 1] of the real axis; only λ0=1\lambda_0 = 1 (and, when r=0r = 0 and NN is even, λN/2=−1\lambda_{N/2} = -1) lies on the unit circle.

The Periodicity Problem of Even-Length Rings

When NN is even and r=0r=0, λN/2=cos⁡(π)=−1\lambda_{N/2} = \cos(\pi) = -1.

What does this mean? (−1)k(-1)^k oscillates back and forth between odd and even steps and never decays! As a result, the TV distance does not decrease monotonically; instead it jumps up every other step.

The remedy: add a lazy probability r>0r > 0, so that ∣λN/2∣<1|\lambda_{N/2}| < 1; the periodicity disappears and the TV distance becomes monotonically decreasing.

A Concrete Example (First, What the Matrix Looks Like)

§4 Google Matrix (PageRank)

Motivation: How Do You Judge How Important a Web Page Is?

In the 1990s, search engines faced a problem: of the billions of pages on the web, which ones are “truly important”? Simply counting how many times a page is linked to (its in-degree) is not enough— because spam sites can link to one another to inflate their counts.

The idea of Larry Page and Sergey Brin (the founders of Google) was: let a random surfer judge for you.

Simulate a person who clicks links at random as they move among web pages. If they end up spending most of their time on some page, that page is “important”—this is PageRank.

The behavior of this random surfer is exactly the stationary distribution of a Markov chain!

The Underlying Structure: An Irregular Directed Graph

The real web is an irregular directed graph: some pages (such as Wikipedia) are linked to by thousands of pages (high in-degree), while others are linked to only once or twice. This kind of distribution, in which “a few nodes are extremely important,” is called a power-law distribution, and it is a pervasive feature of real networks.

We generate such irregular graphs with the Barabási–Albert (BA) preferential attachment model: each newly added node chooses its link targets with probability proportional to the in-degrees of the existing nodes— “the rich get richer,” and nodes with high in-degree are more likely to receive new links.

Two Technical Problems and Google’s Solutions

Problem 1: dangling nodes

Some web pages have no outgoing links at all (such as pure image pages); a surfer who arrives there is “stuck” and cannot continue.

Solution: make the outgoing links of these nodes uniform—equivalent to “jumping at random to any page.”

Problem 2: disconnected components

The web may consist of several subgraphs that are not connected to one another, so that the stationary distribution is not unique (or does not exist at all).

Solution: add a teleportation probability 1−α1-\alpha—with probability 1−α1-\alpha the surfer jumps at random to any page, regardless of where they currently are. This is the Google correction:

G=αPlink+(1−α)⋅1N11⊤\mathbf{G} = \alpha \mathbf{P}_{\text{link}} + (1-\alpha) \cdot \frac{1}{N} \mathbf{1}\mathbf{1}^\top

The Mathematical Effect: A Rank-One Correction

(1−α)⋅1N11⊤(1-\alpha)\cdot\frac{1}{N}\mathbf{1}\mathbf{1}^\top is a rank-one matrix: all its entries are the same, equal to (1−α)/N(1-\alpha)/N.

After this matrix is added, all the entries of G\mathbf{G} are strictly greater than 0, which guarantees irreducibility (any two web pages can reach each other with positive probability), and hence a unique stationary distribution.

More importantly, this correction “compresses” all the non-dominant eigenvalues to ∣λk∣≤α|\lambda_k| \leq \alpha:

spectral gap=1−∣λ1∣≥1−α\text{spectral gap} = 1 - |\lambda_1| \geq 1 - \alpha

α=0.85\alpha = 0.85 (Google’s actual setting) means that the spectral gap is at least 0.15, so convergence takes roughly ⌈log⁡2/0.15⌉≈5\lceil \log 2 / 0.15 \rceil \approx 5 steps.

The Trade-off between Speed and Quality

  • The larger α\alpha is (close to 1): the more “faithful” PageRank is (the more it respects the link structure), but the slower the convergence

  • The smaller α\alpha is (close to 0): convergence is fast, but PageRank tends to the uniform distribution and loses its meaning

A Concrete Example (First, What the Matrix Looks Like)

§5 Doubly Stochastic Matrices

Physical Intuition: A Balanced Logistics Network

Suppose there are NN cities, with goods flowing among them. An ordinary stochastic matrix only requires that “the total amount of goods leaving each city = 1” (row sums equal 1). A doubly stochastic matrix also requires that “the total amount of goods flowing into each city = 1” (column sums also equal 1)— like a perfectly balanced logistics network in which every city ships out as much as it takes in.

Definition

∑j=0N−1Pij=1(each row sums to 1: balanced out-degree)\sum_{j=0}^{N-1} P_{ij} = 1 \quad (\text{each row sums to 1: balanced out-degree})
∑i=0N−1Pij=1(each column sums to 1: balanced in-degree)\sum_{i=0}^{N-1} P_{ij} = 1 \quad (\text{each column sums to 1: balanced in-degree})

Note: an ordinary stochastic matrix satisfies only the first condition; a doubly stochastic matrix must satisfy both.

Why Must the Stationary Distribution Be Uniform?

An intuitive derivation: let π=(1/N,1/N,…,1/N)\boldsymbol{\pi} = (1/N, 1/N, \ldots, 1/N) (the uniform distribution). Check the jj-th entry of π⊤P\boldsymbol{\pi}^\top \mathbf{P}:

[π⊤P]j=∑i=0N−1πiPij=1N∑i=0N−1Pij=1N⋅1=πj[\boldsymbol{\pi}^\top \mathbf{P}]_j = \sum_{i=0}^{N-1} \pi_i P_{ij} = \frac{1}{N} \sum_{i=0}^{N-1} P_{ij} = \frac{1}{N} \cdot 1 = \pi_j

It holds! The reason is that column jj sums to 1 (the second condition for a doubly stochastic matrix). Hence, whatever the particular shape of the matrix, the stationary distribution is always uniform.

The Birkhoff–von Neumann Theorem

This theorem says: the doubly stochastic matrices are precisely the convex combinations of permutation matrices.

A permutation matrix is a matrix obtained by rearranging the rows of I\mathbf{I}, for example:

(010001100)\begin{pmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{pmatrix}

The intuitive meaning of this theorem is that any balanced logistics plan can be decomposed into a weighted average of several “pure permutation plans.”

A Concrete Example (First, What the Matrix Looks Like)

§6 The Hypercube Walk

Physical Intuition: Randomly Flipping the Bits of a Password

Suppose you have an nn-bit binary password; for example, when n=3n=3 the possible passwords are 000,001,010,…,111000, 001, 010, \ldots, 111, 2n=82^n = 8 of them in all.

At each step, one bit is chosen at random and flipped (0→10 \to 1 or 1→01 \to 0). For example, starting from 011, flipping bit 0 gives 010, flipping bit 1 gives 001, and flipping bit 2 gives 111—each of the three options has probability 1/31/3.

This is the hypercube walk: there are 2n2^n vertices, and two vertices are joined by an edge only when their Hamming distance is 1 (they differ in exactly one bit).

Matrix Structure: The Kronecker Product

The transition matrix can be expressed with the Kronecker product structure of Chapter 5:

Pn=1n∑k=0n−1I2k⊗S⊗I2n−k−1⏟flip bit k,S=(0110)\mathbf{P}_n = \frac{1}{n} \sum_{k=0}^{n-1} \underbrace{\mathbf{I}_{2^k} \otimes \mathbf{S} \otimes \mathbf{I}_{2^{n-k-1}}}_{\text{flip bit } k}, \quad \mathbf{S} = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}

An intuitive reading: S\mathbf{S} is the 2×22 \times 2 matrix that “flips one bit,” ⊗\otimes “embeds” it at the position of bit kk, and I\mathbf{I} leaves the other bits unchanged.

Binomial Multiplicities of the Eigenvalues

This Kronecker product structure allows the eigenvalues to be computed exactly:

λj=1−2jn,j=0,1,…,n\lambda_j = 1 - \frac{2j}{n}, \quad j = 0, 1, \ldots, n

with multiplicity (nj)\binom{n}{j} (a binomial coefficient!). For example, for n=3n=3:

jjλj=1−2j/3\lambda_j = 1 - 2j/3Multiplicity (3j)\binom{3}{j}
011
11/3≈0.3331/3 \approx 0.3333
2−1/3≈−0.333-1/3 \approx -0.3333
3-11

λn=−1\lambda_n = -1 means that the hypercube walk is periodic (for every value of nn)— adding a lazy probability r>0r > 0 removes the periodicity.

The Cutoff Phenomenon

The hypercube walk has a peculiar property: mixing does not happen by “gradual convergence” but by “sudden convergence.”

For a long time the TV distance stays close to 1 (mixing has barely begun); then, around t≈n2ln⁡nt \approx \frac{n}{2}\ln n, it drops sharply to nearly 0 (for the standard version with lazy probability r=1/2r = 1/2).

This “cliff-like” convergence is called the cutoff phenomenon, and the mixing time is tmix∼n2ln⁡nt_{\text{mix}} \sim \frac{n}{2}\ln n. Each time the dimension increases by 1, the mixing time increases by roughly 12(ln⁡n+1)\frac{1}{2}(\ln n + 1) steps.

A Concrete Example (First, What the Matrix Looks Like)

§7 The Perturbation Experiment: What If Every Step Carries a Little Noise?

Motivation: The Real World Is Not Perfect

The Markov chains studied so far are all “perfect”—their transition probabilities are exact and never change. In reality, however, weather forecasts are wrong, links break, and transmissions are noisy.

If a little random perturbation is added at each transition, how does the convergence behavior change?

ε\varepsilon-Uniform Mixing Perturbation

We use the simplest kind of perturbation:

P~=(1−ε) P+ε U\tilde{\mathbf{P}} = (1-\varepsilon)\,\mathbf{P} + \varepsilon\,\mathbf{U}
  • ε=0\varepsilon = 0: no perturbation at all; this is the original chain

  • ε=1\varepsilon = 1: completely random—where each step goes is decided by U\mathbf{U}, independently of P\mathbf{P}

  • 0<ε<10 < \varepsilon < 1: follow the original rule with “confidence” (1−ε)(1-\varepsilon), and jump around at random with “probability” ε\varepsilon

Each row of U\mathbf{U} is a random probability vector sampled uniformly from the simplex, which guarantees that P~\tilde{\mathbf{P}} is still a valid stochastic matrix (row sums equal 1).

Two Different Perturbation Models

There is a subtle but important distinction here:

Model 1 (a single perturbation): sample U\mathbf{U} once, keep it fixed, and then compute P~k\tilde{\mathbf{P}}^k.

Effect: this is just a new Markov chain whose transition matrix happens to be P~\tilde{\mathbf{P}} rather than P\mathbf{P}. Because P~\tilde{\mathbf{P}} contains a uniform component, its spectral gap is larger, and it actually converges faster.

Model 2 (injection at every step): at every step, sample a new U(k)\mathbf{U}^{(k)}:

μ(k+1)=μ(k)P(k),P(k)=(1−ε)P+εU(k)\boldsymbol{\mu}^{(k+1)} = \boldsymbol{\mu}^{(k)} \mathbf{P}^{(k)}, \quad \mathbf{P}^{(k)} = (1-\varepsilon)\mathbf{P} + \varepsilon \mathbf{U}^{(k)}

Effect: this is a random matrix product. Every path is different, and the TV distance curve “jitters.” In expectation, however, E[P(k)]=(1−ε)P+ε(1/N)11⊤\mathbb{E}[\mathbf{P}^{(k)}] = (1-\varepsilon)\mathbf{P} + \varepsilon (1/N)\mathbf{1}\mathbf{1}^\top, so the expected rate of convergence is still determined by (1−ε)∣λ1∣(1-\varepsilon)|\lambda_1|.

How to Read the Heat-Map Comparison

  • Top row (Model 1): orderly convergence, like a deterministic chain

  • Bottom row (Model 2): every resampling gives a different path, and the heat maps look “jittery”

  • Click the “Resample U ↻” button: Model 1 gets a new U\mathbf{U}; Model 2 reruns the whole path

Questions for Exploration

§2 Birth-Death Chain

  1. Change pp from 0.5 to 0.9. How does the mixing time change? Intuitively, when p=0.9p = 0.9 the system is “biased to one side,” and the stationary distribution is concentrated at the right end; why does this instead make the convergence faster?

  2. Look at the eigenvalue plane for p=0.5p = 0.5: all the eigenvalues lie on the real axis. Move pp away from 0.5 (so that P\mathbf{P} is no longer symmetric): do the eigenvalues still lie on the real axis? What does this tell us, compared with the cycle chain (a symmetric matrix, whose eigenvalues are all real)?

§3 Cycle Chain

  1. Set N=8N = 8 and r=0r = 0, and look at the TV distance curve: does it oscillate? Gradually increase rr. When does the oscillation disappear? To the change of which eigenvalue does this correspond?

  2. Fix N=8N = 8 and compare the mixing times for r=0r = 0 and r=0.1r = 0.1— adding a little “laziness” actually makes the convergence faster. Can you explain why?

§4 Google Matrix

  1. Slowly change the damping factor α\alpha from 0.99 to 0.5 and observe:

    • How do the heat maps change from sparse to uniform?

    • How does PageRank (the stationary distribution) go from “nonuniform” toward “uniform”?

    • How does the mixing time change?

  2. If α=1\alpha = 1 (no teleportation at all), the Google Matrix degenerates into the pure BA graph. Does a stationary distribution still exist in this case? What anomaly can you see in the eigenvalue plane?

§5 Doubly Stochastic Matrix

  1. No matter how the mixing strength mm is adjusted, the stationary distribution is always uniform— give a one-line algebraic argument using the property that “the column sums equal 1.”

  2. Set mm to 1.0; the matrix approaches a permutation matrix. How does the mixing time change? How can this be explained by the Birkhoff–von Neumann theorem?

§6 Hypercube

  1. Compare the mixing times for n=2,3,4n = 2, 3, 4, compute their ratios, and check them against the theoretical prediction tmix∼(n/2)ln⁡nt_{\text{mix}} \sim (n/2)\ln n. Do the numbers agree?

  2. The hypercube has only n+1n+1 distinct eigenvalues, yet the matrix is 2n×2n2^n \times 2^n. What symmetry of this “highly degenerate” eigenvalue distribution can you see in the heat maps?

§7 Perturbation Experiment

  1. Set ε=0\varepsilon = 0. Do the TV curves of the two models coincide? Why?

  2. Set ε=0.5\varepsilon = 0.5. How does the “jitter amplitude” among the paths of Model 2 compare with that for ε=0.1\varepsilon = 0.1? What about the position of the expectation curve (the black dashed line)?

  3. The TV curve of Model 1 usually converges faster than that of the base chain (violet)— because the spectral gap of P~\tilde{\mathbf{P}} is larger. Can you compute a theoretical lower bound for the new spectral gap?