After previous bounds for factorial by corollary 1.5.5 and corollary 1.6.3, we reach Stirling’s Formula.
For ,
In particular, for ,
We start from the fact that factorial is the discrete form of the Gamma function, by
Let where , then
where , and we let . We continue by series expansion:
, and ;
, and .
Hence, . We let , where
then by , , and by replacing with ,
We continue by bounding the term with results from [Top07].
For ,
With lemma 1.7.2, we need to prove the following bound to complete the proof.
If , then .
First, , since , both and are less than 0. Hence, we can bound by .
When ,
and therefore . Hence, .
Hence, the upper bound is .
For lower bound, we have
and
Hence, the lower bound is , which completes the proof. ∎
Since
then
and therefore the upper bound is derived by,
and the lower bound is derived by
which completes the proof 222 This derivation is based on Thomas Ahle’s post in https://mathoverflow.net/a/484270. . ∎
The stochastic process is a collection of random variables. The index represents time, and the process models how a random variable changes over time.
is the state of the process at the time step.
If takes values from a countably infinite set, is a discrete-state process.
If takes values from a finite set, then is finite-state.
If is a countably infinite set, is a discrete-time process.
A discrete stochastic process is a time-homogeneous Markov chain if
This is called the Markov property, or memoryless property, or Markovian.
Consider the 2-state Markov chain with the following transition matrix
Find the minimum expression for in .
We can derive the following recurrence relation
as the is diagonally symmetric with same diagonal values. Therefore, . ∎
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 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.
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 .
One can view the state transition graph as a line of vertices, from 0 to .
Suppose the algorithm outputs a satisfying assignment , and we let the initial random assignment be , be the assignment on the step. We define the process over the number of matches of with .
When , any flip of variable can make have more match, and thus .
When , then
If the clause picked has 1 unmatched variable, then the probability of making situation better is .
If the clause picked has 2 unmatched variables, then any flip can make situation better.
Hence, .
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 that , with
Let be the random variables for the number of steps to reach from matches in process . The following claims are immediate:
It is immediate that . By induction, we derive the following recurrence relation
By summation, , and . ∎
The following theorem is immediate from lemma 1.7.6.
The 2-SAT algorithm always returns correct answer on an unsatisfiable formula. If the formula is satisfiable, with probability at least the algorithm gives a satisfiable assignment.
One can segment the steps in the algorithm into chunks of steps, running independently.
Let be the random variable for the steps the algorithm needs to take from matches. By lemma 1.7.6, . Immediate from Markov’s inequality,
Hence, the probability that the algorithm fails to find a satisfying assignment after segments is at most . ∎
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 the walk moves to position 1 and with probability the walk stays at 0. Everywhere else is the same. Find the expected number of moves to reach from position .
We continue with reusing and process . The following claims are immediate:
It is immediate that . By induction, we derive the following recurrence relation
By summation, , and . ∎
Find the expected runtime of the 2-SAT randomized algorithm for lemma 1.7.6, where the input is sampled uniformly at random.
We follow the notions of lemma 1.7.6, and let be the random variable for the number of mismatches in the initial assignment. Then by conditional expectation,
∎
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 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 by
We proceed by defining the random variables for the number of steps to reach matches for the current assignment with a satisfying assignment , where the current assignment has matches. By conditional expectation,
By induction, . But this results in , where trying all variables is also , 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 .
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 mismatches, we let be the probability that the random walk finds a satisfying assignment from this initial assignment in steps. The random walk always needs steps to reach matches. To lower bound the probability that a satisfying assignment can be found within steps, we consider steps drifting to more matches, while steps drifting to less matches, by
It turned out that for any , , as
All exact steps cases are captured.
All cases reaching matches earlier, should drift around the matches, with a probability at most 1.
All other cases reaching matches later, are omitted, while their probability is non-negative.
Since , then surely the following holds:
By lemma 1.7.1, we have
Therefore, the lower bound for , the probability for finding a satisfying assignment within steps, is
We now formulate the 3-SAT randomized algorithm from random walk as follows:
Repeat up to times:
Pick a random truth assignment.
Repeat up to 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 , and the expected runtime is .
Similar to the 2-SAT randomized algorithm, we can make
such that we have segments, while one segment failing to find a satisfying assignment can be viewed as
by Markov inequality, where is a geometrically distributed random variable with success probability .
Hence, the failing probability of finding a satisfying assignment for 3-SAT is at most .
Generalize the 3-SAT randomized algorithm to -SAT algorithm, and write the expected runtime of the algorithm as a function of .
We reuse most of the notions in 3-SAT randomized algorithm, where is a satisfying assignment, is the assignment at time step, is the Markov chain for the number of matches that
and are the random variables for the steps to satisfy all clauses, from an initial assignment of mismatches.
For , 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 -SAT case.
Let be the probability for finding satisfying assignment from mismatches in steps of random walk. Then
and therefore by lemma 1.7.1,
Let be the probability for sampling a random initial assignment, then
Hence, the expected runtime for the -SAT algorithm is
where is the expected number of trials to the first satisfying assignment.
We set for at least probability of outputting satisfying assignment on a satisfiable formula. ∎
The prior 3-SAT randomized algorithm analysis made pessimistic assumption that the current assignment and the satisfying assignment differ in one variable in the chosen unsatisfied clause. Instead, suppose that the 2 assignments disagree on 1 variable with probability , and disagree on at least 2 variables with probability . What is the largest , such that one can prove that the expected number of steps before the randomized 3-SAT stops is polynomial in ?
We reuse most of the notions in 3-SAT randomized algorithm, where is a satisfying assignment, is the assignment at time step, is the modified Markov chain for the number of matches that
and are the random variables for the steps to satisfy all clauses, from an initial assignment of mismatches. Then , the probability of finding a satisfying assignment within steps for initial mismatches, has
Now the probability for finding a satisfying assignment within steps is
In this case, only when can make . ∎
A coloring of a graph is an assignment of a color to each of its vertices. A graph is -colorable if there exists coloring such that no 2 adjacent vertices have the same color. Let be 3-colorable.
Show that there exists a 2-coloring for such that no triangle is monochromatic.
Consider the following 2-coloring randomized algorithm for 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.
Let the 3-colorable graph be given a proper 3-coloring such that no pair of adjacent vertices has the same color. Then any triangle in must be colored in 3 distinct colors; otherwise at least one pair of adjacent vertices would have the same color, contradicting that 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 , as the coloring at time step , as the Markov chain for the number of matches that
and as the random variables for the number of steps to match fully from an initial coloring of mismatches. We adopt the analysis for the unsuccessful 3-SAT randomized algorithm, and by conditional expectation,
By induction, , and eventually
Let be the random variable for the number of steps in the algorithm, and be the random variable for the number of mismatches in the initial assignment, then by conditional expectation,
∎
For a time-homogeneous Markov chain,
∎
State is accessible from state if there exists some integer , . If state are accessible from each other, we say they communicate by . The communicating relation defines an equivalence relation:
Reflexive: For any state , .
Symmetric: If , then .
Transitive: If and , then .
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.
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 , the probability that state can reach state is nonzero. The next lemma is immediate.
A finite Markov chain is irreducible iff its graph representation is a strongly connected graph.
Let be the probability that, the first transition from state to state happens on the step:
A state is transient if , and it is recurrent if .
Let be the random variable for the steps to transition from to , and be the random variable for the steps to return to , such that .
Let be the probability that a Markov chain returns to state when started in state after steps. Prove that is unbounded iff state is recurrent.
We can express in the following recursive way:
where . Then the summation can be rearranged to
In this way, being unbounded is equivalent to the state being recurrent. ∎
If a state in a communicating class is transient (recurrent), then all states in the class are transient (recurrent).
Suppose state are in the same communicating class, and with integers such that , . By theorem 1.7.13 and omitting the first terms,
where the fourth equality for changing summation sequence holds by probability being non-negative.
Then by 1.7.19, if state is transient, then has to be bounded, that state is transient. Conversely, if state is recurrent, then has to be unbounded, that state is recurrent. The intuition follows.
Suppose state is transient, then all the other states in the same communicating class have nonzero probability to reach , and get out of the communicating class from with nonzero probability, hence all of the states are transient.
On the other hand, supposing state is recurrent but another state is transient in the same communicating class, this is a contradiction as state can reach state and never get back to itself. Contradiction remains until no state in the communicating class is transient. ∎
Let be the expected time to return to when starting at state , and be the expected time to reach from . A recurrent state is positive recurrent if , otherwise it is null recurrent.
If is transient, then .
Since may never return by , hence . ∎
If is recurrent, then .
Suppose for recurrent , then it contradicts with recurrence: . ∎
The convergence of differs positive recurrence from null recurrence, and differs recurrence from transience.
Consider a finite Markov chain of states with for all . The number of steps for “reaching state ” can be viewed as a geometrically distributed random variable, and .
However, consider a Markov chain over states , that and . Then
Hence, , yet .
Let be recurrent, and suppose can access . Then is recurrent, and both and are bounded with probability 1.
If can access , then with non-zero probability can transition to . Supposing is transient, by corollary 1.7.20 are in different communicating classes, thus , hence for any . Let for some , then returns to itself with probability at most , contradicting with the recurrence of . Thus, is recurrent.
Since and communicate, for one path from to of length , let the probability of taking this path be , then returning to before reaching has probability at most . By corollary 1.7.23, . Hence, we model this with a geometrically distributed random variable: on a coin flip, either success with probability at least to reach in steps, or fail with probability at most to return to in steps. Hence, .
Suppose , then , which is contradicting to being recurrent. ∎
In a finite Markov chain, there is at least one recurrent state, and all recurrent states are positive recurrent.
A finite directed graph 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 , such that the subchain is a finite irreducible Markov chain, and the probability of transitioning out is 0.
For , is the probability of returning to itself. Let be the integer such that for all by the irreducibility and finiteness of , then
Moreover, by the Markovian property,
By the closure of , we have after repeating blocks of steps, converging to 0 when , yielding . By corollary 1.7.20, all are recurrent.
For any ,
Such a bound applies to all sink SCCs, so all recurrent states are positive recurrent. ∎
We now introduce the Kolmogorov Strong Law of Large Numbers (SLLN), in contrast to theorem 1.3.11.
Let be i.i.d. random variables with , and let .
We adopt the proof structure from [Ete81] and first prove a useful lemma.
Let be a sequence of subsets of . The supremum of is
The limit superior of is
Equivalently, is the event that “for every cutoff , there exists such that holds”. In other words, there are infinitely many indices such that holds, or equivalently, “ occurs infinitely often”.
Let be an infinite sequence of events. If ,
| (1.1) |
We notice a non-increasing sequence of sets by
Hence, on an arbitrary , we upper bound the probability by
the second inequality holds from union bounding, and the right hand side summation approaches to 0 as . ∎
The event means that no matter how far into the sequence we go, there is always a later that occurs. In other words, keep occurring arbitrarily far out, or equivalently, occur infinitely often.
Hence, eq. 1.1 means that with probability , there exists a finite cutoff after which none of the events occur. Equivalently, only finitely many of them occur.
Now we begin the proof for theorem 1.7.28.
WLOG we let , by if , otherwise , and .
Since , and by are i.i.d., we have
| (1.2) |
By lemma 1.7.30 and remark 1.7.31, the eq. 1.2 means with probability , only finitely many indices have . Equivalently, with probability , there exists a finite cutoff such that does not occur for all .
Hence, with probability , we have for all , so only finitely many are nonzero. Therefore,
and what remains to show is
Let , , and , by Chebyshev’s inequality and the independence of ,
We want to take advantage of Borel-Cantelli lemma 1.7.30 again by showing if
then
that only a finite number of has . There are 3 things remains to be proved:
We begin with proof for lemma 1.7.34.
We derive , as we simplify by . Hence, by Jensen’s inequality,
By monotone convergence, we have as . Since
and , we have as .
By Cesàro summation, that if as , then , thus
which completes the proof. ∎
Now we move on by proving lemma 1.7.32.
We introduce Etemadi Inequality [Ete81] for proof of lemma 1.7.33.
Let be i.i.d. real-valued random variables defined over some common probability space, and let , then
For lemma 1.7.33, the proof follows.
We show only finite many have by lemma 1.7.30, then by lemma 1.7.35,
| (1.5) |
Again by Chebyshev’s inequality,
| (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
By lemma 1.7.32, the right hand side upper bound of eq. 1.6 is summable by
finishes upper bounding the left hand side of eq. 1.5,
then we conclude lemma 1.7.33 by lemma 1.7.30, that
∎
For every ,
By Chebyshev’s inequality,
Hence,
by lemma 1.7.32. Therefore, by lemma 1.7.30,
Moreover, for , by triangle inequality
so
Since implies , we have
Therefore, by lemma 1.7.33,
∎
To complete the proof for Kolmogorov SLLN theorem 1.7.28, by corollary 1.7.36,
Since was arbitrary, we conclude that
Together with
and , we conclude that
∎
Let be a discrete-time stochastic process. A non-negative integer-valued random variable is a stopping time if for every , whether event occurs is determined only by .
Let be a discrete-time Markov chain. We say that satisfies the strong Markov property if for every stopping time with , conditional on and the history
the shifted process has the same distribution as the original chain started from the state .
Any discrete-time, time-homogeneous Markov chain satisfies the strong Markov property.
Take any states , and any time steps and . We show that conditional on and the history , the shifted process has the same finite-dimensional distributions as the original chain started from state . Since event is in the condition,
By the Markov property applied successively,
By time-homogeneity in definition 1.7.4, this equals
which is exactly
Therefore, conditional on and the history up to time , the shifted process has the same finite-dimensional distributions as the original chain started from state . Hence it has the same distribution, and the chain satisfies the strong Markov property. ∎
Let be a Markov chain, with , and states communicating. Let be the indicator random variable for the event given . Then the limiting fraction of time spent in state is , that is,
If is transient, and are in same communicating class, then by corollary 1.7.20, is also transient. Intuitively, there are only finitely many times that can reach . We can show by a similar trick in corollary 1.7.20, and let be a number of steps such that , then
Since , then with probability 0, hence the left hand side is 0. By corollary 1.7.22, , thus the right hand side is 0. Hence, the transient case is proved.
If is recurrent, then are both recurrent by corollary 1.7.20.
We first handle the positive recurrent case, and start with the special case when . Suppose that is positive recurrent, so . Let , and for each , let be the time of the visit to state , where
Then the cycle lengths are
and consequently, is the total length of the first cycles:
One checks that each 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 and by time-homogeneity, the random variables are i.i.d., with .
Let be the largest number of cycles such that by
Hence, by definition, and consequently,
Since is recurrent, we have as . Then, by SLLN theorem 1.7.28,
and
| (1.7) |
Hence, when ,
We next handle the null recurrent case when . Suppose that is null recurrent, so . Reuse the same notations , , and . For each positive integer , define the truncated cycle lengths
Since are i.i.d., the bounded random variables are also i.i.d. Hence, by SLLN theorem 1.7.28,
Since increases monotonically as , by monotone convergence, by null recurrence. Then, for any positive integer , there exists a sufficiently large such that .
Since for each fixed , pointwise, then
Hence, for any fixed positive integer ,
Since this holds for every positive integer , we conclude that
Since is recurrent, we still have as , and . By prior squeezing argument eq. 1.7, when ,
For the general recurrent case when , let be the first hitting time from to . By the strong Markov property at time , the path after time behaves like a fresh copy of the chain started from . Thus the path consists of an initial segment of length , after which the chain proceeds through successive -cycles. Let for the cycles before steps, then
By theorem 1.7.26, , and thus
hence the same squeezing argument eq. 1.7 as in the case yields
∎
For a sequence of random variables , if
and there exists a finite such that for all , then
Let be an irreducible Markov chain, then for any state ,
where the first 2 equalities are from linearity of expectation, and the third equality is from theorem 1.7.41. ∎
Positive recurrence and null recurrence are class properties.
By corollary 1.7.20, states in a communicating class are either all recurrent or all transient. Hence, we focus on recurrent class. Let state be in , and on we have . By corollary 1.7.42 and theorem 1.7.13,
The proof idea goes similar to corollary 1.7.20. If is null recurrent by , then has to be null recurrent; conversely, if is positive recurrent with , then means is positive recurrent. ∎
A state in a discrete time Markov chain is periodic if there exists an integer
unless . is periodic if such that all states have period . Otherwise, a state or chain is aperiodic.
For a discrete time Markov chain defined over , that transitions to with probability each, the discrete time Markov chain is periodic as .
An aperiodic, positive recurrent state is ergodic. A Markov chain is ergodic if all states are ergodic.
Any finite, irreducible, aperiodic Markov chain is an ergodic Markov chain.
Let be an irreducible ergodic Markov chain, the exists for any state , and
Discrete convolution for sequences and is
A renewal kernel is a probability mass function on positive integer such that each and . Given a forcing sequence , a sequence solves the renewal equation if
Let , and the span for be . If then is aperiodic. Supposing is aperiodic and , and is absolutely summable by . Let be the unique bounded solution to the renewal equation by , then the limit exists by
The proof for lemma 1.7.48 is immediate by theorem 1.7.50.
Given an irreducible ergodic Markov chain, suppose , then can be derived as a renewal equation by
and the “forcing sequence” is follows s, as , thus the absolute sum is 1. Since the Markov chain is ergodic, then is aperiodic and . Hence,
∎
Consider a sequence of fair, independent gambling games between 2 gamblers. One wins or loses a dollar with probability . The state of the chain at time is the number of dollars won. Start from initial state 0.
We assume that a player loses by dollars and wins by dollars. Hence, these are the only 2 recurrent states, while the others are transitioning out to either or . We write for the probability of dollars at the steps. Let be one of the transient states, then . Hence, let , then .
Let be the random variable for the gain of the player at the step, where the game has not stopped yet. On one hand, the games are fair, then by linearity of expectation, . On the other hand,
Therefore, .
A stationary (equilibrium) distribution of a Markov chain is a distribution such that .
Any finite, irreducible, ergodic Markov chain has the following properties:
The chain has a stationary distribution such that .
For all , the exists, and is independent of .
for all .
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 is given by .
Given the prior observation of forgetting the initial state, then the limiting probability of being becomes reasonable, that any initial state ends up in state at the step has same probability of . Since is the average returning time from state , then we should expect to be in state with probability .
The proof for theorem 1.7.53 is immediate by lemma 1.7.48, together with showing .
Given a state that , then similar to 1.7.19, we write
Then for a , we have
On the other hand, since , which leads to
Since , as approaches , , which proves the limiting probability of is independent of .
We now show and for all to complete the proof. Fix a state ,
and by theorem 1.7.13,
Together with lemma 1.7.48, we complete the proof. ∎
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.
Let 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.
Let there be a state for the finite, irreducible, ergodic Markov chain, then by stationary distribution
that the invariant reaches by
By generalizing to the subset , the proof is completed. ∎
The theorem 1.7.56 gives another way of deriving stationary distribution of on a graph perspective. The cut-set around state holds an invariant of . If is a cut-set around , then in stationary distribution the probability crossing the cut in one direction is equivalent to the probability crossing the cut in the other direction.
Consider a finite, irreducible, ergodic Markov chain with a transition matrix . If there are nonnegative such that , and if any pairs such that , then is a stationary distribution for . Chains satisfying the condition are time reversible.
An irreducible, aperiodic Markov chain belongs to one of the following two categories:
The chain is ergodic: For any pair of states , exists and is independent of , and has .
The chain has no positive recurrent state: For any state , , and the chain has no .
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,
Showing the limiting probability is independent of 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 . By corollary 1.7.42,
since for null recurrent states. contradicts the Cesàro summation, hence . ∎
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.
An 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.
Supposing
for a doubly stochastic matrix, then the stationary distribution has
for an arbitrary , which completes the proof. ∎
Let be the sum of independent fair dice rolls. Show that for any ,
Let the current accumulation be , be the accumulation modulo , and be the transition probability over states of , then can be represented as follows
Hence, if and . Moreover, we discover the invariant of
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 : rolling for exactly times and for a time, and path of length : rolling for times. Since , the chain is aperiodic, and hence it is ergodic. By theorem 1.7.53,
∎
Consider a finite state Markov chain with stationary distribution and transition probability . Starting at time 0 and running for states, obtaining a sequence of states . Consider the states in reverse order, .
Argue that given , is independent of , that the reverse sequence is Markovian.
Argue that for the reverse sequence, the transition probability is given by
Show that if the original Markov chain is time reversible, that , then : the state follows the same transition probability, whether viewed in forward order or reverse order.
We already know the Markovian by
By Bayes’ rule,
the numerator can be decomposed by
and the denominator can be decomposed by
Hence, we prove the independence by
Given 2 states , when ,
hence
If the chain is time reversible, then it is straightforward that by swapping in . ∎
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
Consider the 1-dimensional random walk, and the particle returns to 0 only on even length steps. Hence,
where the second inequality holds from lemma 1.7.1, and the third inequality holds from . By 1.7.19, that
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 from by
hence the 2-dimensional random walk is also at least recurrent by corollary 1.7.20 and
For a random walk of dimension , the exact probability of recurrence after moves is
that is choosing each operation out of moves over dimensions, then each dimension contains only even moves, with the probability of returning to 0 after the even moves; or equivalently, for moves, each choose 1 out of directions, and each opposite directions should have same amount of moves. We simplify further by noticing
and hence
For fixed dimension , the multinomial coefficient is maximized when the are as balanced as possible, and
which follows from lemma 1.7.1444 https://www.statslab.cam.ac.uk/~jrn10//Markov/s16.pdf . Hence,
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 from 1.7.19, that
we can (no I can’t) construct as follows
then . Since
| (1.8) |
then , and hence , yielding
for , and
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 should be positive, yet 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.
Consider the Markov chain over : For , the particle move to with probability , and to with probability for , and from 0 to 1 with probability 1.
Show that the chain is transient when , positive recurrent when , and null recurrent when .
The particle returns to only on even number of steps. Hence, we want to count all possible steps random walk over , such that the particle never go to negative side, to derive and .
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 counts unique Dyck paths of ups and downs. Noticing that for ups and downs, is the number of unique Dyck paths that first returns after steps. Hence, we can count by
that leads by first returns from to steps, and . We derive with generating function method in the same way as 1.7.64, by constructing
Then , as approaches when . By previous eq. 1.8 in 1.7.64,
Hence, , and we march on to derive :
Again by eq. 1.8,
When , is bounded, and the chain is positive recurrent.
When , is infinity, and the chain is null recurrent.
When , 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
and we have .
When , , hence the chain is positive recurrent.
When , but are 0, by lemma 1.7.48 the chain is null recurrent.
When , diverges for any positive , hence no stationary distribution exists.
∎
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 counts Dyck paths of ups and downs by
with the property and
Consider example 1.7.51. Show that the expected number of games is .
Let be the random variable for the number of steps to be absorbed for a particle to start at state . Then
for , and . Now we have the linear system for
and solve by
Hence, for , we have to complete the proof. ∎
Consider the gambler’s ruin where games are unfair with losing probability . Suppose one starts with dollars by either reaching or . Let be the amount one gained after games.
Show that .
Determine the probability of finishing with and the probability of finishing with when starting at position .
Generalize when losing probability is .
We write to denote the probability of being at position at step. Moreover, and for each , we have the following invariant
and hence by
Since for arbitrary , then .
Let be the probability of absorbing to from state , then
hence .
In general, for losing probability , we want to find similar invariant such that
and solve for , which yields
When , as in example 1.7.51. ∎
Suppose that we are given records, kept in some order. The cost of accessing the record in the order is . Thus, if we had four records ordered as , then the cost of accessing would be 2 and the cost of accessing would be .
Suppose further that, at each step, record is accessed with probability , with each step being independent of other steps. If we knew the values of the in advance, we would keep the in decreasing order with respect to . But if we don’t know the 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 before was accessed, then the order at the next step would be .
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 be the cost for accessing the requested record. Determine an expression for .
By the building process, we observe a pattern: To build towards a target , we build from to , then to , finally .
We illustrate here by enforcing each state to contain substring at most, and notice the absorbing relation
then we can use cutset to inductively derive the stationary distribution for . For simplicity we say .
The simplest case is as follows,
and hence the stationary distribution of is
Relaxing to and , we have
and hence the stationary distribution for is
By cutset, for , the inflowing probability is its stationary distribution, then
and therefore
Hence, by induction, the resulting stationary distribution is
To derive the as , 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 record, and record in any position after record, is
Let be random variable for the order of record in the queue, then by linearity of expectation,
Hence, by conditional expectation, we have
∎
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?
We show the vanilla Markov chain of the infinite discrete queue that each step only 1 of the 2 things happens.
By cutset , exists only on when the chain is positively recurrent,
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.
By cutset , exists only on when the chain is positively recurrent,
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.
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 .
By cutset, we have
hence for ,
and by , we have
Therefore, for ,
with the existence condition for being , in which case the chain is positively recurrent. ∎
A random walk on is a Markov chain defined by the sequence of moves of a particle between vertices of . The position of the particle at a particular time step is the state of the chain. If the particle is at vertex with outgoing edges, then the probability that the particle follows edge to neighboring vertex is .
A random walk on an undirected graph is aperiodic iff is not bipartite, which means there is no 2-coloring such that the endpoints of each edge are colored differently.
A graph being not bipartite means it has cycles of odd length. If a graph 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 . Otherwise, undirected 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 defines a Markov chain that converges to a stationary distribution that is determined by the degree sequences of the graph.
A random walk on a finite, undirected, connected, and non-bipartite has a stationary distribution where
Since , then defines a proper distribution of particle appearing over .
On the other hand, by definition of stationary distribution in theorem 1.7.56, for and its neighbors ,
where the second equality holds from . ∎
Show that the Markov chain defined by a random walk on a finite, undirected, non-bipartite, connected graph is time reversible.
For , if , the commute time .
Let be the set of directed edges: for every , we have 2 directed edges and in .
We can view the random walk over as a Markov chain of state space , where the state of the Markov chain at the time step is the direct edge taken by the random walk in its transition. The Markov chain has states, and the stationary distribution for all , by cutset theorem 1.7.56
for all and is the set of neighboring vertices of , is a solution. By theorem 1.7.53,
hence : after taking the directed path , the expected number of steps to retake is . By Markovian (memoryless) of the random walk, once it reaches , it forgets about it reaches by , hence the expected time to start from and reach and take to is .
Since will not rule out the walk reaching without taking , then it will not force the walk to go back to and take , even if it reached before, hence . ∎
A cat and a mouse each independently take a random walk on a connected, undirected, non-bipartite graph . 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 and . Show an upper bound of on the expected time before the cat eats the mouse.
Construct a graph from by making vertices , and edges for all such that and . Counting the degrees of each vertices double counts , then
such that .
We show that, for every , there exists paths of length to a in the connected, undirected, non-bipartite graph. First, for every , the path in between over is length. Then, for paths in between and , we use to denote the paths lengths,
If both are even or odd, then there exists path in between of length , as the shorter one can keep looping in between and for steps, such that they eventually meet at .
Otherwise, since is non-bipartite, there exists odd length cycle in , 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 length, and original paths are lengths, hence the resulting length is .
After obtaining such path from to of length , we bound by
where the second inequality holds by enforcing the path from to , similar to the idea of lemma 1.7.77, and the third inequality is immediate by lemma 1.7.77. Hence, the expected time . ∎
The covering time of is the max of all of the expected time to visit all vertices by a random walk starting from .
The covering time of is upper bounded by .
One can consider traversing all vertices with a MST in , such that there are directed paths in the MST. Then we bound similarly in lemma 1.7.77 and 1.7.78 by enforcing the paths
∎
We introduce Matthew’s theorem, connecting the hitting time to the covering time. We write .
The covering time of with is bounded by
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 over sampled from uniform permutation over , write as the maximal hitting time for convenience, be the first time step when all the first vertices have been visited in the order 666 If are visited for , then when is visited, . , and be the state of the Markov chain at the time step.
Given all the prior setup, we are interested in the time intervals . Given the random walk history,
for 777 Coupon-collector on the first entries, that does not strictly enforces traverse by the permutation, but enforces by visiting first entries. , and the expected time to cover the graph starting from is
For , one has probability having , otherwise is reached by random walk. By conditional expectation,
where the second inequality holds by upper bounding the expectation of hitting time, and when .
For , if has already been visited previously, then as , otherwise regardless.
Since the permutation is sampled uniformly random and independent of the random walk, then any one of can be the last visited for first entries with probability 888 being last visited w.r.t. the fixed random walk is only related to , by symmetry of random permutation, the probability is . , and hence
The lower bound is proven in the same way, by setting to be the minimal of the expected hitting time. ∎
A lollipop graph on vertices is a clique connected to a long path. is the node being both clique and path, and be the other end of the path. Show the starting from is , and starting from is .
We bound the covering time from by enforcing the path from to , then to other . By lemma 1.7.80,
For , let be vertices on the path, we have
hence , and .
For for some , let and that , then
then .
For the rest of hitting time from , , there is a vanilla way of computing by
then .
Another way of deriving is by taking advantage of theorem 1.7.75, that the lollipop graph is non-bipartite as has odd length cycle, then
where , hence . Since , and , hence
Therefore, the covering time from is .
To derive the from , is upper bounding the covering time for the path part, then
and we have the formulas
then , and hence , which explains from is . ∎
Let equidistant points be marked on a circle. WLOG, think of the points as being labeled clockwise from to . Initially, a wolf begins at 0 and there is one sheep at each of the remaining points. The wolf takes a random walk on the circle. For each step, it moves with probability to one neighboring point and with probability 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?
Brain teaser. Say for any sheep is eaten last, then view this as a Gambler’s Ruin example 1.7.51 by states and absorb at both ’s. Now the requirement is, visit all states before absorbing.
Visiting first is mutually exclusive with visiting first, and hence the rest is visiting or , then absorb to the on the other end, which is of probability in total.
Such probability holds for any , and hence all sheeps eaten last is equal probability. ∎
Let be an edge in a hypercube of nodes.
Prove the expected time between the traversal of edge is .
We consider the time between transitions from to in a different way. After moving from to , the walk must first return to . When it returns to , the walk might next move to , or it might move to another neighbor of , in which case it must return to again before moving to for there to be a transition from to .
Use symmetry and the above description to prove the following recurrence:
Conclude that .
Using the result on the hitting time of adjacent vertices and Matthews’ theorem, show the cover time is .
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 , and that the cover time is correspondingly .
Each vertex in an -dimensional hypercube has edges, then . By lemma 1.7.77,
To derive again from geometric distribution, consider going to , or other neighbors in . It takes one step to go from to any . To get back to from , by symmetry.
Hence, a trial contains going back from neighbor , then depart from to one of the neighbors in . By Markovian of random walk, the probability of going from to is , hence the expected steps to take is
By prior result on by lemma 1.7.77, we conclude that .
Consider any for the hypercube, that . Similar to 1.7.78, we upper bound by
where there is a path of length connecting and , as there are at most bits different in between and . By lemma 1.7.81, , hence the covering time is upper bounded by .
For departing from , we can model the hitting time to by the Hamming distance as follows.
Then the linear system for the hitting time is
and let with , then
Since
then
and eventually
Since , hence
and
and finally
Parrondo’s paradox shows that, sometimes 2 losing games combined together makes a winning game.
Consider a game with a biased coin , winning with probability and losing with probability .
Consider a game , that the coin flipped depends on the state of the game.
Let be the number of games won so far, and be the number of games lost so far, then is the winning.
If , then use coin winning with probability and losing with probability .
Otherwise, use coin winning with probability and losing with probability .
To show whether game is winning or losing, we use the following lemma.
For any sequence of moves that starts at and ends at before reaching , let be a 1-to-1 mapping to such that negates every number starting from the last 0 in the sequence , then
We can view the game by a Markov chain over that starts from , with being 2 absorbing states. Similar to the Gambler’s ruin argument in example 1.7.51, if it is more likely to reach before reaching , then the game is a losing game.
Now consider the 1-to-1 mapping. Let
be the number of moves ,
be the number of moves from ,
be the number of moves , , , ,
be the number of moves , , ,
in . Then
Consider reaching before reaching that is 1-to-1 mapped to .
Since the first move after last 0 in is , then the first move after last 0 in is , hence . By symmetry of , we have .
After the last in , there is no moves. The remaining moves in are , , and . For , the remaining moves are , , and .
All the moves then in are self-cancelling, symmetric to the then on side.
What remains is in , and in . Hence, , and .
Therefore,
and the ratio . ∎
Suppose , , , then both game and game are both losing, as .
However, with a fair coin with , we combine the game by winning on coin plays game , and losing on coin plays game . In this case, and , and eventually .
The difference lies in the fair coin breaks the structure of game , that is rather likely to lose on any game with . If one managed to get over the barrier in game with game , which is close to a fair game, then it is likely to win the next 2 games.