Markov Chain (Part 1)
Markov Chain (Part 1)
Markov Chain (Part 1)
Noha Youssef
1 / 31
Table of Contents
Introduction
Definitions
Marginal Distributions
2 / 31
Introduction: Transition Diagram
3 / 31
Introduction
The transition diagram above shows a system with 7 possible
states: state space
S = {1, 2, 3, 4, 5, 6, 7}.
4 / 31
Definitions
5 / 31
Definitions
Definition 1
The state of a Markov chain at time t is the value of Xt . For
example, if Xt = 6, we say the process is in state 6 at time t.
Definition 2
The state space of a Markov chain, S, is the set of values that
each Xt can take. For example, S = {1, 2, 3, 4, 5, 6, 7}. Let S have
size N (possibly infinite).
6 / 31
Definitions
Definition 3
A trajectory of a Markov chain is a particular set of values for
X0 , X1 , X2 , · · · For example, if X0 = 1, X1 = 5 and X2 = 6, then
the trajectory up to time t = 2 is 1, 5, 6. More generally, if we refer
to the trajectory s0 , s1 , s2 , s3 , · · · , we mean that
X0 = s0 , X1 = s1 , X2 = s2 , X3 = s3 , · · · ’Trajectory’ is just a
word meaning ’path’.
7 / 31
Definitions
8 / 31
Definitions
Definition 5
A Markov process is time homogeneous if the transition
probability, Pij = P (Xt+1 = j|Xt = i), does not depend on t
9 / 31
Definition 6: Probability of a Path
The probability of a path i0 , i1 , · · · , it is
Proof
P {X0 = i0 , X1 = i1 , X2 = i2 }
= P {X2 = i2 |X1 = i1 , X0 = i0 }P {X1 = i1 |X0 = i0 }P {X0 = i0 }
= P {X2 = i2 |X1 = i1 }P {X1 = i1 |X0 = i0 }P {X0 = i0 }
= pi1 ,i2 pi0 ,i1 P {X0 = i0 } = P {X0 = i0 }pi0 ,i1 pi1 ,i2 .
and so on · · ·
10 / 31
Probability of a Path
11 / 31
Transition Diagram
For a transition diagram each node represents a state of the system
and is numbered accordingly, directed arc connects state i to state
j if a one-step transition from i to j is possible. The one-step
transition probability pij is written next to the arc. Notice that a
transition from a state to itself is represented by a loop The transition
diagram shows the transitions between different states.
13 / 31
Transition Matrix
The transition matrix is usually given the symbol P = (pij ). In the
transition matrix P:
◮ the rows represent NOW, or FROM (Xt );
◮ the columns represent NEXT, or to (Xt+1 );
◮ entry (i, j) is the CONDITIONAL probability that
N EXT = j, given that N OW = i: the probability of going
FROM state i TO state j.
Pij = P (Xt+1 = j|Xt = i).
◮ The transition matrix P must list all possible states in the
state space S.
◮ P is a square matrix (N × N ), because Xt+1 and Xt both
take values in the same state space S (of size N ).
◮ The rows of P should each sum to 1:
◮ This simply states that Xt+1 must take one of the listed
values.
◮ The columns of P do not in general sum to 1.
14 / 31
Example 1
15 / 31
Example 2
Let us assume that the student changes state during the festival
according to the following transition matrix:
0 0 1 0
1/2 0 1/2 0
1/4 1/4 1/4 1/4 .
0 0 0 1
16 / 31
Exercise 1
Purpose-flea zooms
around the vertices
of the transition di-
agram opposite. Let
Xt be Purpose-flea’s
state at time t (t =
0, 1, · · · ).
1. Find the
transition
matrix, P .
2. Find P (X2 =
3|X0 = 1).
17 / 31
Exercise 1:Solution
18 / 31
Exercise 2:(Ross, 2003, Example 4.3, p. 182)
On any given day, Evaristo is either cheerful (C), so-so (S), or glum
(G).
◮ If he is cheerful today, then he will be C, S, or G tomorrow
with probabilities 0.5, 0.4, 0.1, respectively.
◮ If he is feeling so-so today, then he will be C, S, or G
tomorrow with probabilities 0.3, 0.4, 0.3.
◮ If he is glum today, then he will be C, S, or G tomorrow with
probabilities 0.2, 0.3, 0.5.
Let Xn denote Evaristo’s mood on the nth day, then {Xn : n ∈ N0 }
is a three-state Markov chain (state 1 = C, state 2 = S, state 3 =
G). Identify the TPM of this DTMC.
19 / 31
The t-Step Transition Probability
for any t.
pij is the probability of making a transition FROM state i TO state j
in a SINGLE step. what is the probability of making a transition from
state i to state j over two steps? I.e. what is P (X2 = j|X0 = i)?
20 / 31
The t-Step Transition Probability
We are seeking P (X2 = j|X0 = i). i.e. 2-step transition. Use the
Partition Theorem:
P (X2 = j|X0 = i) = Pi (X2 = j)
N
X
= Pi (X2 = j|X1 = k)Pi (X1 = k) Partition Theorem
k=1
N
X
= P (X2 = j|X1 = k, X0 = i)P (X1 = k|X0 = i)
k=1
XN
= P (X2 = j|X1 = k)P (X1 = k|X0 = i) Markov Property
k=1
XN
= Pkj Pik by definition
k=1
N
X
= Pik Pkj = (P 2 )ij rearranging
k=1
21 / 31
The t-Step Transition Probability
22 / 31
The t- Step Transition
23 / 31
The t- Step Transition
for any n.
24 / 31
Marginal Distributions
Let {X0 , X1 , X2 , · · · } be a Markov chain with state space S =
{1, 2, · · · , N }. Now each Xt is a random variable, so it has a prob-
ability distribution. We can write the probability distribution of Xt
as an N × 1 vector. For example, consider X0 . Let π be an N × 1
vector denoting the probability distribution of X0 :
π1 P (X0 = 1)
π2 P (X0 = 2)
π = .. = ..
. .
πN P (X0 = N )
To predict the state of the system at time t, t ≥ 0, we need to
compute the marginal distribution of Xt .
N
X
P (X1 = j) = P (X1 = j|X0 = i)P (X0 = i)
i=1
N
X N
X
= pij πi = πi pij = (π T P )j .
i=1 i=1 25 / 31
Marginal Distributions
Same method applies to the marginal distribution of X2 , condition-
ing on X0 ,
N
X
P (X2 = j) = P (X2 = j|X0 = i)P (X0 = i)
i=1
XN
= (P 2 )ij πi = (π T P 2 )j .
i=1
Theorem 1
Let {X0 , X1 , X2 , · · · } be a Markov chain with N × N transition
matrix P . If the probability distribution of X0 is given by the
1 × N row vector π T , then the probability distribution of Xt is
given by the 1 × N row vector π T P t . That is,
X0 ∼ π T ⇒ Xt ∼ π T P t .
26 / 31
The Chapman-Kolmogorov Equations
Theorem 2
The t − step transition probabilities satisfy the following equations:
N
(n+l)
X
pij = pnik plkj .
k=1
27 / 31
Proof of The Chapman-Kolmogorov Equations
(n+l)
pij = P (Xn+l = j|X0 = i)
N
X
= P (Xn+l = j, Xl = k|X0 = i)
k=1
XN
= P (Xn+l = j|Xl = k, X0 = i)P (Xl = k|X0 = i)
k=1
N
X
= P (Xn+l = j|Xl = k)P (Xl = k|X0 = i)
k=1
XN
= P (Xn = j|X0 = k)P (Xl = k|X0 = i)
k=1
XN N
X
= Pk j n Pik
l
= l
Pik n
Pkj n+l
= (P )ij .
k=1 k=1
28 / 31
Example
29 / 31
Exercise 1 (Continued)
3. Suppose that Purpose-flea is equally likely to start on any
vertex at time 0. Find the probability distribution of X1 .
4. Suppose that Purpose-flea begins at vertex 1 at time 0. Find
the probability distribution of X2 .
5. Suppose that Purpose-flea is equally likely to start on any
vertex at time 0. Find the probability of obtaining the
trajectory (3, 2, 1, 1, 3).
Solution
3. π = {1/3, 1/3, 1/3} then
P (X1 = i) = π T P
0.6 0.2 0.2
1 1 1
= ( 3 3 3 ) 0.4 0 0.6
0 0.8 0.2
1 1 1
= ( 3 3 3 ).
30 / 31
Exercise 1(Continued)
[5.]P (3, 2, 1, 1, 3) = P (X0 = 3)p32 p21 p11 p13 = (1/3) × 0.8 × 0.4 ×
0.6 × 0.2 = 0.0128.
31 / 31