Issue understanding Week 4 Programming Assignment Exercise 3 - Application of Eigenvalues and Eigenvectors: Navigating Webpages

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.

1 Like

P in the question is an example. we should create similar array with 5 pages/columns. where all diagonals are zeros.

eg. first row could be [0,0.25,0.25,0.25,0.25]

then need to define the vector X0 (this is something i’m still trying to understand)

Thanks, I tried to construct 5x5 matrix so that all elements on main diagonal are 0 and the entries in each column added up to 1 and that worked for me.