Find the matrices \(P^2\), \(P^3\), \(P^4\), and \(P^n\) for the Markov chain determined by the transition matrix P = \(A = \left( \begin{matrix} 1&0 \\ 0&1 \end{matrix} \right)\). Do the same for the transition matrix P = \(A = \left( \begin{matrix} 0&1 \\ 1&0 \end{matrix} \right)\). Interpret what happens in each of these processes.
# Computation of the matrix exponential
library(expm)
## Loading required package: Matrix
##
## Attaching package: 'expm'
## The following object is masked from 'package:Matrix':
##
## expm
v1 <- c(1,0,0,1)
P1 <- matrix(v1, nrow = 2)
P1
## [,1] [,2]
## [1,] 1 0
## [2,] 0 1
P1%^%2
## [,1] [,2]
## [1,] 1 0
## [2,] 0 1
P1%^%3
## [,1] [,2]
## [1,] 1 0
## [2,] 0 1
P1%^%4
## [,1] [,2]
## [1,] 1 0
## [2,] 0 1
Hence if P = \(\left( \begin{matrix} 1&0 \\ 0&1 \end{matrix} \right)\) then \(P^n\) = P = \(\left( \begin{matrix} 1&0 \\ 0&1 \end{matrix} \right)\) as P is an identity matrix. It would be true for any size identity matrix.
v2 <- c(0,1,1,0)
P2 <- matrix(v2, nrow = 2)
P2
## [,1] [,2]
## [1,] 0 1
## [2,] 1 0
P2%^%2
## [,1] [,2]
## [1,] 1 0
## [2,] 0 1
P2%^%3
## [,1] [,2]
## [1,] 0 1
## [2,] 1 0
P2%^%4
## [,1] [,2]
## [1,] 1 0
## [2,] 0 1
P2%^%5
## [,1] [,2]
## [1,] 0 1
## [2,] 1 0
Hence if P = \(\left( \begin{matrix} 0&1 \\ 1&0 \end{matrix} \right)\) then
if n is even, \(P^n\) = \(\left( \begin{matrix} 1&0 \\ 0&1 \end{matrix} \right)\)
if n is odd, \(P^n\) = \(\left( \begin{matrix} 0&1 \\ 1&0 \end{matrix} \right)\)