1.7 Markov Chains and Random Walks

1.7.1 Stirling’s Formula

After previous bounds for factorial by corollary 1.5.5 and corollary 1.6.3, we reach Stirling’s Formula.

Lemma 1.7.1 (Stirling’s Formula).

For n>0,

n!=2⁢π⁢n⁢(ne)n⁢(1±o⁢(1)).

In particular, for n>0,

2⁢π⁢n⁢(ne)n≤n!≤(2⁢π⁢n+1)⁢(ne)n.
Proof.

We start from the fact that factorial is the discrete form of the Gamma function, by

n!=Γ⁢(n+1)=∫0∞tn⁢e−t⁢𝑑t.

Let t=n⁢(1+x) where x>−1, then

Γ⁢(n+1) =∫0∞tn⁢e−t⁢𝑑t
=∫−1∞(n⁢(1+x))n⋅e−n⁢(1+x)⋅n⁢𝑑x
=n⁢(ne)n⁢∫−1∞(1+x)n⁢e−n⁢x⁢𝑑x
=n⁢(ne)n⁢∫−1∞exp⁡(n⁢(ln⁡(1+x)−x))⁢𝑑x
=n⁢(ne)n⁢∫−1∞exp⁡(n⋅f⁢(x))⁢𝑑x,

where d⁢t=n⁢d⁢x, and we let f⁢(x)=log⁡(x+1)−x. We continue by series expansion:

  • •

    f′⁢(x)=(1+x)−1−1=−x/(1+x), and f′⁢(0)=0;

  • •

    f′′⁢(x)=−(1+x)−2, and f′′⁢(0)=−1.

Hence, f⁢(x)=−x2/2+O⁢(x3). We let −z2/2=f⁢(x), where

z=sgn⁢(x)⋅2⁢(x−ln⁡(x+1)),

then by d⁢f⁢(x)=f′⁢(x)⁢d⁢x=−z⁢d⁢z, d⁢x=(z+z/x)⁢d⁢z, and by replacing d⁢x with d⁢z,

Γ⁢(n+1)=n⁢(ne)n⁢∫−∞∞exp⁡(−n⁢z22)⋅(z+zx)⁢𝑑z.

We continue by bounding the term z/x with results from [Top07].

Lemma 1.7.2 (log⁡(x+1) bounds [Top07]).

For x>−1,

x⁢(6+x)6+4⁢x≥ln⁡(x+1)≥{x−x22x≥0x⁢(2+x)2+2⁢xx≤0.

With lemma 1.7.2, we need to prove the following bound to complete the proof.

Corollary 1.7.3.

If x>−1, then 1+2⁢z/3≤z+z/x≤max⁡(1,1+z).

Proof.

First, z⁢(1+1/x)>0, since −1<x≤0, both z and 1+1/x are less than 0. Hence, we can bound by z2⁢(1+1/x)2.

When −1<x≤0, by lemma 1.7.2

z2=2⁢(x−ln⁡(x+1))≤x21+x≤(x1+x)2,

and therefore z2⁢(1+1/x)2≤1. Hence, z+z/x≤1.

When x≥0,

z2=2⁢(x−ln⁡(x+1))≤x2,

and therefore z2/x2≤1. Hence, z+z/x≤1+z.

Hence, the upper bound is max⁡(1,1+z).

For lower bound, we have

z2=2⁢(x−ln⁡(x+1))≥3⁢x23+2⁢x,

and

3⁢x23+2⁢x⋅(13+1x)2=x29+6⁢x+1≥1.

Hence, the lower bound is 1+2⁢z/3, which completes the proof. ∎

Since

∫−∞∞exp⁡(−z2)⁢𝑑z=π⁢ and ⁢∫0∞z⋅exp⁡(−z2)⁢𝑑z=12,

then

∫−∞∞exp⁡(−n⁢z22)⁢𝑑z=2⁢πn⁢ and ⁢∫0∞z⋅exp⁡(−n⁢z22)⁢𝑑z=1n,

and therefore the upper bound is derived by,

Γ⁢(n+1) =n⁢(ne)n⁢∫−∞∞exp⁡(−n⁢z22)⋅(z+zx)⁢𝑑z
≤n⁢(ne)n⋅(2⁢πn+1n)=(2⁢π⁢n+1)⁢(ne)n,

and the lower bound is derived by

Γ⁢(n+1) =n⁢(ne)n⁢∫−∞∞exp⁡(−n⁢z22)⋅(z+zx)⁢𝑑z
≥n⁢(ne)n⁢∫−∞∞exp⁡(−n⁢z22)⋅(1+2⁢z3)⁢𝑑z
=n⁢(ne)n⁢∫−∞∞exp⁡(−n⁢z22)⁢𝑑z
=n⁢(ne)n⋅2⁢πn=2⁢π⁢n⁢(ne)n,

which completes the proof 222 This derivation is based on Thomas Ahle’s post in https://mathoverflow.net/a/484270. . ∎

1.7.2 Markov Chains and Classification of States

Definition 1.7.4.

The stochastic process 𝐗={Xt}t∈T is a collection of random variables. The index t represents time, and the process 𝐗 models how a random variable changes over time.

Xt is the state of the process at the tth time step.

  • •

    If Xt takes values from a countably infinite set, 𝐗 is a discrete-state process.

  • •

    If Xt takes values from a finite set, then 𝐗 is finite-state.

  • •

    If T is a countably infinite set, 𝐗 is a discrete-time process.

A discrete stochastic process X0,X1,… is a time-homogeneous Markov chain if

Pr⁡[Xt=at∣Xt−1=at−1,…,X0=a0]=Pr⁡[Xt=at∣Xt−1=at−1]=Pat−1,at.

This is called the Markov property, or memoryless property, or Markovian.

Exercise 1.7.5 (Exercise 7.2 [MU17]).

Consider the 2-state Markov chain with the following transition matrix

𝐏=[p1−p1−pp].

Find the minimum expression for P0,0t in 𝐏t.

Proof.

We can derive the following recurrence relation

P0,0t=⟨[P0,0t−1,1−P0,0t−1]𝖳,[p,1−p]𝖳⟩=(2⁢p−1)⋅P0,0t−1−(p−1).

as the 𝐏t−1 is diagonally symmetric with same diagonal values. Therefore, P0,0t=(1+(2⁢p−1)t)/2. ∎

We present a 2-SAT randomized algorithm from Markov chain by [Pap91] that is similar to theorem 1.6.60:

  • •

    Start with a random truth assignment.

  • •

    Repeat up to m⋅2⁢n2 times, terminating on all clauses satisfied:

    • –

      Choose an arbitrary unsatisfied clause.

    • –

      Choose uniformly at random a variable in the clause, and flip it.

  • •

    If the loop ends with a satisfying assignment, return it; otherwise, abort.

Lemma 1.7.6 (2-SAT randomized algorithm expected runtime [Pap91]).

Assume the 2-SAT formula is satisfiable, and the 2-SAT randomized algorithm is allowed to run until it finds a satisfying assignment. Then the expected number of steps until the algorithm finds a satisfying assignment is at most n2.

Proof.

One can view the state transition graph as a line of n+1 vertices, from 0 to n.

Suppose the algorithm outputs a satisfying assignment S, and we let the initial random assignment be A0, At be the assignment on the tth step. We define the process {Xt}t∈T over the number of matches of At with S.

  • •

    When Xt−1=0, any flip of variable can make At−1 have more match, and thus Pr⁡[Xt=1∣Xt−1=0]=1.

  • •

    When Xt−1=j, then

    • –

      If the clause picked has 1 unmatched variable, then the probability of making situation better is 1/2.

    • –

      If the clause picked has 2 unmatched variables, then any flip can make situation better.

    Hence, Pr⁡[Xt=j+1∣Xt−1=j]≥1/2.

But this goes against the Markovian property, namely memoryless, as the state transition probability should only be tied to the time step and the states. But in the current model, the probability varies on the number of disagreeing variables in a chosen clause. Hence, we define the following process {Yt}t∈T that Y0=X0, with

Pr⁡[Yt=1∣Yt−1=0] =1,
Pr⁡[Yt=j+1∣Yt−1=j] =1/2,
Pr⁡[Yt=j−1∣Yt−1=j] =1/2.

Let {Zi}i∈[0,n] be the random variables for the number of steps to reach n from i matches in process {Yt}t∈T. The following claims are immediate:

𝔼[Zn] =0,
𝔼[Zj] =𝔼[Zj∣Yt+1=j−1]⋅Pj,j−1+𝔼[Zj∣Yt+1=j+1]⋅Pj,j+1
=(1+𝔼[Zj−1])/2+(1+𝔼[Zj+1])/2
=1+(𝔼[Zj−1]+𝔼[Zj+1])/2,
𝔼[Z0] =𝔼[Z1]+1.

It is immediate that 𝔼[Z1]=𝔼[Z2]+3. By induction, we derive the following recurrence relation

𝔼[Zj]=𝔼[Zj+1]+(2⁢j+1).

By summation, 𝔼[Z0]=n2, and 𝔼[Zj]=n2−j2. ∎

The following theorem is immediate from lemma 1.7.6.

Theorem 1.7.7.

The 2-SAT algorithm always returns correct answer on an unsatisfiable formula. If the formula is satisfiable, with probability at least 1−2−m the algorithm gives a satisfiable assignment.

Proof.

One can segment the m⋅2⁢n2 steps in the algorithm into m chunks of 2⁢n2 steps, running independently.

Let Z be the random variable for the steps the algorithm needs to take from i matches. By lemma 1.7.6, 𝔼[Z]≤n2. Immediate from Markov’s inequality,

Pr⁡[Z≥2⁢n2]≤𝔼[Z]2⁢n2≤12.

Hence, the probability that the algorithm fails to find a satisfying assignment after m segments is at most 2−m. ∎

Exercise 1.7.8 (Exercise 7.6 [MU17]).

Consider a partially reflecting boundary at 0, rather than a complete reflecting boundary at 0 in lemma 1.7.6. At position 0, with probability 1/2 the walk moves to position 1 and with probability 1/2 the walk stays at 0. Everywhere else is the same. Find the expected number of moves to reach n from position i.

Proof.

We continue with reusing {Zi}i∈[0,n] and process {Yt}t∈T. The following claims are immediate:

𝔼[Zn] =0,
𝔼[Zj] =𝔼[Zj∣Yt+1=j+1]⋅Pj,j+1+𝔼[Zj∣Yt+1=j−1]⋅Pj,j−1
=1+(𝔼[Zj+1]+𝔼[Zj−1])/2,
𝔼[Z0] =𝔼[Z0∣Yt+1=0]⋅P0,0+𝔼[Z0∣Yt+1=1]⋅P0,1
=1+(𝔼[Z0]+𝔼[Z1])/2.

It is immediate that 𝔼[Z1]=𝔼[Z2]+4. By induction, we derive the following recurrence relation

𝔼[Zj]=𝔼[Zj+1]+(2⁢j+2).

By summation, 𝔼[Zn]=n⁢(n+1), and 𝔼[Zj]=n⁢(n+1)−j⁢(j+1). ∎

Exercise 1.7.9 (Exercise 7.7 [MU17]).

Find the expected runtime of the 2-SAT randomized algorithm for lemma 1.7.6, where the input is sampled uniformly at random.

Proof.

We follow the {Zj}j∈[0,n] notions of lemma 1.7.6, and let Y be the random variable for the number of mismatches in the initial assignment. Then by conditional expectation,

𝔼[Z] =∑j∈[0,n]𝔼[Z∣Y=j]⋅Pr⁡[Y=j]=∑j∈[0,n]𝔼[Zj]⋅(nj)⋅12n=∑j∈[0,n](n2−j2)⋅(nj)⋅12n
=n2−12n⁢∑j∈[0,n]j2⋅(nj)=n2−n2n⁢∑j∈[1,n]j⋅(n−1j−1)
=n2−n2−n2n⁢∑k∈[0,n−1]k⋅(n−1k)=n2−n2−n⁢(n−1)2n⁢∑ℓ∈[0,n−2](n−2ℓ)
=n2−n2−n⁢(n−1)4=34⁢n2−14⁢n.

∎

After lemma 1.7.6, we present a 3-SAT randomized algorithm from Markov chain. A prototype as follows:

  • •

    Pick a random truth assignment.

  • •

    Repeat up to m times, terminating on all clauses satisfied:

    • –

      Choose an arbitrary unsatisfied clause.

    • –

      Choose uniformly at random a variable in the clause, and flip it.

  • •

    If the loop ends with a satisfying assignment, return it; otherwise, abort.

Again after lemma 1.7.6, we define the Markov chain by the following process {Yt}t∈T by

Pr⁡[Yt=1∣Yt−1=0] =1,
Pr⁡[Yt=j+1∣Yt−1=j] =1/3,
Pr⁡[Yt=j−1∣Yt−1=j] =2/3.

We proceed by defining the random variables {Zi}i∈[0,n] for the number of steps to reach n matches for the current assignment with a satisfying assignment S, where the current assignment has i matches. By conditional expectation,

𝔼[Zn] =0,
𝔼[Zj] =𝔼[Zj∣Yt+1=j−1]⋅Pj,j−1+𝔼[Zj∣Yt+1=j+1]⋅Pj,j+1
=1+2/3⋅𝔼[Zj−1]+1/3⋅𝔼[Zj+1],
𝔼[Z0] =1+𝔼[Z1].

By induction, 𝔼[Zj]=𝔼[Zj+1]+2j+2−3. But this results in 𝔼[Z0]=O⁢(2n), where trying all n variables is also 2n, which is not impressive. The following 2 observations are helpful:

  • •

    It is more likely to make more violation when choosing a random unsatisfied clause and flip a variable at random. Hence, on a random initial assignment, it seems better to try a smaller number of repetition, as it is more likely to drift to a larger number of matches, than a rather large number of repetition.

  • •

    Initial assignment of variables with uniform randomness can be viewed as independent Bernoulli trials. Hence, we have some chance of sampling an initial assignment with matches higher than n/2.

Based on the observation, it seems better to try for a smaller amount of repetitions on a random initial assignment, and try over a large variety of different random initial assignments.

Given an initial assignment with j mismatches, we let qj be the probability that the random walk finds a satisfying assignment from this initial assignment in 3⁢n steps. The random walk always needs 2⁢k+j steps to reach n matches. To lower bound the probability that a satisfying assignment can be found within 2⁢k+j steps, we consider k+j steps drifting to more matches, while k steps drifting to less matches, by

pk=(2⁢k+jk)⁢(13)k+j⁢(23)k=(2⁢k+jk)⋅(13)2⁢k+j⋅2k.

It turned out that for any k, pk≤qj, as

  • •

    All exact 2⁢k+j steps cases are captured.

  • •

    All cases reaching n matches earlier, should drift around the n matches, with a probability at most 1.

  • •

    All other cases reaching n matches later, are omitted, while their probability is non-negative.

Since qj≥max2⁢k+j≤3⁢n⁡pk, then surely the following holds:

qj≥(3⁢jj)⋅2j33⁢j.

By lemma 1.7.1, we have

qj ≥(3⁢jj)⋅2j33⁢j=(3⁢j)!(2⁢j)!⋅j!⋅2j33⁢j
≥2⁢π⋅3⁢j⋅(3⁢j)3⁢j(2⁢2⁢π⋅2⁢j⋅(2⁢j)2⁢j)⋅(2⁢2⁢π⋅j⋅jj)⋅2j33⁢j
=38⁢π⋅12j⁢j=c2j⁢j.

Therefore, the lower bound for q, the probability for finding a satisfying assignment within 3⁢n steps, is

q =∑j∈[0,n]qj⋅Pr⁡[initial assignment has ⁢j⁢ mismatches]
≥∑j∈[0,n](3⁢jj)⋅2j33⁢j⋅(nj)⋅12n≥c2n⁢∑j∈[0,n]12j⁢j⋅(nj)
≥c2n⁢n⁢∑j∈[0,n](nj)⋅12j=cn⋅(34)n.

We now formulate the 3-SAT randomized algorithm from random walk as follows:

  • •

    Repeat up to m times:

    • –

      Pick a random truth assignment.

    • –

      Repeat up to 3⁢n times, terminating on all clauses satisfied:

      • *

        Choose an arbitrary unsatisfied clause.

      • *

        Choose uniformly at random a variable in the clause, and flip it.

  • •

    If the loop ends with a satisfying assignment, return it; otherwise, abort.

The expected number of rounds is at most 1/q=O⁢(n⁢(4/3)n), and the expected runtime is O⁢(n3/2⁢(4/3)n).

Similar to the 2-SAT randomized algorithm, we can make

m=b⋅2⁢nc⋅(43)n,

such that we have b segments, while one segment failing to find a satisfying assignment can be viewed as

Pr⁡[Z>2⁢nc⋅(43)n]<𝔼[Z]⋅c2⁢n⋅(34)n≤12,

by Markov inequality, where Z is a geometrically distributed random variable with success probability q.

Hence, the failing probability of finding a satisfying assignment for 3-SAT is at most 2−b.

Exercise 1.7.10 (Exercise 7.8 [MU17]).

Generalize the 3-SAT randomized algorithm to k-SAT algorithm, and write the expected runtime of the algorithm as a function of k.

Proof.

We reuse most of the notions in 3-SAT randomized algorithm, where S is a satisfying assignment, {At}t∈T is the assignment at tth time step, {Yt}t∈T is the Markov chain for the number of matches that

Pr⁡[Yt=1∣Yt−1=0] =1,
Pr⁡[Yt=j+1∣Yt−1=j] =1/k,
Pr⁡[Yt=j−1∣Yt−1=j] =1−1/k,

and {Zi}i∈[0,n] are the random variables for the steps to satisfy all clauses, from an initial assignment of i mismatches.

For k≥3, the random walk is always more likely to drift to less satisfied variables than more satisfied variables. Hence, the prior strategy of trying over a large variety of initial assignments, then repeat a small number of times each for random flipping, remains to apply. Therefore, the 3-SAT algorithm should still apply for k-SAT case.

Let qi be the probability for finding satisfying assignment from i mismatches in 3⁢n steps of random walk. Then

qi≥max2⁢ℓ+i≤3⁢n⁡(2⁢ℓ+iℓ)⁢(1k)ℓ+i⁢(k−1k)ℓ,

and therefore by lemma 1.7.1,

qi ≥(3⁢ii)⁢(1k)2⁢i⁢(k−1k)i
≥2⁢π⋅3⁢i⋅(3⁢i)3⁢i(2⁢2⁢π⋅2⁢i⋅(2⁢i)2⁢i)⋅(2⁢2⁢π⁢i⋅ii)⋅(k−1)ik3⁢i
=38⁢π⋅1i⋅(27⁢(k−1)4⁢k3)i=ci⋅(27⁢(k−1)4⁢k3)i

Let q be the probability for sampling a random initial assignment, then

q=∑i∈[0,n]qi⋅(ni)⋅12n≥c2n⁢n⁢∑i∈[0,n](ni)⋅(27⁢(k−1)4⁢k3)i=cn⁢(12+27⁢(k−1)8⁢k3)n.

Hence, the expected runtime for the k-SAT algorithm is

3⁢nq≤nc⁢(8⁢k34⁢k3+27⁢(k−1))n⋅3⁢n=a⋅3⁢n,

where a is the expected number of trials to the first satisfying assignment.

We set m=2⁢a⁢b for at least 1−2−b probability of outputting satisfying assignment on a satisfiable formula. ∎

Exercise 1.7.11 (Exercise 7.9 [MU17]).

The prior 3-SAT randomized algorithm analysis made pessimistic assumption that the current assignment At and the satisfying assignment S differ in one variable in the chosen unsatisfied clause. Instead, suppose that the 2 assignments disagree on 1 variable with probability p, and disagree on at least 2 variables with probability 1−p. What is the largest p, such that one can prove that the expected number of steps before the randomized 3-SAT stops is polynomial in n?

Proof.

We reuse most of the notions in 3-SAT randomized algorithm, where S is a satisfying assignment, {At}t∈T is the assignment at tth time step, {Yt}t∈T is the modified Markov chain for the number of matches that

Pr⁡[Yt=1∣Yt−1=0] =1,
Pr⁡[Yt=j+1∣Yt−1=j] =13⋅p+23⋅(1−p)=23−13⋅p,
Pr⁡[Yt=j−1∣Yt−1=j] =23⋅p+13⋅(1−p)=13+13⋅p,

and {Zi}i∈[0,n] are the random variables for the steps to satisfy all clauses, from an initial assignment of i mismatches. Then qj, the probability of finding a satisfying assignment within 3⁢n steps for initial j mismatches, has

qj ≥(3⁢jj)⁢(23−13⋅p)2⁢j⁢(13+13⋅p)j
≥2⁢π⋅3⁢j⋅(3⁢j)3⁢j(2⁢2⁢π⋅2⁢j⋅(2⁢j)2⁢j)⋅(2⁢2⁢π⁢j⋅jj)⋅((2−p)2⁢(1+p)27)j
=38⁢π⋅1j⋅((2−p)2⁢(1+p)4)j=cj⋅((2−p)2⁢(1+p)4)j.

Now the probability q for finding a satisfying assignment within 3⁢n steps is

q=∑j∈[0,n]qj⋅(nj)⋅12n≥c2n⁢n⁢∑j∈[0,n](nj)⋅((2−p)2⁢(1+p)4)j=cn⁢(12+(2−p)2⁢(1+p)8)n.

In this case, only when p=0 can make 1/q=𝗉𝗈𝗅𝗒⁢(n). ∎

Exercise 1.7.12 (Exercise 7.10 [MU17]).

A coloring of a graph is an assignment of a color to each of its vertices. A graph is k-colorable if there exists coloring such that no 2 adjacent vertices have the same color. Let G be 3-colorable.

  • •

    Show that there exists a 2-coloring for G such that no triangle is monochromatic.

  • •

    Consider the following 2-coloring randomized algorithm for G such that there is no monochromatic triangle. Start from any 2-coloring. If there are any monochromatic triangles, choose a random one and flip the color of a random vertex in the triangle. Find an upper bound for the expected number of steps in the algorithm.

Proof.

Let the 3-colorable graph G be given a proper 3-coloring such that no pair of adjacent vertices has the same color. Then any triangle in G must be colored in 3 distinct colors; otherwise at least one pair of adjacent vertices would have the same color, contradicting that G is 3-colorable. We randomly merge 2 colors from the 3-coloring into 1 color, then all the triangles are 2-colored, such that none of them are monochromatic.

The algorithm runtime analysis is similar to the one for the 3-SAT randomized algorithm. We define the satisfying coloring S, {At}t∈T as the coloring at time step t, {Yt}t∈T as the Markov chain for the number of matches that

Pr⁡[Yt=1∣Yt−1=0] =1,
Pr⁡[Yt=j+1∣Yt−1=j] =1/3,
Pr⁡[Yt=j−1∣Yt−1=j] =2/3,

and {Zi}i∈[0,n] as the random variables for the number of steps to match S fully from an initial coloring of i mismatches. We adopt the analysis for the unsuccessful 3-SAT randomized algorithm, and by conditional expectation,

𝔼[Zn] =0,
𝔼[Zj] =𝔼[Zj∣Yt+1=j−1]⋅Pj,j−1+𝔼[Zj∣Yt+1=j+1]⋅Pj,j+1
=1+2/3⋅𝔼[Zj−1]+1/3⋅𝔼[Zj+1],
𝔼[Z0] =1+𝔼[Z1].

By induction, 𝔼[Zj]=𝔼[Zj+1]+2j+2−3, and eventually

𝔼[Zj]=∑k∈[j,n−1](2k+2−3)=4⁢(2n−2j)−3⁢(n−j)=(2n+2−3⁢n)−(2j+2−3⁢j).

Let Z be the random variable for the number of steps in the algorithm, and Y be the random variable for the number of mismatches in the initial assignment, then by conditional expectation,

𝔼[Z] =∑j∈[0,n]𝔼[Z∣Y=j]⋅Pr⁡[Y=j]=∑j∈[0,n]𝔼[Zj]⋅(nj)⋅12n
=(2n+2−3⁢n)−12n⁢∑j∈[0,n](2j+2−3⁢j)⋅(nj)
=(2n+2−3⁢n)−4⁢(32)n+32n⁢∑j∈[0,n]j⋅(nj)
=(2n+2−3⁢n)−4⁢(32)n+3⁢n2=2n+2−4⁢(32)n−3⁢n2.

∎

Theorem 1.7.13 (Chapman-Kolmogorov Equation).

For a time-homogeneous Markov chain,

Pi,jm+n=∑kPi,km⋅Pk,jn.
Proof.
Pi,jm+n =Pr⁡[Xm+n=j∣X0=i]
=∑kPr⁡[Xm+n=j∣Xm=k]⋅Pr⁡[Xm=k∣X0=i]
=∑kPr⁡[Xn=j∣X0=k]⋅Pr⁡[Xm=k∣X0=i]=∑kPk,jn⋅Pi,km.

∎

Definition 1.7.14.

State j is accessible from state i if there exists some integer n≥0, Pi,jn>0. If state i,j are accessible from each other, we say they communicate by i↔j. The communicating relation defines an equivalence relation:

  • •

    Reflexive: For any state i, i↔i.

  • •

    Symmetric: If i↔j, then j↔i.

  • •

    Transitive: If i↔j and j↔k, then i↔k.

The communication relation partitions the states into disjoint equivalence classes, which are referred to as communicating classes. It might be possible to move from one class to another, but not in the other way around.

Definition 1.7.15.

A Markov chain is irreducible if all states belong to one communicating class.

Hence, a Markov chain is irreducible if for all ordered pair of states (i,j), the probability that state i can reach state j is nonzero. The next lemma is immediate.

Lemma 1.7.16.

A finite Markov chain is irreducible iff its graph representation is a strongly connected graph.

Definition 1.7.17.

Let ri,jt be the probability that, the first transition from state i to state j happens on the tth step:

ri,jt=Pr⁡[Xt=j∧⋀k∈[1,t−1]Xk≠j|X0=i].

A state is transient if ∑t≥1ri,it<1, and it is recurrent if ∑t≥1ri,it=1.

Definition 1.7.18.

Let Ti,j be the random variable for the steps to transition from i to j, and Ti,i be the random variable for the steps to return to i, such that Ti,i≥1.

Exercise 1.7.19 (Exercise 7.15 [MU17]).

Let Pi,it be the probability that a Markov chain returns to state i when started in state i after t steps. Prove that ∑t≥1Pi,it is unbounded iff state i is recurrent.

Proof.

We can express Pi,it in the following recursive way:

Pi,it=∑k∈[1,t]ri,ik⋅Pi,it−k,

where Pi,i0=1. Then the summation can be rearranged to

∑t≥1Pi,it =∑t≥1∑k∈[1,t]ri,ik⋅Pi,it−k
=(∑t≥1ri,it)⋅(∑k≥0Pi,ik)=(∑t≥1ri,it)⋅(∑k≥1Pi,ik)+(∑t≥1ri,it)
=(∑t≥1ri,it)⋅(1+∑k≥1Pi,ik).

In this way, ∑t≥1Pi,it being unbounded is equivalent to the state i being recurrent. ∎

Corollary 1.7.20.

If a state in a communicating class is transient (recurrent), then all states in the class are transient (recurrent).

Proof.

Suppose state i,j are in the same communicating class, and with integers c0,c1≥1 such that Pi,jc0>0, Pj,ic1>0. By theorem 1.7.13 and omitting the first c0+c1 terms,

∑τ≥1Pi,iτ≥∑τ≥1+c0+c1Pi,iτ=∑t≥1∑u,vPi,uc0⋅Pu,vt⋅Pv,ic1≥∑t≥1∑kPi,kc0⋅Pk,kt⋅Pk,ic1=∑kPi,kc0⋅Pk,ic1⋅∑t≥1Pk,kt≥Pi,jc0⋅Pj,ic1⋅∑t≥1Pj,jt,

where the fourth equality for changing summation sequence holds by probability being non-negative.

Then by 1.7.19, if state i is transient, then ∑t≥1Pj,jt has to be bounded, that state j is transient. Conversely, if state j is recurrent, then ∑t≥1Pi,it has to be unbounded, that state i is recurrent. The intuition follows.

Suppose state i is transient, then all the other states in the same communicating class have nonzero probability to reach i, and get out of the communicating class from i with nonzero probability, hence all of the states are transient.

On the other hand, supposing state i is recurrent but another state j is transient in the same communicating class, this is a contradiction as state i can reach state j and never get back to itself. Contradiction remains until no state in the communicating class is transient. ∎

Definition 1.7.21.

Let hi,i=∑t≥1t⋅ri,it be the expected time to return to i when starting at state i, and hi,j=∑t≥1t⋅ri,jt be the expected time to reach j from i. A recurrent state i is positive recurrent if hi,i<∞, otherwise it is null recurrent.

Corollary 1.7.22.

If i is transient, then hi,i=∞.

Proof.

Since i may never return by ∑t≥1ri,it<1, hence Pr⁡[Ti,i=∞]>0. ∎

Corollary 1.7.23.

If i is recurrent, then Pr⁡[Ti,i<∞]=1.

Proof.

Suppose Pr⁡[Ti,i=∞]>0 for recurrent i, then it contradicts with recurrence: ∑t≥1ri,it=1. ∎

Remark 1.7.24.

The convergence of hi,i differs positive recurrence from null recurrence, and Pr⁡[Ti,i=∞]=0 differs recurrence from transience.

Example 1.7.25.

Consider a finite Markov chain of states [1,2] with Pi,j=1/2 for all i,j∈[1,2]. The number of steps for “reaching state j” can be viewed as a geometrically distributed random variable, and hi,j=2.

However, consider a Markov chain over states ℤ+, that Pi,1+Pi,i+1=1 and Pi,1=(1+i)−1. Then

r1,1t=Pt,1⋅∏i∈[1,t−1]Pi,i+1=1t+1⋅∏i∈[1,t−1]ii+1=1t+1⋅1t=1t−1t+1.

Hence, ∑t≥1r1,1t=1, yet h1,1=∑t≥1t⋅r1,1t=∞.

Theorem 1.7.26.

Let i be recurrent, and suppose i can access j. Then j is recurrent, and both Ti,j and Tj,i are bounded with probability 1.

Proof.

If i can access j, then with non-zero probability i can transition to j. Supposing j is transient, by corollary 1.7.20 i,j are in different communicating classes, thus i↮j, hence Pj,iτ=0 for any τ≥1. Let Pi,jt>0 for some t≥1, then i returns to itself with probability at most 1−Pi,jt, contradicting with the recurrence of i. Thus, j is recurrent.

Since i and j communicate, for one path from i to j of length ℓ, let the probability of taking this path be q, then returning to i before reaching j has probability at most 1−q. By corollary 1.7.23, Pr⁡[Ti,i<∞]=1. Hence, we model this with a geometrically distributed random variable: on a coin flip, either success with probability at least q to reach j in n steps, or fail with probability at most 1−q to return to i in Ti,i steps. Hence, Pr⁡[Ti,j<∞]=1.

Suppose Pr⁡[Tj,i=∞]=p>0, then Pr⁡[Ti,i=∞]≥p⋅q>0, which is contradicting to i being recurrent. ∎

Lemma 1.7.27.

In a finite Markov chain, there is at least one recurrent state, and all recurrent states are positive recurrent.

Proof.

A finite directed graph G can be decomposed into a finite number of strongly connected components (SCCs). Contracting SCCs gives a finite DAG, which has at least one sink SCC. Hence, there must exist a closed SCC.

Such closed SCC with 0 out degree corresponds to a closed communicating class S, such that the subchain is a finite irreducible Markov chain, and the probability of transitioning out is 0.

For i∈S, ∑t≥1ri,it is the probability of i returning to itself. Let m be the integer such that Pr⁡[Tx,i≤m]>0 for all x∈S by the irreducibility and finiteness of S, then

Pr⁡[Ti,i>m]=1−Pr⁡[Ti,i≤m]≤1−minx∈S⁡Pr⁡[Tx,i≤m]=1−δ.

Moreover, by the Markovian property,

Pr⁡[Ti,i>(r+1)⁢m⁢∣Ti,i>⁢r⁢m]≤1−δ.

By the closure of S, we have Pr⁡[Ti,i>r⁢m]≤(1−δ)r after repeating r blocks of m steps, converging to 0 when r→∞, yielding ∑t≥1ri,it=1. By corollary 1.7.20, all i∈S are recurrent.

For any i∈S,

𝔼[Ti,i]=∑t≥1t⋅ri,it≤∑r≥0m⁢Pr⁡[Ti,i>r⁢m]≤m⁢∑r≥0(1−δ)r≤mδ.

Such a bound applies to all sink SCCs, so all recurrent states are positive recurrent. ∎

1.7.3 Strong Law of Large Numbers (SLLN)

We now introduce the Kolmogorov Strong Law of Large Numbers (SLLN), in contrast to theorem 1.3.11.

Theorem 1.7.28 (Kolmogorov SLLN).

Let {Xi}i≥1 be i.i.d. random variables with 𝔼[|X1|]<∞, and let μ=𝔼[X1].

Pr⁡[limn→∞1n⁢∑i∈[1,n]Xi=μ]=1.

We adopt the proof structure from [Ete81] and first prove a useful lemma.

Definition 1.7.29.

Let {An}n≥1 be a sequence of subsets of Ω. The supremum of {An}n≥k is

supn≥kAn=⋃n≥kAn.

The limit superior of {An}n≥1 is

lim supn→∞An=⋂n≥1⋃k≥nAk.

Equivalently, lim supn→∞An is the event that “for every cutoff n, there exists N≥n such that AN holds”. In other words, there are infinitely many indices n such that An holds, or equivalently, “An occurs infinitely often”.

Lemma 1.7.30 (Borel-Cantelli Lemma [Fel68a]).

Let {Ai}i≥1 be an infinite sequence of events. If ∑i≥1Pr⁡[Ai]<∞,

Pr⁡[lim supn→∞An]=0. (1.1)
Proof.

We notice a non-increasing sequence of sets by

lim supn→∞An⊆…⊆⋃k≥N+1Ak⊆⋃k≥NAk⊆…⊆⋃k≥2Ak⊆⋃k≥1Ak.

Hence, on an arbitrary N, we upper bound the probability by

Pr⁡[lim supn→∞An]≤Pr⁡[⋃k≥NAk]≤∑k≥NPr⁡[Ak],

the second inequality holds from union bounding, and the right hand side summation approaches to 0 as N→∞. ∎

Remark 1.7.31.

The event lim supn→∞An means that no matter how far into the sequence we go, there is always a later Ak that occurs. In other words, An keep occurring arbitrarily far out, or equivalently, occur infinitely often.

Hence, eq. 1.1 means that with probability 1, there exists a finite cutoff after which none of the events An occur. Equivalently, only finitely many of them occur.

Now we begin the proof for theorem 1.7.28.

Proof.

WLOG we let μ=𝔼[X1]=0, Yn=Xn⋅1≤n by Yn=0 if |Xn|>n, otherwise Yn=Xn, and Zn=Xn⋅1>n=Xn−Yn.

Since 𝔼[|X1|]<∞, and by {Xi} are i.i.d., we have

∞>𝔼[|X1|]≥∑t≥1Pr⁡[|X1|≥t]=∑t≥1Pr⁡[|Xt|≥t]≥∑t≥1Pr⁡[|Xt|>t]. (1.2)

By lemma 1.7.30 and remark 1.7.31, the eq. 1.2 means with probability 1, only finitely many indices i have |Xi|>i. Equivalently, with probability 1, there exists a finite cutoff N such that |Xn|>n does not occur for all n>N.

Hence, with probability 1, we have Zn=0 for all n>N, so only finitely many Zn are nonzero. Therefore,

Pr⁡[limn→∞1n⁢∑i∈[1,n]Zi=0]=1,

and what remains to show is

Pr⁡[limn→∞1n⁢∑i∈[1,n]Yi=0]=1.

Let Wi=Yi−𝔼[Yi], Sn=∑i∈[1,n]Wi, and m∈ℕ+, by Chebyshev’s inequality and the independence of {Xi},

Pr⁡[|S2m2m|≥ε] ≤Var⁢[S2m]ε2⋅22⁢m
=1ε2⋅22⁢m⁢∑i∈[1,2m]Var⁢[Wi]=1ε2⋅22⁢m⁢∑i∈[1,2m]Var⁢[Yi]
≤1ε2⋅22⁢m⁢∑i∈[1,2m]𝔼[Yi2].

We want to take advantage of Borel-Cantelli lemma 1.7.30 again by showing if

∑m≥1Pr⁡[|S2m2m|≥ε]≤∑m≥11ε2⋅22⁢m⁢∑i∈[1,2m]𝔼[Yi2]<∞,

then

Pr⁡[lim supm→∞|S2m2m|≥ε]=0,

that only a finite number of m≥1 has |S2m|≥ε⋅2m. There are 3 things remains to be proved:

Lemma 1.7.32.
∑m≥1122⁢m⁢∑i∈[1,2m]𝔼[Yi2]<∞.
Lemma 1.7.33.
Pr⁡[lim supm→∞max2m<n≤2m+1⁡|Sn−S2m2m|≥ε]=0.
Lemma 1.7.34.
limn→∞1n⁢∑i∈[1,n]𝔼[Yi]=0.

We begin with proof for lemma 1.7.34.

Proof.

We derive 𝔼[Yn]=𝔼[X1⋅1≤n]=−𝔼[X1⋅1>n], as we simplify by 𝔼[X1]=0. Hence, by Jensen’s inequality,

|𝔼[Yn]|≤|𝔼[X1⋅1>n]|≤𝔼[|X1|⋅1>n].

By monotone convergence, we have 𝔼[|X1|⋅1≤n]→𝔼[|X1|] as n→∞. Since

𝔼[|X1|]=𝔼[|X1|⋅1>n]+𝔼[|X1|⋅1≤n]<∞

and |X1|⋅1≤n≥0, we have 𝔼[|X1|⋅1>n]→0 as n→∞.

By Cesàro summation, that if an→0 as n→∞, then 1/n⋅∑an→0, thus

0≤|1n⁢∑i∈[1,n]𝔼[Yi]|≤1n⁢∑i∈[1,n]|𝔼[Yi]|≤1n⁢∑i∈[1,n]𝔼[|X1|⋅1>i]→0,

which completes the proof. ∎

Now we move on by proving lemma 1.7.32.

Proof.

Noticing that for real valued random variable Xk,

Yk2=X12⋅1≤k≤∑m∈[1,k](2⁢m−1)⋅1>m−1,

since when |X1|≤k, the right hand side is ⌈|X1|⌉2≥X12, and when |X1|>k, the left hand side is 0. Hence,

𝔼[Yk2]=𝔼[X12⋅1≤k]≤∑m∈[1,k](2⁢m−1)⋅Pr⁡[|X1|>m−1]. (1.3)

Relaxing the summation, then let pt be the first p such that 2p≥t,

∑m≥1122⁢m⁢∑t∈[1,2m]𝔼[Yt2]=∑t≥1𝔼[Yt2]⁢∑m:2m≥t122⁢m=43⁢∑t≥1𝔼[Yt2]⋅122⁢pt≤43⁢∑t≥1𝔼[Yt2]⋅1t2. (1.4)

Applying the eq. 1.3 to eq. 1.4,

∑t≥11t2⋅𝔼[Yt2] ≤∑t≥11t2⁢∑m∈[1,t](2⁢m−1)⋅Pr⁡[|X1|>m−1]
=∑m≥1(2⁢m−1)⋅Pr⁡[|X1|>m−1]⋅∑t≥m1t2.

By integration,

∑t≥m1t2≤∫m−12∞d⁢tt2=22⁢m−1,

then

∑m≥1(2⁢m−1)⋅Pr⁡[|X1|>m−1]⋅∑t≥m1t2 ≤2⁢∑m≥1Pr⁡[|X1|>m−1]
≤2⁢(1+𝔼[|X1|])<∞,

which completes the proof. ∎

We introduce Etemadi Inequality [Ete81] for proof of lemma 1.7.33.

Lemma 1.7.35 (Etemadi Inequality [Ete81]).

Let {Xi}i∈[1,n] be i.i.d. real-valued random variables defined over some common probability space, and let α≥0, then

Pr⁡[maxk∈[1,n]⁡|∑i∈[1,k]Xi|≥3⁢α]≤3⁢maxk∈[1,n]⁡Pr⁡[|∑i∈[1,k]Xi|≥α].

For lemma 1.7.33, the proof follows.

Proof.

We show only finite many m have max2m<n≤2m+1⁡|Sn−S2m|≥3⁢ε⋅2m by lemma 1.7.30, then by lemma 1.7.35,

∑m≥1Pr⁡[max2m<n≤2m+1⁡|Sn−S2m2m|≥3⁢ε]≤3⁢∑m≥1max2m<n≤2m+1⁡Pr⁡[|Sn−S2m2m|≥ε]. (1.5)

Again by Chebyshev’s inequality,

max2m<n≤2m+1⁡Pr⁡[|Sn−S2m2m|≥ε]≤max2m<n≤2m+1⁡Var⁢[Sn−S2m]ε2⋅22⁢m=max2m<n≤2m+1⁡1ε2⋅22⁢m⁢∑i∈[2m+1,n]Var⁢[Wi]=1ε2⋅22⁢m⁢∑i∈[1,2m]Var⁢[W2m+i]≤1ε2⋅22⁢m⁢∑i∈[1,2m]𝔼[Y2m+i2]. (1.6)

The second equality holds by linearity of variance of independent random variables, the third equality holds by the non-negativity of variance, and the last inequality holds by

Var⁢[Wi]=Var⁢[Yi]≤𝔼[Yi2].

By lemma 1.7.32, the right hand side upper bound of eq. 1.6 is summable by

∑m≥11ε2⋅22⁢m⁢∑i∈[1,2m]𝔼[Y2m+i2]≤∑m≥14ε2⋅22⁢(m+1)⁢∑i∈[1,2m+1]𝔼[Yi2]<∞,

finishes upper bounding the left hand side of eq. 1.5,

∑m≥1Pr⁡[max2m<n≤2m+1⁡|Sn−S2m2m|≥3⁢ε]<∞,

then we conclude lemma 1.7.33 by lemma 1.7.30, that

Pr⁡[lim supm→∞max2m<n≤2m+1⁡|Sn−S2m2m|≥ε]=0.

∎

Corollary 1.7.36.

For every ε>0,

Pr⁡[lim supn→∞|Snn|≥ε]=0.
Proof.

By Chebyshev’s inequality,

Pr⁡[|S2m2m|≥ε2]≤4ε2⋅22⁢m⁢∑i∈[1,2m]𝔼[Yi2].

Hence,

∑m≥1Pr⁡[|S2m2m|≥ε2]<∞

by lemma 1.7.32. Therefore, by lemma 1.7.30,

Pr⁡[lim supm→∞|S2m2m|≥ε2]=0.

Moreover, for 2m<n≤2m+1, by triangle inequality

|Sn2m|≤|Sn−S2m2m|+|S2m2m|,

so

{lim supm,n→∞2m<n≤2m+1|Sn2m|≥ε}⊆{lim supm→∞max2m<n≤2m+1⁡|Sn−S2m2m|≥ε2}∪{lim supm→∞|S2m2m|≥ε2}.

Since 2m<n implies |Sn/n|≤|Sn/2m|, we have

{lim supn→∞|Snn|≥ε}⊆{lim supm,n→∞2m<n≤2m+1|Sn2m|≥ε}.

Therefore, by lemma 1.7.33,

Pr⁡[lim supn→∞|Snn|≥ε]=0.

∎

To complete the proof for Kolmogorov SLLN theorem 1.7.28, by corollary 1.7.36,

Pr⁡[lim supn→∞|Snn|≥ε]=0.

Since ε>0 was arbitrary, we conclude that

Pr⁡[limn→∞Snn=0]=1.

On the other hand, by lemma 1.7.34,

limn→∞1n⁢∑i∈[1,n]𝔼[Yi]=0.

Therefore, on the event {limn→∞Sn/n=0}, we have

limn→∞1n⁢∑i∈[1,n]Yi=limn→∞(Snn+1n⁢∑i∈[1,n]𝔼[Yi])=0,

so

Pr⁡[limn→∞1n⁢∑i∈[1,n]Yi=0]=1.

Together with

Pr⁡[limn→∞1n⁢∑i∈[1,n]Zi=0]=1,

and Xi=Yi+Zi, we conclude that

Pr⁡[limn→∞1n⁢∑i∈[1,n]Xi=0]=1.

∎

Definition 1.7.37 (Stopping Time).

Let {Xt}t≥0 be a discrete-time stochastic process. A non-negative integer-valued random variable T is a stopping time if for every n≥0, whether event T=n occurs is determined only by X0,…,Xn.

Definition 1.7.38 (Strong Markov Property for Discrete-Time Markov Chains).

Let {Xt}t≥0 be a discrete-time Markov chain. We say that {Xt}t≥0 satisfies the strong Markov property if for every stopping time T with Pr⁡[T<∞]=1, conditional on T=n and the history

X0=x0,X1=x1,…,Xn−1=xn−1,Xn=i,

the shifted process {XT+m}m≥0 has the same distribution as the original chain started from the state i.

Theorem 1.7.39.

Any discrete-time, time-homogeneous Markov chain satisfies the strong Markov property.

Proof.

Take any states x0,…,xn−1,i,j1,…,jr, and any time steps n≥0 and 0≤m1<⋯<mr. We show that conditional on T=n and the history X0=x0,…,Xn=i, the shifted process has the same finite-dimensional distributions as the original chain started from state i. Since event T=n is in the condition,

Pr⁡[XT+m1=j1,…,XT+mr=jr∣T=n,X0=x0,…,Xn−1=xn−1,Xn=i]
=Pr⁡[Xn+m1=j1,…,Xn+mr=jr∣X0=x0,…,Xn−1=xn−1,Xn=i].

By the Markov property applied successively,

Pr⁡[Xn+m1=j1,…,Xn+mr=jr∣X0=x0,…,Xn−1=xn−1,Xn=i]
=Pr⁡[Xn+m1=j1∣Xn=i]⋅∏ℓ∈[2,r]Pr⁡[Xn+mℓ=jℓ∣Xn+mℓ−1=jℓ−1].

By time-homogeneity in definition 1.7.4, this equals

Pr⁡[Xm1=j1∣X0=i]⋅∏ℓ∈[2,r]Pr⁡[Xmℓ−mℓ−1=jℓ∣X0=jℓ−1],

which is exactly

Pr⁡[Xm1=j1,…,Xmr=jr∣X0=i].

Therefore, conditional on T=n and the history up to time n, the shifted process {XT+m}m≥0 has the same finite-dimensional distributions as the original chain started from state i. Hence it has the same distribution, and the chain satisfies the strong Markov property. ∎

Theorem 1.7.40 (SLLN for Markov chains).

Let {Xt}t∈T be a Markov chain, with X0=i, and states i,j communicating. Let 1i,jt be the indicator random variable for the event Xt=j given X0=i. Then the limiting fraction of time spent in state j is hj,j−1, that is,

Pr⁡[limn→∞1n⁢∑t∈[1,n]1i,jt=1hj,j]=1.
Proof.

If i is transient, and i,j are in same communicating class, then by corollary 1.7.20, j is also transient. Intuitively, there are only finitely many times that i can reach j. We can show by a similar trick in corollary 1.7.20, and let n be a number of steps such that Pj,in>0, then

∞>∑τ≥1Pi,iτ≥∑τ≥n+1Pi,iτ=∑t≥1∑kPi,kt⋅Pk,in≥∑t≥1Pi,jt⋅Pj,in=Pj,in⋅∑t≥1Pi,jt=Pj,in⋅∑t≥1𝔼[1i,jt].

Since ∑t𝔼[1i,jt]<∞, then ∑t1i,jt=∞ with probability 0, hence the left hand side is 0. By corollary 1.7.22, hj,j=∞, thus the right hand side is 0. Hence, the transient case is proved.

If i is recurrent, then i,j are both recurrent by corollary 1.7.20.

We first handle the positive recurrent case, and start with the special case when i=j. Suppose that j is positive recurrent, so hj,j<∞. Let R0=0, and for each c≥1, let Rc be the time of the cth visit to state j, where

Rc=min⁡{t>Rc−1∣Xt=j},

Then the cycle lengths are

Cc=Rc−Rc−1,

and consequently, Rc is the total length of the first c cycles:

Rc=∑k∈[1,c]Ck.

One checks that each Rc is a stopping time by definition 1.7.37. Then by the strong Markov property theorem 1.7.39 at the successive return times to j and by time-homogeneity, the random variables {Cc}c≥1 are i.i.d., with 𝔼[C1]=hj,j.

Let kn be the largest number of cycles such that Rkn≤n by

kn=max⁡{k∣Rk≤n}.

Hence, Rkn≤n<Rkn+1 by definition, and consequently,

Rknkn≤nkn≤Rkn+1kn.

Since j is recurrent, we have kn→∞ as n→∞. Then, by SLLN theorem 1.7.28,

Pr⁡[limk→∞Rkk=limk→∞1k⁢∑c∈[1,k]Cc=hj,j]=1,

and

limk→∞Rk+1k=limk→∞Rk+1k+1⋅k+1k=limk→∞Rk+1k+1. (1.7)

Hence, when i=j,

Pr⁡[limn→∞knn=limn→∞1n⁢∑t∈[1,n]1j,jt=1hj,j]=1.

We next handle the null recurrent case when i=j. Suppose that j is null recurrent, so hj,j=∞. Reuse the same notations {Rc}c≥0, {Cc}c≥1, and {kn}n≥1. For each positive integer m, define the truncated cycle lengths

Cc(m)=min⁡(Cc,m).

Since {Cc}c≥1 are i.i.d., the bounded random variables {Cc(m)}c≥1 are also i.i.d. Hence, by SLLN theorem 1.7.28,

Pr⁡[limk→∞1k⁢∑c∈[1,k]Cc(m)=𝔼[C1(m)]]=1.

Since 𝔼[C1(m)] increases monotonically as m→∞, by monotone convergence, 𝔼[C1(m)]→𝔼[C1]=hj,j=∞ by null recurrence. Then, for any positive integer α, there exists a sufficiently large m such that 𝔼[C1(m)]>α.

Pr⁡[limk→∞1k⁢∑c∈[1,k]Cc(m)>α]=1.

Since for each fixed m, Cc(m)≤Cc pointwise, then

Rk=∑c∈[1,k]Cc≥∑c∈[1,k]Cc(m).

Hence, for any fixed positive integer α,

Pr⁡[lim infk→∞Rkk>α]=1.

Since this holds for every positive integer α, we conclude that

Pr⁡[limk→∞Rkk=∞]=1.

Since j is recurrent, we still have kn→∞ as n→∞, and n≥Rkn. By prior squeezing argument eq. 1.7, when i=j,

Pr⁡[limn→∞knn=0]=1.

For the general recurrent case when i≠j, let Ti,j be the first hitting time from i to j. By the strong Markov property at time Ti,j, the path after time Ti,j behaves like a fresh copy of the chain started from j. Thus the path consists of an initial segment of length Ti,j, after which the chain proceeds through successive j-cycles. Let kn=∑t∈[1,n−Ti,j]1j,jt for the cycles before n−Ti,j steps, then

Rkn+Ti,jkn≤nkn<Rkn+1+Ti,jkn.

By theorem 1.7.26, Pr⁡[Ti,j<∞]=1, and thus

Pr⁡[limk→∞Ti,jk=0]=1,

hence the same squeezing argument eq. 1.7 as in the i=j case yields

Pr⁡[limn→∞1n⁢∑t∈[1,n]1i,jt=1hj,j]=1.

∎

Theorem 1.7.41 (Bounded Convergence Theorem).

For a sequence of random variables {Xi}i≥1, if

Pr⁡[limn→∞Xn=X]=1

and there exists a finite b such that |Xn|≤b for all n, then

limn→∞𝔼[Xn]=𝔼[X].
Corollary 1.7.42 (Cesàro Limit of Return Probability).

Let {Xt}t∈T be an irreducible Markov chain, then for any state i,j,

limn→∞1n⁢∑t∈[1,n]Pi,jt=1hj,j.
Proof.
limn→∞1n⁢∑t∈[1,n]Pi,jt=limn→∞1n⁢∑t∈[1,n]𝔼[1i,jt]=limn→∞𝔼[1n⁢∑t∈[1,n]1i,jt]=𝔼[limn→∞1n⁢∑t∈[1,n]1i,jt]=1hj,j,

where the first 2 equalities are from linearity of expectation, and the third equality is from theorem 1.7.41. ∎

Lemma 1.7.43.

Positive recurrence and null recurrence are class properties.

Proof.

By corollary 1.7.20, states in a communicating class S are either all recurrent or all transient. Hence, we focus on recurrent class. Let state i,j be in S, and on t0,t1>0 we have Pi,jt0,Pj,it1>0. By corollary 1.7.42 and theorem 1.7.13,

1hi,i=limn→∞1n⁢∑t∈[1,n]Pi,it ≥limn→∞1n⁢∑t∈[t0+t1+1,n]Pi,it
≥Pi,jt0⋅Pj,it1⋅limn→∞1n⁢∑t∈[1,n−t0−t1]Pj,jt
=Pi,jt0⋅Pj,it1⋅limn→∞n−t0−t1n⋅1n−t0−t1⁢∑t∈[1,n−t0−t1]Pj,jt
=Pi,jt0⋅Pj,it1⋅limn→∞1n⁢∑t∈[1,n]Pj,jt=Pi,jt0⋅Pj,it1⋅1hj,j.

The proof idea goes similar to corollary 1.7.20. If i is null recurrent by hi,i−1=0, then j has to be null recurrent; conversely, if j is positive recurrent with hj,j−1>0, then hi,i−1>0 means i is positive recurrent. ∎

1.7.4 Stationary Distributions

Definition 1.7.44.

A state j in a discrete time Markov chain 𝐗={Xt} is periodic if there exists an integer Δ>1

Pr⁡[Xt+s=j∣Xt=j]=0

unless Δ∣s. 𝐗 is periodic if ∃Δ>1 such that all states have period Δ. Otherwise, a state or chain is aperiodic.

Example 1.7.45.

For a discrete time Markov chain defined over ℤ, that i transitions to i±1 with probability 1/2 each, the discrete time Markov chain is periodic as Δ=2.

Definition 1.7.46.

An aperiodic, positive recurrent state is ergodic. A Markov chain is ergodic if all states are ergodic.

Corollary 1.7.47.

Any finite, irreducible, aperiodic Markov chain is an ergodic Markov chain.

Lemma 1.7.48 (Ergodic Limit of Return Probability).

Let {Xt}t∈T be an irreducible ergodic Markov chain, the limt→∞Pi,it exists for any state i, and

limt→∞Pi,it=hi,i−1.
Definition 1.7.49 (Discrete Renewal Equation).

Discrete convolution for sequences 𝐚={ai}i≥0 and 𝐛={bi}i≥0 is

(𝐚∗𝐛)n=∑k∈[0,n]ak⋅bn−k.

A renewal kernel is a probability mass function 𝐟={fi}i≥1 on positive integer such that each fi≥0 and ∑i≥1fi=1. Given a forcing sequence 𝐠={gi}i≥0, a sequence 𝐮={ui}i≥0 solves the renewal equation if

un=gn+∑i∈[1,n]fi⋅un−i=gn+(𝐟∗𝐮)n−1.
Theorem 1.7.50 (Discrete Key Renewal Theorem [Fel68b]).

Let μ=∑t≥1t⋅ft, and the span for 𝐟 be d=gcd{fk>0}k≥1. If d=1 then 𝐟 is aperiodic. Supposing 𝐟 is aperiodic and μ<∞, and 𝐠={gi}i≥0 is absolutely summable by ∑i≥0|gi|<∞. Let 𝐮={ui}i≥0 be the unique bounded solution to the renewal equation by un=gn+(𝐟∗𝐮)n−1, then the limit exists by

limn→∞un=1μ⁢∑i≥0gi.

The proof for lemma 1.7.48 is immediate by theorem 1.7.50.

Proof.

Given an irreducible ergodic Markov chain, suppose X0=i, then Pi,in can be derived as a renewal equation by

Pi,in=∑t∈[1,n]ri,it⋅Pi,in−t=({ri,it}t≥1∗{Pi,it}t≥0)n−1,

and the “forcing sequence” is ri,i0=1 follows 0s, as Pi,i0=ri,i0=1, thus the absolute sum is 1. Since the Markov chain is ergodic, then {ri,it}t≥1 is aperiodic and μ=hi,i<∞. Hence,

limn→∞Pi,in=1hi,i.

∎

Example 1.7.51.

Consider a sequence of fair, independent gambling games between 2 gamblers. One wins or loses a dollar with probability 1/2. The state of the chain at time t is the number of dollars won. Start from initial state 0.

We assume that a player loses by −ℓ1 dollars and wins by ℓ2 dollars. Hence, these are the only 2 recurrent states, while the others are transitioning out to either −ℓ1 or ℓ2. We write Pit for the probability of i dollars at the tth steps. Let s be one of the transient states, then limt→∞Pit=0. Hence, let q=limt→∞P−ℓ1t, then limt→∞Pℓ2t=1−q.

Let Wt be the random variable for the gain of the player at the tth step, where the game has not stopped yet. On one hand, the games are fair, then by linearity of expectation, 𝔼[Wt]=0. On the other hand,

𝔼[Wt]=∑i∈[−ℓ1,ℓ2]i⋅Pit=−ℓ1⋅q+ℓ2⋅(1−q)=0.

Therefore, q=ℓ2/(ℓ1+ℓ2).

Definition 1.7.52.

A stationary (equilibrium) distribution of a Markov chain is a distribution 𝒟𝝅 such that 𝝅=𝐏𝖳⁢𝝅.

Theorem 1.7.53.

Any finite, irreducible, ergodic Markov chain has the following properties:

  • •

    The chain has a stationary distribution 𝒟𝝅 such that 𝝅=[π1,…,πn]𝖳.

  • •

    For all i,j∈[1,n], the limt→∞Pj,it exists, and is independent of j.

  • •

    πi=limt→∞Pj,it=hi,i−1 for all j∈[1,n].

Remark 1.7.54.

The theorem gives 2 interpretations for the stationary distribution 𝒟𝝅:

  • •

    If we run the finite, irreducible, ergodic Markov chain sufficiently long, then the initial state is forgotten, and the probability of being in state i is given by πi.

  • •

    Given the prior observation of forgetting the initial state, then the limiting probability of Pi,it being hi,i−1 becomes reasonable, that any initial state ends up in state i at the tth step has same probability of πi=Pi,it. Since hi,i is the average returning time from state i, then we should expect to be in state i with probability hi,i−1.

The proof for theorem 1.7.53 is immediate by lemma 1.7.48, together with showing limt→∞Pj,it=limt→∞Pi,it.

Proof.

Given a state j that j≠i, then similar to 1.7.19, we write

Pj,it=∑k∈[1,t]rj,ik⋅Pi,it−k.

Then for a t1≤t, we have

limt→∞Pj,it=limt→∞∑k∈[1,t]rj,ik⋅Pi,it−k≥limt→∞∑k∈[1,t1]rj,ik⋅Pi,it−k=limt→∞Pi,it⁢∑k∈[1,t1]rj,ik≥(1−ε)⋅limt→∞Pi,it.

On the other hand, since ∑k∈[1,t1]rj,ik≥1−ε, which leads to

limt→∞Pj,it =limt→∞∑k∈[1,t1]rj,ik⋅Pi,it−k+limt→∞∑k∈[t1+1,t]rj,ik⋅Pi,it−k
≤limt→∞∑k∈[1,t1]rj,ik⋅Pi,it−k+limt→∞∑k∈[t1+1,t]rj,ik
≤limt→∞Pi,it⁢∑k∈[1,t1]rj,ik+ε
≤limt→∞Pi,it+ε.

Since ε≥∑k>t1rj,ik, as t1<t approaches ∞, ε→0, which proves the limiting probability of Pj,it is independent of j.

We now show ∑πi=1 and ⟨𝝅,[P1,i,…,Pn,i]𝖳⟩=πi for all i∈[1,n] to complete the proof. Fix a state j∈[1,n],

∑i∈[1,n]πi=∑i∈[1,n]limt→∞Pi,it=∑i∈[1,n]limt→∞Pj,it=1,

and by theorem 1.7.13,

∑k∈[1,n]πk⋅Pk,i=∑k∈[1,n]limt→∞Pk,kt⋅Pk,i=∑k∈[1,n]limt→∞Pj,kt⋅Pk,i=limt→∞Pj,it+1=limt→∞Pi,it+1=πi.

Together with lemma 1.7.48, we complete the proof. ∎

Remark 1.7.55.

Being aperiodic in being ergodic is not necessary for the existence of the stationary distribution, but in this case, it is not the limiting probability, but rather the long term frequency of visiting states.

Theorem 1.7.56.

Let S be a set of states in a finite, irreducible, ergodic Markov chain. In the stationary distribution, the probability of leaving the state is equal to the probability of entering the state.

Proof.

Let there be a state i∈[1,n] for the finite, irreducible, ergodic Markov chain, then by stationary distribution

⟨𝝅,[P1,i,…,Pn,i]𝖳⟩=πi=πi⋅∑j∈[1,n]Pi,j,

that the invariant reaches by

∑j≠iπj⋅Pj,i=∑j≠iπi⋅Pi,j.

By generalizing to the subset S, the proof is completed. ∎

Remark 1.7.57.

The theorem 1.7.56 gives another way of deriving stationary distribution of 𝐏 on a graph perspective. The cut-set around state i holds an invariant of ∑j≠iπj⋅Pj,i=∑j≠iπi⋅Pi,j. If C is a cut-set around S⊆[1,n], then in stationary distribution the probability crossing the cut in one direction is equivalent to the probability crossing the cut in the other direction.

Theorem 1.7.58.

Consider a finite, irreducible, ergodic Markov chain with a transition matrix 𝐏. If there are nonnegative 𝛑 such that ∑iπi=1, and if any pairs i,j∈[1,n] such that πj⋅Pj,i=πi⋅Pi,j, then 𝛑 is a stationary distribution 𝒟𝛑 for 𝐏. Chains satisfying the condition are time reversible.

Theorem 1.7.59.

An irreducible, aperiodic Markov chain belongs to one of the following two categories:

  • •

    The chain is ergodic: For any pair of states i,j, limt→∞Pj,it exists and is independent of j, and 𝒟𝝅 has πi=limt→∞Pj,it>0.

  • •

    The chain has no positive recurrent state: For any state i, limt→∞Pi,it=0, and the chain has no 𝒟𝝅.

Proof.

Immediate by lemma 1.7.43, states in an irreducible ergodic Markov chain are either all positive recurrent or all null recurrent. Hence, by lemma 1.7.48, if the irreducible aperiodic Markov chain is positive recurrent,

limt→∞Pi,it=1hi,i.

Showing the limiting probability Pj,it is independent of j can be done by the same sandwiching trick in theorem 1.7.53.

Otherwise, the limiting recurrent probability of a null recurrent Markov chain has to be 0. By corollary 1.7.42,

limn→∞1n⁢∑i∈[1,n]Pj,it=0,

since hi,i=∞ for null recurrent states. limt→∞Pj,it>0 contradicts the Cesàro summation, hence limt→∞Pj,it=0. ∎

Remark 1.7.60.

Irreducibility and ergodicity leads to convergence, existence and uniqueness of stationary distribution. For both finite and countably infinite Markov chains, both needs to be irreducible and aperiodic, but in finite case, positive recurrence derive from the finiteness, hence the ergodicity derive from aperiodicity and positive recurrence, while the countably infinite case need to decide if the states are positive recurrent.

Exercise 1.7.61 (Exercise 7.11 [MU17]).

An n×n matrix 𝐏 is called stochastic if all entries are nonnegative and the sum of each row is 1. It is doubly stochastic if the sum of each column is 1. Show that the uniform distribution is a stationary distribution for any Markov chain represented by a doubly stochastic matrix.

Proof.

Supposing

∑j∈[1,n]Pi,j=∑j∈[1,n]Pj,i=1

for a doubly stochastic matrix, then the stationary distribution {πi}i∈[1,n] has

∑j∈[1,n]πj⋅Pj,i=1n=πi

for an arbitrary i∈[1,n], which completes the proof. ∎

Exercise 1.7.62 (Exercise 7.12 [MU17]).

Let Xn be the sum of n independent fair dice rolls. Show that for any k≥2,

limn→∞Pr⁡[Xn≡0(modk)]=1k.
Proof.

Let the current accumulation be Xn, Yn=Xn(modk) be the accumulation modulo k, and Pi,j be the transition probability over k states of Yn, then Pi,j can be represented as follows

Pi,j=∑α∈[1,6]i+α≡j(modk)16.

Hence, Pa,b=Pb,c if a+α≡b(modk) and b+α≡c(modk). Moreover, we discover the invariant of

∑j∈[0,k−1]Pj,i=∑j∈[0,k−1]P0,j=1,

making the uniform distribution the stationary distribution by 1.7.61.

The chain is irreducible, as any 2 states can be reached from each other. The chain is also aperiodic, by existence of path of length k−1: rolling 1 for exactly k−2 times and 2 for a time, and path of length k: rolling 1 for k times. Since gcd⁡(k,k−1)=1, the chain is aperiodic, and hence it is ergodic. By theorem 1.7.53,

limn→∞Pr⁡[Xn≡0(modk)]=limn→∞P0,0n=1k.

∎

Exercise 1.7.63 (Exercise 7.13 [MU17]).

Consider a finite n state Markov chain with stationary distribution 𝝅 and transition probability Pi,j. Starting at time 0 and running for m states, obtaining a sequence of states X0,X1,…,Xm. Consider the states in reverse order, Xm,…,X1,X0.

  • •

    Argue that given Xt+1, Xt is independent of Xt+2,…,Xm, that the reverse sequence is Markovian.

  • •

    Argue that for the reverse sequence, the transition probability is given by

    Qi,j=πj⋅Pj,iπi.
  • •

    Show that if the original Markov chain is time reversible, that πi⋅Pi,j=πj⋅Pj,i, then Qi,j=Pi,j: the state follows the same transition probability, whether viewed in forward order or reverse order.

Proof.

We already know the Markovian by

Pr⁡[Xt+1=st+1∣Xt=st,…,X1=s1,X0=s0]=Pr⁡[Xt+1=st+1∣Xt=st].

By Bayes’ rule,

Pr⁡[Xt=st∣Xt+1=st+1,…,Xm=sm]=Pr⁡[Xt=st,…,Xm=sm]Pr⁡[Xt+1=st+1,…,Xm=sm],

the numerator can be decomposed by

Pr⁡[Xt=st,…,Xm=sm]=Pr⁡[Xt=st]⋅Pr⁡[Xt+1=st+1∣Xt=st]⁢⋯⁢Pr⁡[Xm=sm∣Xm−1=sm−1],

and the denominator can be decomposed by

Pr⁡[Xt+1=st+1,…,Xm=sm]=Pr⁡[Xt+1=st+1]⋅Pr⁡[Xt+2=st+2∣Xt+1=st+1]⁢⋯⁢Pr⁡[Xm=sm∣Xm−1=sm−1].

Hence, we prove the independence by

Pr⁡[Xt=st∣Xt+1=st+1,…,Xm=sm]=Pr⁡[Xt=st,Xt+1=st+1]Pr⁡[Xt+1=st+1]=Pr⁡[Xt=st∣Xt+1=st+1].

Given 2 states i,j, when t→∞,

limt→∞Pr⁡[Xt=j∣Xt+1=i]=limt→∞Pr⁡[Xt=j,Xt+1=i]Pr⁡[Xt+1=i]=limt→∞Pr⁡[Xt+1=i∣Xt=j]⋅Pr⁡[Xt=j]Pr⁡[Xt+1=i],

hence

Qi,j=πj⋅Pj,iπi.

If the chain is time reversible, then it is straightforward that Qi,j=Pi,j by swapping in πj⋅Pj,i=πi⋅Pi,j. ∎

Exercise 1.7.64 (Exercise 7.18 [MU17]).

Consider a random walk over 1/2/3-dimensional integer lattice, is each state transient, null recurrent, or positive recurrent? 333 A drunk man will find his way home, but a drunk bird may get lost forever. — Shizuo Kakutani

Proof.

Consider the 1-dimensional random walk, and the particle returns to 0 only on even length steps. Hence,

P0,02⁢m=122⁢m⋅(2⁢mm)≥122⁢m⋅2⁢π⋅2⁢m⋅(2⁢m)2⁢m(2⁢π⋅m+1)2⋅m2⁢m≥12⁢π⋅2⁢m,

where the second inequality holds from lemma 1.7.1, and the third inequality holds from 2⁢π⋅2⁢m>2⁢π⋅m+1. By 1.7.19, that

∑t≥1P0,0t=∑m≥1P0,02⁢m≥12⁢π⋅∑m≥11m

is unbounded, and hence the 1-dimensional random walk is at least recurrent by corollary 1.7.20.

When we expand to 2-dimensional random walk, we want to show the probability of P02,022⁢m from P0,02⁢t by

P02,022⁢m =∑a+b=m122⁢m⋅(2⁢m2⁢a)⋅P0,02⁢a⋅P0,02⁢b
=∑a+b=m122⁢m⋅(2⁢m2⁢a)⋅122⁢m⋅(2⁢aa)⁢(2⁢bb)
=142⁢m⋅∑a+b=m(2⁢m)!(2⁢b)!⋅(2⁢a)!⋅(2⁢a)!(a!)2⋅(2⁢b)!(b!)2
=142⁢m⋅∑a+b=m(2⁢mm)⁢(ma)⁢(mb)=142⁢m⋅(2⁢mm)2=(P0,02⁢m)2,

hence the 2-dimensional random walk is also at least recurrent by corollary 1.7.20 and

∑t≥1P02,02t=∑m≥1P02,022⁢m=∑m≥1(P0,02⁢m)2≥14⁢π⋅∑m≥11m=∞.

For a random walk of dimension d≥3, the exact probability of recurrence after 2⁢m moves is

P0d,0d2⁢m =∑a1+⋯+ad=m1d2⁢m⋅(2⁢m2⁢a1)⁢⋯⁢(2⁢ad−1+2⁢ad2⁢ad−1)⋅P0,02⁢a1⁢⋯⁢P0,02⁢ad
=1(2⁢d)2⁢m⋅∑a1+⋯+ad=m(2⁢m2⁢a1;⋯;2⁢ad−1)⋅(2⁢a1a1)⁢⋯⁢(2⁢adad)
=1(2⁢d)2⁢m⋅∑a1+⋯+ad=m(2⁢m)!(a1!)2⁢⋯⁢(ad!)2

that is choosing each operation out of 2⁢m moves over d dimensions, then each dimension contains only even moves, with the probability of returning to 0 after the even moves; or equivalently, for 2⁢m moves, each choose 1 out of 2×d directions, and each opposite directions should have same amount of moves. We simplify further by noticing

∑a1+⋯+ad=m(ma1;⋯;ad)=dm,

and hence

P0d,0d2⁢m=122⁢m⋅(2⁢mm)⁢∑a1+⋯+ad=m(ma1;⋯;ad)2⋅1d2⁢m≤122⁢m⋅(2⁢mm)⁢maxa1+⋯+ad=m⁡(ma1;⋯;ad)⋅1dm.

For fixed dimension d, the multinomial coefficient is maximized when the ai are as balanced as possible, and

maxa1+⋯+ad=m⁡(ma1;⋯;ad)=Θ⁢(dm⁢m−(d−1)/2),

which follows from lemma 1.7.1444 https://www.statslab.cam.ac.uk/~jrn10//Markov/s16.pdf . Hence,

P0d,0d2⁢m=Θ⁢(m−d/2).

Hence 3-dimensional (and above) random walk is transient by corollary 1.7.20.

To decide the 1-dimensional and 2-dimensional random walks are null recurrent or positive recurrent, recall the computation of P0,02⁢m from 1.7.19, that

P0,02⁢m=∑k∈[1,m]r0,02⁢k⋅P0,02⁢m−2⁢k,

we can (no I can’t) construct as follows

p⁢(x)−1=∑m≥1P0,02⁢m⋅xm=∑m≥1∑k∈[1,m]r0,02⁢k⋅xk⋅P0,02⁢m−2⁢k⋅xm−k=(∑k≥1r0,02⁢k⋅xk)⋅(∑t≥0P0,02⁢t⋅xt)=r⁢(x)⋅p⁢(x),

then r⁢(x)=1−1/p⁢(x). Since

11−4⁢x=∑t≥0(2⁢tt)⁢xt, (1.8)

then p⁢(x)=(1−x)−1/2, and hence r⁢(x)=1−1−x, yielding

r0,02⁢m =−(1/2m)⋅(−1)m=(−1)m−1⋅(1/2)⁢⋯⁢(1/2−(m−1))m!
=12m⋅1⁢⋯⁢(2⁢m−3)m!=12m⋅(2⁢m−2)!2m−1⋅(m−1)!⋅m!
=122⁢m⋅22⁢m−1⋅(2⁢m−1m)=122⁢m⋅12⁢m−1⋅(2⁢mm)

for m≥1, and

h0,0=∑m≥1r0,02⁢m⋅2⁢m≥∑m≥1122⁢m⋅(2⁢mm)≥12⁢π⋅∑m≥11m,

which is unbounded, meaning the whole 1-dimensional random walk is null recurrent by lemma 1.7.43.

The 2-dimensional random walk is also null recurrent. If it is positive recurrent, then by lemma 1.7.48, the limit of P02,022⁢m should be positive, yet (P0,02⁢m)2 approaches 0, which is a contradiction, hence it is null recurrent. ∎

After 1.7.64 and by lemma 1.7.1, we derive a finer bound than corollary 1.6.3.

Lemma 1.7.65.
2π⁢n⋅22⁢n≥(2⁢nn)≥12⁢π⁢n⋅22⁢n.
Exercise 1.7.66 (Exercise 7.17 [MU17]).

Consider the Markov chain over ℕ: For i≥1, the particle move to i+1 with probability p, and to i−1 with probability 1−p for i≥1, and from 0 to 1 with probability 1.

Show that the chain is transient when p>1/2, positive recurrent when p<1/2, and null recurrent when p=1/2.

Proof.

The particle returns to 0 only on even number of steps. Hence, we want to count all possible 2⁢m steps random walk over ℤ, such that the particle never go to negative side, to derive r0,02⁢m and P0,02⁢m.

There are 2 relevant combinatorics tools: Catalan number and Dyck path. A Dyck path is a series of ups and downs. The path will begin and end on the same level; and as the path moves from left to right it will rise and fall, never dipping below the height it began on. Hence, the Dyck path models the desired random walk well.

Catalan number Cn counts unique Dyck paths of n ups and n downs. Noticing that for n ups and n downs, Cn−1 is the number of unique Dyck paths that first returns after 2⁢n steps. Hence, we can count Cn by

Cn=∑k∈[1,n]Ck−1⁢Cn−k,

that leads by first returns from 2 to 2⁢n steps, and C0=1. We derive Ci with generating function method in the same way as 1.7.64, by constructing

1x⁢(f⁢(x)−1)=∑n≥1Cn⋅xn−1=∑n≥1∑k∈[1,n]Ck−1⋅xk−1⋅Cn−k⋅xn−k=(∑t≥0Ct⋅xt)2=f⁢(x)2,

Then f⁢(x)=(1−1−4⁢x)⋅(2⁢x)−1, as f⁢(x) approaches 1 when x=0. By previous eq. 1.8 in 1.7.64,

1−1−4⁢x=−∑n≥1(1/2n)⋅(−4⁢x)n=∑n≥112⁢n−1⁢(2⁢nn)⁢xn=∑n≥02n+1⁢(2⁢nn)⁢xn+1=2⁢x⁢∑n≥01n+1⁢(2⁢nn)⁢xn=2⁢x⁢∑n≥0Cn⁢xn.

Hence, r0,02⁢n=Cn−1⋅pn−1⋅(1−p)n, and we march on to derive h0,0:

h0,0 =∑n≥1Cn−1⋅(1−p)n⋅pn−1⋅2⁢n
=∑n≥0Cn⋅(1−p)n+1⋅pn⋅(2⁢n+2)
=∑n≥01n+1⁢(2⁢nn)⋅(1−p)n+1⋅pn⋅(2⁢n+2)
=2⁢(1−p)⁢∑n≥0(2⁢nn)⁢(1−p)n⁢pn.

Again by eq. 1.8,

h0,0=2−2⁢p1−4⁢p⁢(1−p)=2−2⁢p|1−2⁢p|.
  • •

    When p<1/2, h0,0 is bounded, and the chain is positive recurrent.

  • •

    When p=1/2, h0,0 is infinity, and the chain is null recurrent.

  • •

    When p>1/2, h0,0 is not valid, and the chain is transient.

Another way of showing this is to use the cut-set way by theorem 1.7.56. 555 For further read on other methods, https://chihaozhang.com/teaching/SP2025/lec4.pdf Assuming 𝝅 exists, then we can derive

π0 =(1−p)⁢π1,
πi =πi−1+(1−p)⁢πi+1,

and we have (1−p)⁢πi+1=πi.

  • •

    When p<1/2, π0=(1−2⁢p)/(2−2⁢p), hence the chain is positive recurrent.

  • •

    When p=1/2, ∑iπi=1 but πi are 0, by lemma 1.7.48 the chain is null recurrent.

  • •

    When p>1/2, ∑iπi diverges for any positive π0, hence no stationary distribution exists.

∎

Lemma 1.7.67.

A Dyck path is a series of ups and downs. The path will begin and end on the same level; and the path never dips below the height it began on. Catalan number Cn counts Dyck paths of n ups and n downs by

Cn=1n+1⁢(2⁢nn)

with the property C0=1 and

Cn=∑k∈[1,n]Ck−1⁢Cn−k.
Exercise 1.7.68 (Exercise 7.19 [MU17]).

Consider example 1.7.51. Show that the expected number of games is ℓ1⁢ℓ2.

Proof.

Let Xj be the random variable for the number of steps to be absorbed for a particle to start at state j. Then

𝔼[Xj] =𝔼[Xj∣ move to ⁢j+1]⋅rj,j+11+𝔼[Xj∣ move to ⁢j−1]⋅rj,j−11
=12⁢𝔼[Xj+1]+12⁢𝔼[Xj−1]+1

for j∈[−ℓ1+1,ℓ2−1], and 𝔼[X−ℓ1]=𝔼[Eℓ2]=0. Now we have the linear system for k∈[−ℓ1+1,ℓ2−1]

2⁢𝔼[Ek]=𝔼[Xk−1]+𝔼[Xk+1]+2

and solve by

𝔼[X−ℓ1+1] =12⁢𝔼[X−ℓ1+2]+1
⋯
𝔼[X0] =ℓ1ℓ1+1⁢𝔼[X1]+ℓ1
⋯
𝔼[Xℓ2−1] =ℓ1+ℓ2−1ℓ1+ℓ2⁢𝔼[Xℓ2]+(ℓ1+ℓ2−1)

Hence, for i∈[−ℓ2,ℓ1], we have 𝔼[Xi]=(ℓ1+i)⋅(ℓ2−i) to complete the proof. ∎

Exercise 1.7.69 (Exercise 7.20 [MU17]).

Consider the gambler’s ruin where games are unfair with losing probability 2/3. Suppose one starts with i dollars by either reaching n or 0. Let Wt be the amount one gained after t games.

  • •

    Show that 𝔼[2Wt+1]=𝔼[2Wt].

  • •

    Determine the probability of finishing with 0 and the probability of finishing with n when starting at position i.

  • •

    Generalize when losing probability is p>1/2.

Proof.

We write ptj to denote the probability of being at position j at tth step. Moreover, rk,k−11=2/3 and rk,k+11=1/3 for each k∈[1,n−1], we have the following invariant

2k=23⋅2k−1+13⋅2k+1=rk,k−11⋅2k−1+rk,k+11⋅2k+1,

and hence 𝔼[2Wt]=𝔼[2Wt+1] by

𝔼[2Wt+1]=20⋅pt0+∑k∈[1,n−1](rk,k−11⋅2k−1+rk,k+11⋅2k+1)⋅ptk+2n⋅ptn=∑k∈[0,n]2k⋅ptk=𝔼[2Wt].

Since 𝔼[2W0]=𝔼[2Wt] for arbitrary t>0, then 𝔼[2W0]=2i=𝔼[2Wt].

Let qi be the probability of absorbing to n from state i, then

limt→∞𝔼[2Wt]=qi⋅2n+(1−qi)⋅20=2i,

hence qi=(1−2i)/(1−2n).

In general, for losing probability p, we want to find similar invariant 𝔼[qWt]=𝔼[qWt+1] such that

p⋅qt−1+(1−p)⋅qt+1=qt,

and solve (1−p)⁢x2−x+p=0 for x=p/(1−p), which yields

qk=1−xk1−xn.

When p=1/2, qk=k/n as in example 1.7.51. ∎

Exercise 1.7.70 (Exercise 7.27 [MU17]).

Suppose that we are given n records, R1,R2,…,Rn kept in some order. The cost of accessing the jth record in the order is j. Thus, if we had four records ordered as R2,R4,R3,R1, then the cost of accessing R4 would be 2 and the cost of accessing R1 would be 4.

Suppose further that, at each step, record Rj is accessed with probability pj, with each step being independent of other steps. If we knew the values of the pj in advance, we would keep the Rj in decreasing order with respect to pj. But if we don’t know the pj in advance, we might use the “move to front” heuristic: at each step, put the record that was accessed at the front of the list. We assume that moving the record can be done with no cost and that all other records remain in the same order. For example, if the order was R2,R4,R3,R1 before R3 was accessed, then the order at the next step would be R3,R2,R4,R1.

The order of the records can be thought of as the state of a Markov chain. Give the stationary distribution of this chain. Also, let Xk be the cost for accessing the kth requested record. Determine an expression for limk→∞𝔼[Xk].

Proof.

By the building process, we observe a pattern: To build towards a target a1⁢…⁢an‾, we build from an‾ to an−1⁢an‾, then to ak⁢…⁢an‾, finally a1⁢…⁢an‾.

Diagram

We illustrate here by enforcing each state to contain substring ak⁢…⁢an‾ at most, and notice the absorbing relation

ak⁢…⁢an‾=a1⁢…⁢an‾∪⋃i∈[2,k](ai⁢…⁢an‾∖ai−1⁢…⁢an‾),

then we can use cutset to inductively derive the stationary distribution for a1⁢…⁢an‾. For simplicity we say πk=πak⁢…⁢an‾.

The simplest case is as follows,

Diagram

and hence the stationary distribution of an−1⁢an‾ is

πn−1=pan−1pan−1+pan⋅πn=pan−1pan−1+pan.

Relaxing an−1⁢an‾ to an−1⁢an‾∖an−2⁢…⁢an‾ and an−2⁢…⁢an‾, we have

Diagram

and hence the stationary distribution for an−2⁢…⁢an‾ is

πn−2=pan−2pan−2+⋯+pan⋅πn−1.

By cutset, for ak⁢…⁢an‾, the inflowing probability is its stationary distribution, then

pak⋅(πk+1−πk)+(1−∑i∈[k+1,n]pai)⋅πk=πk,

and therefore

πk=pakpak+⋯+pan⋅πk+1.

Hence, by induction, the resulting stationary distribution is

π1=pa1⋅pa21−pa1⁢⋯⁢pan−11−∑i∈[1,n−2]pi⋅pan1−∑i∈[1,n−1]pi=∏j∈[1,n]pj⋅∏k∈[1,n](∑i∈[k,n]pai)−1.

To derive the 𝔼[Xk] as k→∞, we eventually reach the stationary distribution after infinity steps, and hence we want to derive the expected distance to the first place in the list, for each record. By prior cutset method and state building, the probability of having ith record, and jth record in any position after ith record, is

πi⁢j‾=pipi+pj.

Let Yi be random variable for the order of ith record in the queue, then by linearity of expectation,

𝔼[Yi]=1+∑j≠iπj⁢i‾=1+∑j≠ipjpi+pj.

Hence, by conditional expectation, we have

limk→∞𝔼[Xk]=limk→∞∑i∈[1,n]pi⋅𝔼[Xk∣kth⁢ query is on ⁢ith⁢ record]=∑i∈[1,n]pi⋅𝔼[Yi]=1+∑i∈[1,n]pi⁢∑j≠ipjpi+pj.

∎

Remark 1.7.71.

Buddy, why torture me with Tsetlin Library 1.7.70 [Tse63].

Exercise 1.7.72 (Exercise 7.28 [MU17]).

Consider the following variation of the discrete time queue. Time is divided into fixed-length steps. At the beginning of each time step, a customer arrives with probability λ. At the end of each time step, if the queue is nonempty then the customer at the front of the line completes service with probability μ.

  • •

    Explain under what conditions a stationary distribution exists, and find the stationary distribution when it exists.

  • •

    Now consider the variation where we change the order of incoming arrivals and service. That is: at the beginning of each time step, if the queue is nonempty then a customer is served with probability μ; and at the end of a time step a customer arrives with probability λ. How does this change the stationary distribution?

Proof.

We show the vanilla Markov chain of the infinite discrete queue that each step only 1 of the 2 things happens.

Diagram

By cutset λ⁢πi=μ⁢πi+1, 𝝅 exists only on λ<μ when the chain is positively recurrent,

πi=(1−λμ)⋅(λμ)i,

otherwise when λ=μ, the chain is null recurrent, λ>μ the chain is transient.

When the chain introduces a new customer at the beginning of a time step, and processes a customer at the end of the time step, the Markov chain follows, where remaining unchanged can be either no customer coming and no customer processed, or 1 customer coming and 1 customer processed. Otherwise, transitioning to the next state means 1 customer coming, and transitioning to the previous state means 1 customer being processed.

Diagram

By cutset λ⁢(1−μ)⁢πi=(1−λ)⁢μ⁢πi+1, 𝝅 exists only on λ<μ when the chain is positively recurrent,

πi=(1−λ⁢(1−μ)μ⁢(1−λ))⋅(λ⁢(1−μ)μ⁢(1−λ))i,

and the chain being null recurrent on λ=μ, being transient on λ>μ.

When we reverse the order, say on new time step with probability μ the nonempty queue a customer is processed, and a customer will arrive with probability λ at the end of the time step, the new Markov chain follows.

Diagram

The only difference lies in the empty queue, that follows the vanilla discrete time queue behavior, as the empty queue does not have customers to consume, and either with probability λ to accept new customer at the end of the time step, or remain empty with probability 1−λ.

By cutset, we have

λ⁢π0 =(1−λ)⁢μ⁢π1
λ⁢(1−μ)⁢πi =(1−λ)⁢μ⁢πi+1,

hence for i≥1,

πi=π01−μ⋅(λ⁢(1−μ)μ⁢(1−λ))i,

and by ∑i≥0πi=1, we have

π0=1−λμ.

Therefore, for i≥1,

πi=π01−μ⋅(λ⁢(1−μ)μ⁢(1−λ))i,

with the existence condition for 𝝅 being λ<μ, in which case the chain is positively recurrent. ∎

1.7.5 Random Walks on Undirected Graphs

Definition 1.7.73.

A random walk on G is a Markov chain defined by the sequence of moves of a particle between vertices of G. The position of the particle at a particular time step is the state of the chain. If the particle is at vertex i with d⁢(i) outgoing edges, then the probability that the particle follows edge (i,j) to neighboring vertex j is d⁢(i)−1.

Lemma 1.7.74.

A random walk on an undirected graph G is aperiodic iff G is not bipartite, which means there is no 2-coloring such that the endpoints of each edge are colored differently.

Proof.

A graph G being not bipartite means it has cycles of odd length. If a graph G is bipartite and undirected, then the length of the path going back to itself is always even, such that the Markov chain is of period 2. Otherwise, undirected G is not bipartite, each vertex has an odd-length path back to itself, then the Markov chain is aperiodic. ∎

Similar to theorem 1.7.53, A random walk on a finite, undirected, connected, and non-bipartite graph G defines a Markov chain that converges to a stationary distribution that is determined by the degree sequences of the graph.

Theorem 1.7.75.

A random walk on a finite, undirected, connected, and non-bipartite G has a stationary distribution 𝛑 where

πv=d⁢(v)2⁢|E|.
Proof.

Since ∑v∈Vd⁢(v)=2⁢|E|, then 𝝅 defines a proper distribution of particle appearing over V.

On the other hand, by definition of stationary distribution in theorem 1.7.56, for u∈V and its neighbors Γ⁢(u),

∑v∈Γ⁢(u)d⁢(v)2⁢|E|⋅1d⁢(v)=d⁢(u)2⁢|E|=d⁢(u)2⁢|E|⋅∑v∈Γ⁢(u)1d⁢(u),

where the second equality holds from |Γ⁢(u)|=d⁢(u). ∎

Exercise 1.7.76 (Exercise 7.14 [MU17]).

Show that the Markov chain defined by a random walk on a finite, undirected, non-bipartite, connected graph G is time reversible.

Proof.

When G is finite, then theorem 1.7.75 kicks in, by definition of time reversibility in 1.7.63,

d⁢(v)2⁢|E|⋅1d⁢(v)=12⁢|E|=d⁢(u)2⁢|E|⋅1d⁢(u).

∎

Lemma 1.7.77 (Commute Time).

For G=(V,E), if (u,v)∈E, the commute time hu,v+hv,u≤2⁢|E|.

Proof.

Let D be the set of directed edges: for every (u,v)∈E, we have 2 directed edges u→v and v→u in D.

We can view the random walk over G as a Markov chain of state space D, where the state of the Markov chain at the tth time step is the direct edge taken by the random walk in its tth transition. The Markov chain has 2⁢|E| states, and the stationary distribution πu→v=(2⁢|E|)−1 for all (u,v)∈E, by cutset theorem 1.7.56

πu→v=1d⁢(u)⁢∑w∈Γ⁢(u)πw→u

for all (u,v)∈E and Γ⁢(u) is the set of neighboring vertices of u, πu→v=(2⁢|E|)−1 is a solution. By theorem 1.7.53,

πu→v=hu→v,u→v−1=(2⁢|E|)−1,

hence hu→v,u→v=2⁢|E|: after taking the directed path u→v, the expected number of steps to retake u→v is 2⁢|E|. By Markovian (memoryless) of the random walk, once it reaches v, it forgets about it reaches by u→v, hence the expected time to start from v and reach u and take (u,v) to v is 2⁢|E|.

Since hu,v will not rule out the walk reaching v without taking (u,v), then it will not force the walk to go back to u and take (u,v), even if it reached v before, hence hv,u+hu,v≤hu→v,u→v=2⁢|E|. ∎

Exercise 1.7.78 (Exercise 7.22 [MU17]).

A cat and a mouse each independently take a random walk on a connected, undirected, non-bipartite graph G. They start at the same time on different nodes, and each makes 1 transition at each time step. The cat eats the mouse if they are ever at the same node at a time step. Let |V|=n and |E|=m. Show an upper bound of O⁢(m2⁢n) on the expected time before the cat eats the mouse.

Proof.

Construct a graph G2 from G by making vertices V2=(V,V), and edges E2 for all ((u0,u1),(v0,v1)) such that (u0,v0)∈E and (u1,v1)∈E. Counting the degrees of each vertices (a,b)∈V2 double counts |E2|, then

2⁢|E2|2=∑(a,b)∈V2d⁢(a,b)=∑a∈Vd⁢(a)⁢∑b∈Vd⁢(b)=4⁢|E|2,

such that |E2|=2⁢|E|2.

We show that, for every (a,b)∈V2, there exists paths of O⁢(|V|) length to a (v,v)∈V2 in the connected, undirected, non-bipartite graph. First, for every u,v∈V, the path in between over G is O⁢(|V|) length. Then, for paths in between a,v and b,v, we use ℓ1,ℓ2 to denote the paths lengths,

  • •

    If both ℓ1,ℓ2 are even or odd, then there exists path in between (a,b),(v,v) of length max⁡(ℓ1,ℓ2)=O⁢(|V|), as the shorter one can keep looping in between v and u∈Γ⁢(v) for 2⁢k steps, such that they eventually meet at (v,v).

  • •

    Otherwise, since G is non-bipartite, there exists odd length cycle in G, such that the odd length path can be transformed into an even length path, and the 2 lengths can be calibrated to be the same as previously described. The cycle is of O⁢(|V|) length, and original paths are O⁢(|V|) lengths, hence the resulting length is O⁢(|V|).

After obtaining such path 𝐬 from (a,b) to (v,v) of length ℓ=O⁢(|V|), we bound h(a,b),(v,v) by

h(a,b),(v,v)≤h(a,b),(v,v)+h(v,v),(a,b)≤∑i∈[1,ℓ−1](h(si,si+1)+h(si+1,si))≤ℓ⋅2⁢|E2|=4⁢ℓ⁢|E|2.

where the second inequality holds by enforcing the path 𝐬 from (a,b) to (v,v), similar to the idea of lemma 1.7.77, and the third inequality is immediate by lemma 1.7.77. Hence, the expected time h(a,b),(v,v)=O⁢(|E|2⁢|V|). ∎

Definition 1.7.79 (Covering Time).

The covering time of G=(V,E) is the max of all v∈V of the expected time to visit all vertices by a random walk starting from v.

Lemma 1.7.80 (Covering Time Upper Bound).

The covering time CG of G=(V,E) is upper bounded by 2⁢|E|⁢(|V|−1).

Proof.

One can consider traversing all vertices with a MST in G, such that there are |V|−1 directed paths in the MST. Then we bound similarly in lemma 1.7.77 and 1.7.78 by enforcing the paths

CG≤∑i∈[1,|V|−1](hvi,vi+1+hvi+1,vi)≤2⁢|E|⁢(|V|−1).

∎

We introduce Matthew’s theorem, connecting the hitting time hu,v to the covering time. We write H⁢(n)=∑i≤n1/i.

Lemma 1.7.81 (Matthews’ Theorem [Mat88]).

The covering time CG of G=(V,E) with |V|=n is bounded by

H⁢(n−1)⁢minu,v∈V,u≠v⁡hu,v≤CG≤H⁢(n−1)⁢maxu,v∈V,u≠v⁡hu,v.
Proof.

The proof utilizes balls-and-bins model, and the path enforcing technique of lemma 1.7.77 and 1.7.78.

We begin by enforcing a traversal order {Zi}i∈[1,n] over V sampled from uniform permutation over [1,n], write B as the maximal hitting time hu,v for convenience, Ti be the first time step when all the first i vertices Z1,…,Zi have been visited in the order 666 If Zj are visited for j∈[1,k]∖{i}, then when Zi is visited, Ti=Ti+1=⋯=Tk. , and Xi be the state of the Markov chain at the ith time step.

Given all the prior setup, we are interested in the time intervals {Ti−Ti−1}i∈[2,n]. Given the random walk history,

Yi=𝔼[Ti−Ti−1∣Z1,…,Zi;X1,…,XTi−1]

for i∈[2,n] 777 Coupon-collector on the first k entries, that does not strictly enforces traverse by the permutation, but enforces by visiting first k entries. , and the expected time to cover the graph starting from u is

CG=∑i∈[2,n]Yi+𝔼[T1].

For T1, one has 1/n probability having Z1=u, otherwise u is reached by random walk. By conditional expectation,

𝔼[T1] =𝔼[T1∣Z1=u]⁢Pr⁡[Z1=u]
+𝔼[T1∣Z1≠u]⁢Pr⁡[Z1≠u]
≤(1−1n)⁢B,

where the second inequality holds by B upper bounding the expectation of hitting time, and T1=0 when Z1=u.

For Yi, if i has already been visited previously, then Yi=0 as Ti=Ti−1, otherwise Yi≤B regardless.

Since the permutation {Zi}i∈[1,n] is sampled uniformly random and independent of the random walk, then any one of {Zk}i∈[1,k] can be the last visited for first k entries with probability 1/k 888 Zk being last visited w.r.t. the fixed random walk is only related to {Zi}i∈[1,k], by symmetry of random permutation, the probability is 1/k. , and hence

∑i∈[2,n]Yi+𝔼[Ti] ≤∑i∈[2,n]1i⁢B+(1−1n)⁢B
=∑i∈[1,n−1]1i⁢B
=H⁢(n−1)⁢B.

The lower bound is proven in the same way, by setting B to be the minimal of the expected hitting time. ∎

Exercise 1.7.82 (Exercise 7.24 [MU17]).

A lollipop graph on n vertices is a clique Kn/2 connected to a n/2 long path. u is the node being both clique and path, and v be the other end of the path. Show the CG starting from v is Θ⁢(n2), and starting from u is Θ⁢(n3).

Proof.

We bound the covering time from v by enforcing the path from v to u, then to other x∈Kn/2. By lemma 1.7.80,

CG≤hv,u+∑x∈Kn/2,x≠u(hx,u+hu,x).

For hv,u, let i∈[1,n/2−1] be vertices on the (u,v) path, we have

h1,u =12⋅1+12⋅(1+h2,u)
⋯
hn/2−1,u =12⋅(1+hn/2−2,u)+12⋅(1+hv,u)
hv,u =1+hn/2−1,u,

hence hi,u=i⋅(n−i), and hv,u=n2/4.

For hu,x for some x∈Kn/2, let k=n/2 and x′≠x that x′∈Kn/2, then

hu,x =1k⋅1+k−2k⋅(1+hx′,x)+1k⋅(1+h1,x)
hx′,x =1k−1⋅1+k−3k−1⋅(1+hx′,x)+1k−1⋅(1+hu,x)
h1,x =12⋅(1+hu,x)+12⋅(1+h2,x)
⋯
hv,x =1+hn/2−1,x,

then hu,x=(2⁢k2+3)/2⁢k=n+3/n.

For the rest of hitting time from x≠u, x∈Kn/2, there is a vanilla way of computing by

hx,u =1k−1⋅1+k−2k−1⋅(1+hx′,u)
hx′,u =1k−1⋅1+k−2k−1⋅(1+hx′,u),

then hx,u=hx′,u=k−1.

Another way of deriving hx,u is by taking advantage of theorem 1.7.75, that the lollipop graph is non-bipartite as Kn/2 has odd length cycle, then

πu,u−1=2⁢|E|d⁢(u)=hu,u=1d⁢(u)⁢∑w∈Γ⁢(u)(hw,u+1)=1+1k⁢∑w∈Γ⁢(u)hw,u,

where d⁢(u)=|Γ⁢(u)|=k, hence ∑w∈Γ⁢(u)hw,u=2⁢|E|−k. Since |E|=k⁢(k+1)/2, and h1,u=n−1=2⁢k−1, hence

∑w∈Γ⁢(u),w≠1hw,u=2⁢|E|−k−h1,u=(k−1)2.

Therefore, the covering time from v is Θ⁢(n2).

To derive the CG from u, hu,v is upper bounding the covering time for the path part, then

CG≤hu,v+∑x∈Kn/2,x≠u(hx,u+hu,x),

and we have the formulas

hx,v =1k−1⋅(1+hu,x)+k−2k−1⋅(1+hx,v)
hu,v =1k⋅(1+h1,v)+k−1k⋅(1+hx,v)
h1,v =12⋅(1+hu,v)+12⋅(1+h2,v)
⋯
hn/2−1,v =12⋅1+12⋅(1+hn/2−2,v),

then hk−i,v=i⋅(k2+k−i), and hence hu,v=k3, which explains CG from u is Θ⁢(n3). ∎

Exercise 1.7.83 (Exercise 7.26 [MU17]).

Let n equidistant points be marked on a circle. WLOG, think of the points as being labeled clockwise from 0 to n−1. Initially, a wolf begins at 0 and there is one sheep at each of the remaining n−1 points. The wolf takes a random walk on the circle. For each step, it moves with probability 1/2 to one neighboring point and with probability 1/2 to the other neighboring point. At the first visit to a point, the wolf eats a sheep if there is still one there. Which sheep is most likely to be the last eaten?

Proof.

Brain teaser. Say for any sheep j∈[1,n−1] is eaten last, then view this as a Gambler’s Ruin example 1.7.51 by states j,j+1⁢⋯⁢n−1,0,1,⋯,j−1,j and absorb at both j’s. Now the requirement is, visit all states before absorbing.

Visiting j+1 first is mutually exclusive with visiting j−1 first, and hence the rest is visiting j+1 or j−1, then absorb to the j on the other end, which is of probability 1/(n−1) in total.

Such 1/(n−1) probability holds for any j∈[1,n−1], and hence all sheeps eaten last is equal probability. ∎

Exercise 1.7.84 (Exercise 7.30 [MU17]).

Let (u,v) be an edge in a hypercube of N=2n nodes.

  • •

    Prove the expected time between the traversal of (u,v) edge is n⁢N.

  • •

    We consider the time between transitions from u to v in a different way. After moving from u to v, the walk must first return to u. When it returns to u, the walk might next move to v, or it might move to another neighbor of u, in which case it must return to u again before moving to v for there to be a transition from u to v.

    Use symmetry and the above description to prove the following recurrence:

    N⁢n=∑i≥11n⁢(n−1n)i−1⁢(i⁢(hu,v+1))=n⁢(hu,v+1).
  • •

    Conclude that hu,v=N−1.

  • •

    Using the result on the hitting time of adjacent vertices and Matthews’ theorem, show the cover time is O⁢(N⁢n2).

  • •

    As a much more challenging problem, try to prove that the maximum hitting time between any two vertices for the random walk on the hypercube is O⁢(N), and that the cover time is correspondingly O⁢(N⁢n).

Proof.

Each vertex in an n-dimensional hypercube has n edges, then 2⁢|E|=n⁢N. By lemma 1.7.77,

hu→v,u→v=2⁢|E|=n⁢N.

To derive hu→v,u→v again from geometric distribution, consider u going to v, or n−1 other neighbors in Γ⁢(u)∖{v}. It takes one step to go from u to any w∈Γ⁢(u). To get back to u from w∈Γ⁢(u), hw,u=hv,u=hu,v by symmetry.

Hence, a trial contains going back from neighbor w∈Γ⁢(u), then depart from u to one of the neighbors in Γ⁢(u). By Markovian of random walk, the probability of going from u to v is n−1, hence the expected steps to take (u,v) is

∑i≥11n⁢(n−1n)i−1⋅i⁢(hu,v+1)=n⁢(hu,v+1).

By prior result on hu→v,u→v by lemma 1.7.77, we conclude that hu,v=N−1.

Consider any p,q∈V for the hypercube, that (p,q)∉E. Similar to 1.7.78, we upper bound by

hp,q≤∑(a,b)∈Pha,b=O⁢(N⁢n),

where there is a path of length O⁢(n) connecting p and q, as there are at most O⁢(n) bits different in between p and q. By lemma 1.7.81, H⁢(N−1)=O⁢(n), hence the covering time is upper bounded by O⁢(n2⁢N).

For departing from u, we can model the hitting time to v by the Hamming distance as follows.

Diagram

Then the linear system for the hitting time is

h0,n =1+h1,n
hi,n =1+in⋅hi−1,n+n−in⋅hi+1,n
hn−1,n =1+n−1n⋅hn−2,n,

and let di=hi,n−hi+1,n with dn−1=hn−1,n, then

d0 =1
(n−i)⁢di =n+i⁢di−1.

Since

(n−i)⁢(n−1i−1) =i⁢(n−1i)
n⁢(n−1i) =(n−i)⁢(ni),

then

(n−i)⁢(n−1i)⁢di =n⁢(n−1i)+i⁢(n−1i)⁢di−1
=(n−i)⁢(ni)+(n−i)⁢(n−1i−1)⁢di−1,

and eventually

si=(n−1i)⁢di=(ni)+(n−1i−1)⁢di−1=(ni)+si−1.

Since s0=1, hence

sk=∑i∈[0,k](ni)=2n−∑i∈[k+1,n](nk),

and

dk=(n−1k)−1⁢∑i∈[0,k](ni)=(n−1k)−1⁢(2n−∑i∈[k+1,n](nk)),

and finally

h0,n =∑k∈[0,n−1]dk
=∑k∈[0,n−1](n−1k)−1⁢∑i∈[0,k](ni).

Since dn−1=2n−1, dn−2≤2n/(n−1), and

∑k∈[2,n−3](n−1k)−1 ≤∑k∈[2,n−3](n−12)−1
=2⁢(n−4)(n−1)⁢(n−2)=O⁢(n−1).

then h0,n=O⁢(N). By lemma 1.7.81 again, the covering time is O⁢(n⁢N). ∎

1.7.6 Parrondo’s Paradox

Parrondo’s paradox shows that, sometimes 2 losing games combined together makes a winning game.

  • •

    Consider a game A with a biased coin A, winning with probability pA and losing with probability 1−pA.

  • •

    Consider a game B, that the coin flipped depends on the state of the game.

    Let w be the number of games won so far, and ℓ be the number of games lost so far, then w−ℓ is the winning.

    • –

      If w−ℓ≡0mod3, then use coin B winning with probability pB and losing with probability 1−pB.

    • –

      Otherwise, use coin C winning with probability pC and losing with probability 1−pC.

To show whether game B is winning or losing, we use the following lemma.

Lemma 1.7.85.

For any sequence s of moves that starts at 0 and ends at 3 before reaching −3, let f⁢(s) be a 1-to-1 mapping to s such that f⁢(s) negates every number starting from the last 0 in the sequence s, then

Pr⁡[s⁢ occurs]Pr⁡[f⁢(s)⁢ occurs]=pB⁢pC2(1−pB)⁢(1−pC)2.
Proof.

We can view the game B by a Markov chain over [−3,3] that starts from 0, with ±3 being 2 absorbing states. Similar to the Gambler’s ruin argument in example 1.7.51, if it is more likely to reach −3 before reaching 3, then the game is a losing game.

Now consider the 1-to-1 mapping. Let

  • •

    a1 be the number of moves 0→1,

  • •

    a2 be the number of moves from 0→−1,

  • •

    a3 be the number of moves 1→2, 2→3, −2→−1, −1→0,

  • •

    a4 be the number of moves 2→1, 1→0, −1→−2, −2→−3

in s. Then

Pr⁡[s⁢ occurs]=pBa1⁢(1−pB)a2⁢pCa3⁢(1−pC)a4.

Consider f⁢(s) reaching −3 before reaching 3 that is 1-to-1 mapped to s.

  • •

    Since the first move after last 0 in s is 0→1, then the first move after last 0 in f⁢(s) is 0→−1, hence a1′=a1−1. By symmetry of a1+a2=a1′+a2′, we have a2′=a2+1.

  • •

    After the last 0→1 in s, there is no 1→0 moves. The remaining moves in s are 1→2, 2→1, and 2→3. For f⁢(s), the remaining moves are −1→−2, −2→−1, and −2→−3.

    All the moves −1→−2 then −2→−1 in f⁢(s) are self-cancelling, symmetric to the 1→2 then 2→1 on s side.

    What remains is 1→2→3 in s, and −1→−2→−3 in f⁢(s). Hence, a3′=a3−2, and a4′=a4+2.

Therefore,

Pr⁡[f⁢(s)⁢ occurs]=pBa1−1⁢(1−pB)a2+1⁢pCa3−2⁢(1−pC)a4+2,

and the ratio η=pB⁢pC2⁢(1−pB)−1⁢(1−pC)−2. ∎

Suppose pA=0.49, pB=0.09, pC=0.74, then both game A and game B are both losing, as η≈0.8.

However, with a fair coin D with pD=0.5, we combine the game by winning on coin D plays game A, and losing on coin D plays game B. In this case, pB′=(pA+pB)/2 and pC′=(pA+pC)/2, and eventually η>1.

The difference lies in the fair coin D breaks the structure of game B, that is rather likely to lose on any game with w−ℓ≡0mod3. If one managed to get over the barrier in game B with game A, which is close to a fair game, then it is likely to win the next 2 games.