knitr::include_graphics('10.1.png')

# Calculating N 

Q <- matrix(c(0, 0.5, 0.25, 0.5), ncol=2, byrow= T)
I <- diag(2)
IQ <- I - Q
N <- solve(IQ)

print(N)
##           [,1]     [,2]
## [1,] 1.3333333 1.333333
## [2,] 0.6666667 2.666667

The expected number of nice days and snowy days before rain starts are 0.6667 and 2.667 respectively.

# Calculating Nc 

c <- matrix(c(1, 1), ncol= 1, byrow=T)
Nc <- N %*% c
print(Nc)
##          [,1]
## [1,] 2.666667
## [2,] 3.333333

Expected number of nice and snowy days until the next rainy day is 2.66 and 3.33 respectively

# Calculation of N.R

R <- matrix(c(0.5, 0.25), ncol = 1, byrow= T)
N.R <- N %*% R
print(N.R)
##      [,1]
## [1,]    1
## [2,]    1

There is 100 percent probability of reaching of both rainy and snowy day