Lecture 24 - 2025 / 5 / 19

Mixing Time

Definition (Vartiation Distance): 对于两个 Ω\Omega 上的分布 μ,ξ\mu, \xi,定义
μξ=12xΩμ(x)ξ(x)=maxAΩμ(A)ξ(A)\| \mu - \xi \| = \frac{1}{2} \sum_{x \in \Omega} | \mu(x) - \xi (x) | = \max_{A \sube \Omega} |\mu(A) - \xi(A)|

Definition: 对于一个不可约无周期的 Markov 链,定义时间 tt 的距离为 Δ(t)=maxxΩπpx(t)\Delta(t) = \max_{x \in \Omega} \| \pi - p_x^{(t)} \|

Definition (Mixing Time): 定义 τmix\tau_{\rm mix} 为混合时间:τmix=min{tΔ(t)1/2e}\tau_{\rm mix} = \min \{ t \mid \Delta(t) \le 1 / 2e \}

Fact: Δ(τmixlnϵ1)ϵ\Delta(\tau_{\rm mix} \lceil \ln \epsilon^{-1} \rceil) \le \epsilon

通过 coupling 的方式可以证明 Δ(kt)(2Δ(t))k\Delta(kt) \le (2\Delta(t))^k

Definition (Strong Stationary Time): 停时 TT 是一个强稳定时间,如果停下来时可以保证收敛 Pr[Xt=yT=t]=π(y)\Pr[X_t = y \mid T = t] = \pi(y)

Claim: Δ(t)Pr[T>t]\Delta(t) \le \Pr[T >t]

虽然 Δ(t)\Delta(t) 是一个固定的数,但我们可以对它求期望
E[Δ(t)]=Pr[T>t]E[Δ(t)T>t]+Pr[Tt]E[Δ(t)Tt]Pr[T>t]1+Pr[Tt]0=Pr[T>t]\begin{aligned} \mathbb E[\Delta(t)] & = \Pr[T > t] \cdot \mathbb E[\Delta(t) \mid T > t] + \Pr[T \le t] \cdot \mathbb E[\Delta(t) \mid T \le t] \\ & \le \Pr[T > t] \cdot 1 + \Pr[T \le t] \cdot 0 = \Pr[T > t] \end{aligned}

Example: Top-in-at-Random

考虑一种洗牌方式:每次把最顶上的牌插入随机位置。

Claim: 这种洗牌方式的混合时间为 O(nlogn)O(n \log n)

TT 表示原本最底下的牌被随机插入的时刻,则 TT 是一个强稳定时间。可见 T=T1+T2++Tn1+1T = T_1 + T_2 + \cdots + T_{n-1} + 1,其中 TiT_i 表示从位置 ii 变动到 i+1i+1 所需要的时间。每个 TiT_i 的分布是几何分布,期望为 n/in/i,故 E[T]=O(nlogn)\mathbb E[T] = O(n \log n)。根据 Markov 不等式,τmixO(nlogn)\tau_{\rm mix} \le O(n \log n)

Example: Riffle Shuffle

考虑一种洗牌方式:每次把牌按照 B(n,1/2)\mathcal B(n, 1/2) 分成两堆,然后随机均匀交叉。它的逆过程是,随机将每张牌标记为 0/10 / 1,然后将 00 的牌挪到上面,11 的牌挪到下面。

Claim: 这种洗牌方式的混合时间 2log2n+O(1)\le 2 \log_2 n + O(1)

将每轮的编号串联为一个二进制串,用 TT 表示每张牌被唯一标号确定的时间,也即给每张牌随机抽样 [0,2T)[0, 2^T) 内的编号,能够做到不重复的时间。

根据生日悖论,nn 个人从 cn2cn^2 大小的集合抽取生日,有生日冲突的概率渐进趋向 1exp(1/2c)1 - \exp(-1/2c)。因此,只需 1exp(1/2c)1/2e1 - \exp(-1/2c) \le 1/2e2tcn22^t \ge cn^2,则有 τmix2log2n+O(1)\tau_{\rm mix} \le 2 \log_2 n + O(1)

另一种看法是,对于固定的两张牌 (x,y)(x, y),无法被分开的概率为 2t2^{-t},根据 union bound,只需要 t=O(logn)t = O(\log n) 即可使得 n22t1/2en^2 2^{-t} \le 1/2e

Coupling

Definition (Coupling):(Xt),(Yt)(X_t), (Y_t) 为一个 Markov 链的两个样本,称它们是一个耦合,如果

  1. 边际上 XtX_tYtY_t 的分布相同,即 Pr[Xt=y]=Pr[Yt=y]\Pr[X_t = y] = \Pr[Y_t = y]
  2. Xt=YtX_t = Y_t 时,Xt+1=Yt+1X_{t+1} = Y_{t+1}

Definition (Meeting Time): TxyT_{xy} 是从 x,yx, y 开始的两个 Markov 链的耦合的第一次相遇时间。即 Txy=min{tXt=Yt,X0=x,Y0=y}T_{xy} = \min\{ t \mid X_t = Y_t, X_0 = x, Y_0 = y \}

Claim: Δ(t)maxx,yPr[Txyt]\Delta(t) \le \max_{x, y} \Pr[T_{xy} \ge t]

首先注意到,对于任何两个 r.v. X,YX, Y,都有 Pr[XY]PXPY\Pr[X \ne Y] \ge \| P_X - P_Y \|

从而 Δ(t)=maxxPx(t)πmaxx,yPx(t)Py(t)maxx,yPr[XtYtX0=x,Y0=y]maxx,yPr[Txyt]\Delta(t) = \max_x \| P_x^{(t)} - \pi \| \le \max_{x, y} \| P_x^{(t)} - P_y^{(t)} \| \le \max_{x, y} \Pr[X_t \ne Y_t \mid X_0 = x, Y_0 = y] \le \max_{x, y} \Pr[T_{xy} \ge t]。其中第一个不等号是因为 π\pi 可以写作 Py(t)P_y^{(t)} 的线性组合 π=yπ(y)Py(t)\pi = \sum_y \pi(y) P_y^{(t)}
π(x)=(πPt)(x)=yπ(y)Pt(y,x)=yPy(t)(x)π(y)\pi(x) = (\pi P^t)(x) = \sum_{y} \pi(y) P^t(y, x) = \sum_{y} P_y^{(t)}(x) \pi(y)

Corollary: τmix2emaxx,yE[Txy]\tau_{\rm mix} \le 2e \max_{x, y} \mathbb E[T_{xy}]

根据 Markov 不等式,Pr[Txyt]E[Txy]/t\Pr[T_{xy} \ge t] \le \mathbb E[T_{xy}] / t,因此 Δ(t)maxx,yE[Txy]/t\Delta(t) \le \max_{x, y} \mathbb E[T_{xy}] / t。当 t=2emaxx,yE[Txy]t = 2e \max_{x, y} \mathbb E[T_{xy}] 时,Δ(t)1/2e\Delta(t) \le 1 / 2e

Example: Random Transposition Shuffle

考虑一种洗牌方式:每次随机选择两个位置交换。这个洗牌方式的等价描述是,选择一个位置和一张牌 cc,将 cc 交换到位置 ii

Claim: 这种洗牌方式的混合时间为 O(n2)O(n^2)

用 Coupling 来分析,用 DtD_t 表示 Xt,YtX_t, Y_t 不同的位置,目标是分析多久之后 Dt=0D_t = 0

考虑一次选中 (i,c)(i, c)

因此,如果当前 Dt=dD_t = d,则 Pr[Dt decreases](d/n)2\Pr[D_t \text{ decreases}] \ge (d/n)^2。于是 E[Txy]d=1n(n/d)2=O(n2)\mathbb E[T_{xy}] \le \sum_{d=1}^{n} (n/d)^2 = O(n^2)

注:实际上为 Θ(nlogn)\Theta(n \log n)