A search engine wants to rank web pages by importance, where a page is important if important pages link to it. That sounds circular — and an eigenvector is exactly what resolves it.
Picture a surfer clicking around. At every step they:
If is the probability the surfer is on page , one step produces the new scores
where the first sum runs over the pages that link to page , and is the number of links on page .
That update is a matrix–vector product for one fixed matrix . The ranking is the score vector that a further step leaves unchanged, : an eigenvector of with eigenvalue . Every other direction shrinks each time is applied, so you can find it by power iteration — start from equal scores and apply the update again and again.
Task: write pagerank(links, d).
links[i] is the list of pages that page i links to. Pages are numbered 0 to n - 1; no page links to itself or lists the same target twice.