0:00 / 0:00

Markov Chains

A Markov matrix is a square matrix whose columns are numbers in [0,1]\left[0,1\right] which sum to 1.
This is also known as a transition matrix, a stochastic matrix, or a migration matrix.
Examples
Markov matrix
A=[1/3011/31/401/33/40]A = \left[ \begin{array}{ccc} 1/3 & 0 & 1\\ 1/3 & 1/4 & 0\\ 1/3 & 3/4 & 0\\ \end{array} \right]
Not a Markov matrix
B=[1021/2]B= \left[ \begin{array}{cc} -1 & 0\\ 2 & 1/2 \end{array} \right]
  • First column: contains numbers that are not between 0 and 1.
  • Second column: the sum of the entries is not 1.
PAGE BREAK

Interpretation

The entries in a Markov matrix represent proportions or probabilities.
For example, entry aija_{ij} of a migration matrix is the proportion of the population moving from location jj to location ii.
Example
Fromloc 1loc 2Toloc 1loc 2[1/413/40]\begin{array}{rrc} && \textbf{From}\\ && \text{loc 1} \quad\quad \text{loc 2}\\[0.8em] \textbf{To} & \begin{array}{r} \text{loc 1}\\[0.5em] \text{loc 2} \end{array} & \left[ \begin{array}{rr} \quad 1/4 \quad & \quad 1 \quad\\[0.5em] \quad 3/4 \quad & \quad 0 \quad \end{array} \right] \end{array}
  • 1/41/4 of the population in location 1 stays in location 1
  • 3/43/4 of the population in location 1 moves to location 2
  • All of the population in location 2 moves to location 1
  • None of the population in location 2 stays in location 2
PAGE BREAK

Markov Chain Equation

The state vector at time nn is given by:
xn=[x1nxmn]amount at location 1 at time namount at location m at time n\vec x_n= \begin{bmatrix} x_{\colorTwo{ 1} n}\\ \vdots\\ x_{\colorTwo{ m} n} \end{bmatrix} \begin{array}{l} \leftarrow \text{amount at \textbf{location }} \bm{\colorTwo {1}} \text{ at time } n\\ \\ \leftarrow \text{amount at \textbf{location }} \bm{\colorTwo {m}} \text{ at time } n\\ \end{array}
If AA is a Markov matrix, we can determine the next state vector by computing:
xn+1=Axn\boxed{\quad \vec{x}_{n+1}=A \vec{x}_n \quad}

Wize Tip
The sum of the entries in each xn\vec x_n must be a constant at all time steps. Use this as a check!

PAGE BREAK

Steady State

If AA is a Markov matrix, then there exists a steady state vector xs\vec x_s such that xs=Axs\vec x_s=A\vec x_s.
As n\bm {\colorTwo n} increases, the state vectors xn\vec x_{\colorTwo{\bm{ n}}} approach the steady state xs\vec x_{\bm s}:
x0x1Ax0x2Ax1xnAxn1xsAxs\vec x_0 \quad \longrightarrow \quad \underbrace{\vec x_1}_{\normalsize A\vec x_0} \quad \longrightarrow \quad \underbrace{\vec x_2}_{\normalsize A\vec x_1} \quad \longrightarrow \quad \dots \quad \longrightarrow \quad \underbrace{\vec x_n}_{\normalsize A\vec x_{n-1}} \quad \longrightarrow \quad \dots \quad \longrightarrow \quad \underbrace{\vec x_s}_{\normalsize A\vec x_{s}}
Finding the Steady State Vector
xs\vec x_s can be found by solving:
(IA)xs=0 \boxed{\quad (I−A)\vec x_s= \vec0 \quad}
We can solve this homogeneous equation using Gauss-Jordan elimination (just like with eigenvectors!)
0:00 / 0:00

Example: Markov Chains

Consider the migration matrix A=[1/301/22/31/2001/21/2]A=\begin{bmatrix}1/3&0&1/2\\2/3&1/2&0\\0&1/2&1/2\end{bmatrix}.
Suppose there are initially:
  • 180 residents in location 1
  • 180 residents in location 2
  • 180 residents in location 3

Part A)

Find the population of each location after 1 and 2 units of time.
X1=AX0=[1/301/22/31/2001/21/2][180180180]=[150210180]X_1=AX_0=\begin{bmatrix}1/3&0&1/2\\2/3&1/2&0\\0&1/2&1/2\end{bmatrix}\begin{bmatrix}180\\180\\180\end{bmatrix}=\begin{bmatrix}150\\210\\180\end{bmatrix}
Therefore, after one time period, location 1 has 150 residents, location 2 has 210 residents, and location 3 has 180 residents.
X2=AX1=[1/301/22/31/2001/21/2][150210180]=[140205195]X_2=AX_1=\begin{bmatrix}1/3&0&1/2\\2/3&1/2&0\\0&1/2&1/2\end{bmatrix}\begin{bmatrix}150\\210\\180\end{bmatrix}=\begin{bmatrix}140\\205\\195\end{bmatrix}
Therefore, after two time periods, location 1 has 140 residents, location 2 has 205 residents, and location 3 has 195 residents.
PAGE BREAK

Part B)

Find the population of each location after a very long time.
We must find a solution to (IA)Xs=0(I-A)X_s = 0, so we will reduce the augmented matrix:
[2/301/22/31/2001/21/2]R2+R1R2[   2/301/201/21/201/21/2]R3+R2R3[   2/301/20   1/21/2000]2R2R232R1R1[       1       03/4011000]\begin{aligned} &\left[\begin{array}{rrr} 2/3&0&-1/2\\ -2/3&1/2&0\\ 0&-1/2&1/2 \end{array}\right]\\[2em] \underrightarrow{R_2+R_1\to R_2} &\left[\begin{array}{rrr} \ \ \ 2/3&0&-1/2\\ 0&1/2&-1/2\\ 0&-1/2&1/2 \end{array}\right]\\[2em] \underrightarrow{R_3+R_2\to R_3} &\left[\begin{array}{rrr} \ \ \ 2/3&0&-1/2\\ 0&\ \ \ 1/2&-1/2\\ 0&0&0 \end{array}\right]\\[2em] \xrightarrow[\normalsize 2R_2 \to R_2]{\normalsize \frac{3}{2}R_1\to R_1} &\left[\begin{array}{rrr} \ \ \ \ \ \ \ 1&\ \ \ \ \ \ \ 0&-3/4\\ 0&1&-1\\ 0&0&0 \end{array}\right] \end{aligned}
Solving for when this system equals the zero vector, we obtain a general solution xs=t[3/411]\vec x_s = t\begin{bmatrix}3/4\\1\\1\end{bmatrix}.
Now we must find a value of tt such that this vector has the same sum as x0\vec x_0 (and every state vector).
t(34+1+1)=180+180+180=540114t=540t=216011\begin{aligned} t\left(\frac{3}{4}+1+1\right)&=180+180+180=540\\[1em] \frac{11}{4}t &= 540\\[1em] t &= \frac{2160}{11} \end{aligned}
Therefore, the population in the long run is:
xs=216011[3/411]=[1620/112160/112160/11][147196196]\vec x_s = \dfrac{2160}{11}\begin{bmatrix}3/4\\1\\1\end{bmatrix}=\begin{bmatrix}1620/11\\2160/11\\2160/11\end{bmatrix}\approx\begin{bmatrix}147\\196\\196\end{bmatrix}

Practice: Markov Chains

Consider the following three temperature scenarios:
  • If it is hot today, it will not be hot tomorrow, and there is a 50% it will be mild tomorrow.
  • If it is mild today, there is a 2/3 chance it will be hot tomorrow, and a 1/3 chance it will be cold tomorrow.
  • If it is cold today, there is a 50% chance it will be hot tomorrow, and it will certainly not be mild tomorrow.
If today is Thursday and it is cold, what temperature scenario is most likely to occur on Saturday? What is its probability?
Extra Practice