11.1 - Problem 2:

In Example 11.4, let a=0 and b=1/2. Find P, P^2,and P^3.What would Pn be? What happens to Pn as n tends to infinity? Interpret this result.


Given:

From example 11.4: \[ P= \left(\begin{array}{cc} & Yes & No\\ Yes & 1-a & a\\ No & b & 1-b \end{array}\right) \]

a <- 0
b <- 1/2
given_p <- c(1-a, a, b, 1-b)
p <- matrix(given_p, nrow = 2, byrow = T)
row.names(p) <- c("Yes", "No")
colnames(p) <- c("Yes", "No")
p
##     Yes  No
## Yes 1.0 0.0
## No  0.5 0.5
matrix_loop <- function(p, exp) {
  ret <- p
  for (i in 1:(exp-1)){ret <- p %*% ret}
  return(ret)
}
matrix_loop(p,2)
##      Yes   No
## Yes 1.00 0.00
## No  0.75 0.25
matrix_loop(p,3)
##       Yes    No
## Yes 1.000 0.000
## No  0.875 0.125
matrix_loop(p,100000)
##     Yes No
## Yes   1  0
## No    1  0

\[ P^n= \left(\begin{array}{cc} & Yes & No\\ Yes & 1 & 0\\ No & \frac{2n - 1}{2n} & \frac{1}{2n} \end{array}\right) \]

\[ P^{\infty} = indeterminant \]