CUNY 605 Discussion Week 10

Chapter 11 1.3 In example 11.5, find P, P2, and P3. What is Pn?

P = matrix(c(.5,.5,.5,.25,.25,.25,.25,.25,.25), ncol = 3, byrow = FALSE)

P_2 = P %*% P
P_3 = P_2 %*% P

print("Matrix P: ")
## [1] "Matrix P: "
P
##      [,1] [,2] [,3]
## [1,]  0.5 0.25 0.25
## [2,]  0.5 0.25 0.25
## [3,]  0.5 0.25 0.25
print("Matrix P^2: ")
## [1] "Matrix P^2: "
P_2
##      [,1] [,2] [,3]
## [1,]  0.5 0.25 0.25
## [2,]  0.5 0.25 0.25
## [3,]  0.5 0.25 0.25
print("Matrix P^3: ")
## [1] "Matrix P^3: "
P_3
##      [,1] [,2] [,3]
## [1,]  0.5 0.25 0.25
## [2,]  0.5 0.25 0.25
## [3,]  0.5 0.25 0.25

It appears obvious that there is a pattern here.

\[ P = P^2 = P^3 = ... = P^n = \left[\begin{array}{rrr} 0.5 & 0.25 & 0.25 \\ 0.5 & 0.25 & 0.25 \\ 0.5 & 0.25 & 0.25 \\ \end{array} \right]\]

Chapter 11.1 Question 7 Find the matrices P2, P3, P4, and Pn for the Markov chain determined by the transition marix P = matrix(c(1,0,0,1), nrow = 2, byrow = FALSE). Do the same for the transition matrix P = matrix(c(0,1,1,0), nrow = 2, byrow = FALSE). Interpret what happens in each of these processes.

P1 = matrix(c(1,0,0,1), nrow = 2, byrow = FALSE)
P2 = matrix(c(0,1,1,0), nrow = 2, byrow = FALSE)
# Determine the matrices P^2, P^3, P^4, P^n for both matrices.
P1_2 = P1 %*% P1
P1_3 = P1_2 %*% P1
P1_4 = P1_3 %*% P1

print("P: ")
## [1] "P: "
P1
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1
print("P^2: ")
## [1] "P^2: "
P1_2
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1
print("P^3: ")
## [1] "P^3: "
P1_3
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1
print("P^4: ")
## [1] "P^4: "
P1_4
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1

Given that the first matrix is an identity matrix. Anytime an identity matrix multiplies by itself, it will always produce the same matrix, the identity matrix. Hence,

\[ P^n = \left[\begin{array}{rrr} 1 & 0 \\ 0 & 1 \\ \end{array} \right]\]

# For the second example
P2_2 = P2 %*% P2
P2_3 = P2_2 %*% P2
P2_4 = P2_3 %*% P2

print("P: ")
## [1] "P: "
P2
##      [,1] [,2]
## [1,]    0    1
## [2,]    1    0
print("P^2: ")
## [1] "P^2: "
P2_2
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1
print("P^3: ")
## [1] "P^3: "
P2_3
##      [,1] [,2]
## [1,]    0    1
## [2,]    1    0
print("P^4: ")
## [1] "P^4: "
P2_4
##      [,1] [,2]
## [1,]    1    0
## [2,]    0    1

It appears that if n = odd, it produces:

\[ P^n = \left[\begin{array}{rrr} 1 & 0 \\ 0 & 1 \\ \end{array} \right]\] And if n = even, it produces:

\[ P^n = \left[\begin{array}{rrr} 0 & 1 \\ 1 & 0 \\ \end{array} \right]\]