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

**URL:** <https://community.deeplearning.ai/t/issue-understanding-week-4-programming-assignment-exercise-3-application-of-eigenvalues-and-eigenvectors-navigating-webpages/299724>\
**Category:** Linear Algebra for Machine Learning and Data Sc...\
**Tags:** week-module-4\
**Created:** [March 30, 2023, 2:28pm UTC](https://community.deeplearning.ai/t/issue-understanding-week-4-programming-assignment-exercise-3-application-of-eigenvalues-and-eigenvectors-navigating-webpages/299724 "2023-03-30T14:28:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yauhooi1](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yauhooi1](https://community.deeplearning.ai/u/yauhooi1)\
**Post date:** [March 30, 2023, 2:28pm UTC](https://community.deeplearning.ai/t/issue-understanding-week-4-programming-assignment-exercise-3-application-of-eigenvalues-and-eigenvectors-navigating-webpages/299724/1 "2023-03-30T14:28:37Z")

</div>

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.

 ![image](https://global.discourse-cdn.com/dlai/original/3X/4/c/4cc02e0eb7fd61f0bba3f69ed13c3019a5ebfc15.png)

---

<div class="post-metadata">

**Author:** ![RAVINDRAKK](https://avatars.discourse-cdn.com/v4/letter/r/cdc98d/32.png) [@RAVINDRAKK](https://community.deeplearning.ai/u/RAVINDRAKK)\
**Post date:** [April 1, 2023, 11:04am UTC](https://community.deeplearning.ai/t/issue-understanding-week-4-programming-assignment-exercise-3-application-of-eigenvalues-and-eigenvectors-navigating-webpages/299724/2 "2023-04-01T11:04:19Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![yauhooi1](https://avatars.discourse-cdn.com/v4/letter/y/46a35a/32.png) [@yauhooi1](https://community.deeplearning.ai/u/yauhooi1)\
**Post date:** [April 6, 2023, 11:49am UTC](https://community.deeplearning.ai/t/issue-understanding-week-4-programming-assignment-exercise-3-application-of-eigenvalues-and-eigenvectors-navigating-webpages/299724/3 "2023-04-06T11:49:01Z")

</div>

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.
