Markov Chains
The SettingPermalink
There is a system with nn possible states/values. At each step, the state changes probabilistically.
Let XtXt be the state of the system at time tt
So the evolution of the system is: X0,X1,X2,⋯,Xt,⋯X0,X1,X2,⋯,Xt,⋯ and X0X0 is the initial state.
The system is memoryless: the probability that XtXt is in a certain state is determined by the state of Xt−1Xt−1:
Pr[Xt=x|X0=x0,X1=x1,⋯,Xt−1=xt−1]=Pr[Xt=x|Xt−1=xt−1]Pr[Xt=x|X0=x0,X1=x1,⋯,Xt−1=xt−1]=Pr[Xt=x|Xt−1=xt−1]For simplicity, we assume that:
- Finite number of states
- The underlying graph is strongly connected: for any two states, there is a path from 1 to 2 and a path from 2 to 1
Mathematical Representation of the EvolutionPermalink
In general, if the initial probabilistic state is [p1 p2 ⋯ pn]=π0[p1 p2 ⋯ pn]=π0, where pipi is the probability of being in state ii, ∑pi=1∑pi=1, and the transition matrix is TT, such that:
T[i,j]=Pr[X1=j|X0=i]T[i,j]=Pr[X1=j|X0=i]After tt more steps, the probabilistic state is:
[p1 p2 ⋯ pn]⋅TtAnd the probability of bing in state i after t steps is:
πt[i]=(π0Tt)[i]Some PropertiesPermalink
- Suppose the Markov chain is “aperiodic”, then as the system evolves, the probabilistic state converges to a limiting probabilistic state:
So the resulting π is called stationary/invariant distribution, which is unique.
- Let Tij be the time of reaching state j when you start at state i, then:
This is known as the Mean Recurrence Theorem.
Example: The Connectivity ProblemPermalink
Given a undirected graph G=(V,E),|V|=n,|E|=m, and s,t∈V, check if there is a path from s to t.
It is easy to do in polynomial time with BFS or DFS, but how about using only O(logn) space?
Here is a possible randomized algorithm:
v = s
for k = 1,2,...,N:
v = random-neighbor(v)
if v == t, return YES
return NO
For N=poly(n), then this uses O(logn) space.
But what is the success probability? If s and t are disconnected, we give the correct answer.
What if s and t are connected?
If we have a graph A represented by the following adjacency matrix, and we start at any vertex and randomly walk to a neighbor, how does the transition matrix look like?
A=(0111101011011010)thenT=(01/31/31/31/201/201/31/301/31/201/20)The stationary distribution is:
π=[deg(1)2m,deg(2)2m,deg(3)2m,⋯,deg(n)2m]So
E[Tii]=2mdeg(i)What we care is really E[Tij], where i and j are connected.
We pick a path from i to j: i=i1,i2,i3,⋯,ir=j (r≤n)
E[Tij]≤E[Ti1i2+Ti2i3+⋯+Tir−1ir]=E[Ti1i2]+E[Ti2i3]+⋯+E[Tir−1ir]≤2m+2m+⋯+2m=2mn≤n3Why E[Tuv]≤2m?
E[Tvv]=2mdeg(v)=k∑i=0Pr[first step v to ui]⋅E[Tvv|first step v to ui]=k∑i=01deg(v)⋅(1+E[Tuiv])≥1deg(v)⋅(1+E[Tu0v])⇒2m≥1+E[Tuv]⇒E[Tuv]≤2mSo if we set N in the algorithm to be 1000n3, then:
Pr[error]=Pr[Tst>1000n3]≤11000by Markov’s inequality.
Comments