P=matrix(c(1/4,1/4,1/4,1/4,1/5,1/5,2/5,1/5,1/3,1/3,1/6,1/6,1/6,1/3,1/3,1/6),nrow=4,ncol=4,byrow=T) #### raising 25th power y<-P for(i in 1:24) y<-y%*%P ### Solve the system of linear equations. PP<-P-diag(4) PP<-t(P-diag(4)) PP for(i in 1:4) PP[4,i]<-1 PP solve(PP,c(0,0,0,1)) ### Check eigen vector and eigen values PPP<-t(P) PPP eigen(PPP) ### normalizing them 0.4824350/(0.4824350+0.5472064+0.5628408+0.3886282) 0.5472064/(0.4824350+0.5472064+0.5628408+0.3886282) 0.5628408/(0.4824350+0.5472064+0.5628408+0.3886282) 0.3886282/(0.4824350+0.5472064+0.5628408+0.3886282)