lacunary - Mathnotes

Markov Chains

Definition: Markov Chain \@{markov-chain}

If we have a system with N states and for each state, a set of N probabilities from transitioning from that state to another state (including itself) we end up with an N×N matrix P where the entry Pjk,j,k∈{1,…,N} represents the probability of transitioning from state j to state k.

Starting with some state, we can transition to another state, then another, with the probability of picking the next state dependent only on the existing state and the matrix P. We call this sequence of random events a Markov Chain.

More formally, the sequence or random variables X1,X2,…,Xn is called a Markov Chain if

P(Xn+1=k|Xn=j,Xn−1=jn−1,…,X0=j0)=P(Xn+1=k|Xn=j).

We write

pjk=P(Xn+1=k|Xn=j),

and note that

pjk≥0

and

∑k=1Npjk=1

for j=1,2,…,N. We call the pjk values the transition probabilities of the Markov chain.

Alternatively, we can say the sequence or random variables X,Y,Z is said to form a Markov Chain (denoted X→Y→Z) if and only if X and Z are conditionally independent given Y. Specifically, X,Y and Z form a Markov Chain X→Y→Z if the joint probability mass function can be written as

p(x,y,z)=p(x)p(y|x)p(z|y).

Theorem: Conditional Independence Given Intermediate Step \@{conditional-independence-given-intermediate-step}

Random Variables X,Y,Z form a markov chain X→Y→Z if and only if X and Z are conditionally independent given Y.

Proof \@{proof-of-conditional-independence-given-intermediate-step}

Suppose X and Z are conditionally independent given Y. Then, using Bayes' Theorem we have

p(x,z|y)=p(x|y)p(z|y)=p(x)p(y|x)p(z|y)p(y)

Then,

p(x,y,z)=p(y)p(x|y)p(z|y)=p(y)p(x)p(y|x)p(z|y)p(y)=p(x)p(y|x)p(z|y).

Now assume we have Markovicity, i.e p(x,y,z)=p(x)p(y|x)p(z|y). Again, using Bayes:

p(x,y,z)=p(x)p(y|x)p(z|y)=p(x)p(x|y)p(y)p(z|y)p(x)=p(x|y)p(y)p(z|y).

So, for a fixed y we have p(x,y,z)p(y)=p(x|y)p(z|y).

◻
Theorem: Reversibility of Markov Chains \@{reversibility-of-markov-chains}

If Random Variables X,Y,Z form a markov chain X→Y→Z, then Z→Y→X is also a Markov Chain (hence it is sometimes written as X↔Y↔Z.)

Proof \@{proof-of-reversibility-of-markov-chains}

Using Bayes' Theorem,

p(x,z|y)=p(x|y)p(z|y)=p(x|y)p(y|z)p(z)p(y). Then,

p(x,y,z)=p(y)p(x|y)p(z|y)=p(y)p(x|y)p(y|z)p(z)p(y).=p(z)p(y|z)p(x|y).

◻
Theorem: Function of middle variable forms Markov Chain \@{function-of-middle-variable-forms-markov-chain}

Given Random Variables X,Y,Z if Z=f(Y), then X→Y →Z.

Proof \@{proof-of-function-of-middle-variable-forms-markov-chain}

If Z=f(Y), then Z is independent of X, so

p(y,z|x)=p(y|x,z)=p(y|x)p(z|y),

and then

p(x,y,z)=p(x)p(y|x)p(z|y).

◻
Referenced by (1 direct)
Note \@{note-8}

Note that pjk is the probability of going from state j to state k in one step. We use the notation

pjk(m)

to represent the probability of going from state j to state k in m steps.

Theorem \@{theorem-9}

pjk(m)=Pjkm.

Proof \@{proof-of-theorem-9}

Due to the magic of linear algebra, if we have a row vector x representing the probability of starting in each state, we can compute the probability of ending up in any given state after m steps as

x⋅Pm.

◻

Ergodic Markov Chains

Definition: Ergodic \@{ergodic}

If for some positive integer m we have that pjk(m)>0 for all j,k=1,2,…,N, then the Markov chain is said to be ergodic.

Theorem: Stationary Distribution of an Ergodic Chain \@{stationary-distribution}

When the markov chain is ergodic, the limit

πk=limn→∞pjk(n)

exists and

∑k=1Nπk=1.

Note \@{stationary-distribution-note}

Here, π=⟨π1,π2,…,πN⟩ and the entries in it represent the long term probabilities of being in any given state, or equivalently, the portion of time spent in any given state.

Note that π⋅P=π, which when combined with the fact that the entries of π sum to 1 lets us solve a linear system of equations to find the entries of π.

Theorem \@{probability-vectors-form-a-convex-compact-set}

The set of probability vectors in Rn is a convex set, and it is compact.

Proof \@{proof-of-probability-vectors-form-a-convex-compact-set}

Let E be the set of probability vectors in Rn. That is,

E={p∈Rn:pi≥0,∑i=1npi=1.}

(Note: E is a n−1 dimensional @simplex).

Suppose X,Y∈E. Then

∑i=1nXi=1,∑i=1nYi=1.

Then, let λ∈[0,1]. Now,

∑i=1nλXi=λ,∑i=1n(1−λ)Yi=1−λ,

λX+(1−λ)Y=∑i=1n(λXi+(1−λ)Yi)=λ+1−λ=1.

Since either λ or 1−λ are non-negative, all entries of this convex combination are non-negative, so the combination is again in E and is therefore a probability vector.

We can use Heine-Borel to show that E is compact by showing it is closed and bounded.

Noe that for each p∈E, and each @coordinate i,

{p∈Rn:pi≥0}

is a closed half-space. Now, note that the map

f:Rn→R,f(p)=∑i=1npi

is continuous, the pre-image of 1 under f is

{p∈Rn:∑i=1npi=1.}=f−1({1}).

Because 1 is closed in R, by A mapping f of a metric space... we have that

{p∈Rn:∑i=1npi=1.}

is closed

Now,

E=(⋂i=1n{p:pi≥0})∩{p:∑i=1npi=1}

is an intersection of closed sets, which is also closed.

E is obviously bounded - the sum of all coordinates in p∈E is always 1, so E⊂ the closed ball of radius 1 centered at the origin.

Therefore, E is closed and bounded, and is compact.

TODO: we can generalize this to the fact that @simplexes are convex and compact.

◻
Referenced by (1 direct)
Definition: Stochastic Matrix (also: probability matrix, transition matrix, Markov matrix, right stochastic matrix, row stochastic matrix) \@{stochastic-matrix}

A stochastic matrix (actually, a right stochastic matrix) is a @square-matrix A=(aij)∈Rn×n with non-negative entries whose rows each sum to one:

aij≥0for all i,j,∑jaij=1for all i.

Equivalently, A1=1 with A≥0 entrywise, where 1 is the all-ones vector.

Definition: Left Stochastic Matrix (also: column stochastic matrix) \@{left-stochastic-matrix}

A left stochastic matrix is a @square-matrix A=(aij)∈Rn×n with non-negative entries whose columns each sum to one: aij≥0for all i,j,∑iaij=1for all j. Equivalently, 1⊤A=1⊤ with A≥0 entrywise, where 1 is the all-ones vector.

Referenced by (2 direct, 1 transitive)

Transitive (depth 1):

Note \@{note-19}

A stochastic matrix can be used to describe the transitions of a markov chain.

Definition: Doubly Stochastic Matrix (also: bistochastic matrix) \@{doubly-stochastic-matrix}

If a matrix is both a row stochastic matrix and a column stochastic matrix, it is said to be a doubly stochastic matrix. That is, both its rows and its columns sum to 1.

Referenced by (2 direct)

Direct references:

Note \@{note-21}

A doubly stochastic matrix is a convex combination of @permutation-matrices.

A stochastic matrix maps a probability vector to another probability vector — but only for the matching multiplication convention. A row stochastic matrix preserves the sum acting on the right, x⊤A; a column stochastic matrix preserves it acting on the left, Ax; and a doubly stochastic matrix preserves it either way. The demo below lets you apply each type to a probability vector, build doubly-stochastic matrices as convex combinations of permutation matrices, and iterate the map toward its stationary distribution.