## prettydoc
## TRUE
2. In Example 11.4, let a = 0 and b = 1/2. Find P, P^2 , and P^3 .
matrix_power <- function(M, exponent) {
ans <- M
for (i in 1:(exponent - 1)){
ans <- M %*% ans
}
return(ans)
}
a <- 0
b <- 1/2
d <- c(1 - a, a, b, 1 - b)
P <- matrix(d, nrow = 2, byrow = T)
row_col <- c("Yes", "No")
row.names(P) <- row_col
colnames(P) <- row_col
P; matrix_power(P, 2); matrix_power(P, 3)
## Yes No
## Yes 1.0 0.0
## No 0.5 0.5
## Yes No
## Yes 1.00 0.00
## No 0.75 0.25
## Yes No
## Yes 1.000 0.000
## No 0.875 0.125
What would P^n be? What happens to P n as n tends to infinity? Interpret this result.
## Yes No
## Yes 1 0
## No 1 0
\[\begin{equation}
P^n = \begin{bmatrix} 1, 0 \\
\frac{2n - 1}{2n}, \frac{1}{2n}
\end{bmatrix}
\end{equation}\]