I am having issues even understanding what is required of Exercise 3 of the Week 4 programming assignment, namely Exercise 3. It says:

“Set matrix P for a small number of pages n = 5. All of the elements on the main diagonal should be equal to zero, and the entries in each column must add to one. Here is an example of such a matrix for n= 4:”

I follow all this up to this point.

Then it says: :" Define vector X0 so the browsers starts navigation at page 4(X0 is a vector with a single entry equal to one, and all other entries equal to zero). Apply the transformation once: X1 - PX0 to find a vector of the probabilities that the browser is at each of five pages.

It then gives hints in the code, asking for a 5 x 5 matrix P and an array X0:

# Based on the example above for n=4 define matrix P for n=5,

# such that all elements on the main diagonal should be equal to 0,

# and the entries in each column must add to one.

However the hint was not helpful.

I have a couple of questions:

Firstly, why has a 4x4 matrix been given when in the question, a 5x5 matrix is required?

Secondly, are we meant to work out by hand each of the elements in P, the 5x5 matrix and also X0 the column vector?

I would appreciate detailed guidance on this exercise on the requirement is not very clear and I am extremely confused.

Thank you.