Question: Consider the following circulant matrix:
![374_1.png](https://secure.tutorsglobe.com/CMSImages/374_1.png)
(a) P is an example of a stochastic matrix. Use the apply()function to verify that the row sums add to 1.
(b) Compute Pn for n = 2, 3, 5, 10. Is a pattern emerging?
(c) Find a nonnegative vector x whose elements sum to 1 and which satisfies
(I - PT )x = 0.
Do you see any connection between P10 and x?
(d) Using a loop, generate a pseudorandom sequence of numbers y from the set {1, 2, 3, 4} using the rules:
(i) set y1 ← 1
(ii) for j = 2, 3, ... , n, set yj = k with probability Pyj-1,k . For example, y2 would be assigned the value 1, with probability 0.1; 2, with probability 0.2; and so on. Choose n to be some large value like 10 000. The resulting vector y is an example of a simulated Markov chain
(e) Use the table()function to determine the relative frequency distribution of the four possible values in the y vector. Compare this distribution with the stationary distribution x calculated earlier.