TL;DR
A web search engine must decide which of millions of matching pages to show first. PageRank answers this with the links between pages. A page is important when important pages link to it. The score is the long-run share of time a random surfer would spend on each page, where the surfer mostly follows a link and sometimes jumps to a random page.
The whole calculation is repeated multiplication by a matrix of link probabilities, until the scores stop changing.
Where you'll see it: in the ranking step of web search, in citation-style ranking of papers and accounts, and as a standard example of a graph computed with linear algebra.
Intuition
A surfer who clicks
Imagine someone browsing the web (a Random Walk on the Graph of pages and links) by clicking a random link on each page. Each click moves them to another page. If you watch for a long time and record how often they are on each page, the pages they land on most often are the ones many paths lead to. A page with many links pointing at it, especially from pages that are themselves often visited, collects more visits.
Real surfers do not only click. Sometimes they type a new address. PageRank models this with a small chance, often 15 percent, of jumping to a uniformly random page. This jump has two jobs. It stops the surfer getting trapped in a small loop of pages, and it gives every page a little score even if nothing links to it.
Why links rather than words
Early search engines mostly counted how often the query words appeared on a page. That is easy to game by repeating words. Links are harder to fake at scale, because each link is a choice made by someone else who put it there. PageRank uses that signal: the endorsement of a page depends on how much rank the endorsing page itself has.
The recursive definition is the key difficulty. A page's rank depends on the ranks of the pages that link to it, which depend on their own links. The answer is a fixed point of that recursion, and it is found by repeated multiplication.
The math
Let there be pages. Build the link matrix with entries
where is the number of links leaving page . Each column of sums to 1, because a surfer on page must pick one of its links. Such a matrix is called column-stochastic. The entries are the transition probabilities of a Markov chain on pages.
Add the jump. With damping factor (usually ), the surfer follows a link with probability and jumps to a uniformly random page with probability . The random-surfer matrix is
where is the vector of all ones. The PageRank vector is the long-run distribution of the surfer, which is a stationary distribution: one that stays unchanged after another step of the chain. It satisfies
So is an eigenvector of with eigenvalue 1, scaled to sum to 1 (see eigenvectors). The jump term makes the chain irreducible (from any page the surfer can eventually reach any other), so this eigenvector is unique and every page has a positive score.
Power iteration
Solving directly is expensive for billions of pages. Instead, start from any distribution, such as the uniform vector , and repeat
Each step is one sparse matrix-vector product, and it keeps the total equal to 1 because the columns of sum to 1. The iterates converge to : each step multiplies the remaining error by at most , so with about 90 steps shrink it by a factor of a million. A matrix that is mostly zeros, as the link matrix is, is called sparse, and a sparse product costs only one pass over the links.
Dangling pages
A page with no outgoing links breaks the column sums. The standard fix is to treat such a page as if it linked to every page, so its rank is spread uniformly. This keeps the matrix stochastic.
Worked examples
Use three pages. Page A links to B and C. Page B links to A. Page C links to A.
Set , so the surfer always follows a link. Here and .
- Page B gets all its rank from A, which splits its rank between B and C. So .
- Page C gets the same: .
- Page A gets all of B's rank and all of C's rank: .
- Check: . The equations agree.
- Use the total: , so . Then .
Interpretation: the surfer spends half of its time on A, because both other pages send it there. The pages B and C each get a quarter. Without the jump, the surfer could be trapped in a loop, which is why the jump is added for real use.
Use the same three pages with and . The jump term is for each page.
Start with .
- Update A: A receives .
- Update B: B receives .
- Update C: by the same steps, . The total is , which equals 1 up to rounding.
- Repeat once. A becomes , and B becomes , and likewise C.
- Limit: setting and , the fixed point satisfies . Solving gives and .
Interpretation: A is now the most important page even though it has only two links, because both other pages depend on it. The first step gave A too much weight, and the iterates move toward the fixed point. The check confirms the solution.
Suppose the index contains pages, and a page has rank and 10 outgoing links.
- Each linked page receives from .
- Every page also receives the jump share , which is tiny here.
- So a link from adds about to the target. The jump is nearly 60 times smaller, so the endorsement from linked pages dominates for well-linked pages.
Interpretation: a link is worth more when the linking page is important and has few other links. A page with many outgoing links dilutes its endorsement across all of them. This is why a link from a strong, focused page counts for more than a link from a directory of thousands.
Tradeoffs and failure modes
PageRank is one signal among many, and it has known weaknesses.
| Situation | What goes wrong | Better choice |
|---|---|---|
| Spammers create many pages linking to a target | The target's rank rises even though the links are artificial | Combine with content quality and link-spam detection |
| Old, well-linked pages dominate | New pages struggle to rise regardless of quality | Freshness signals, or decay terms |
| Results must match a user's interests | One global ranking ignores the query and the user | Personalised PageRank, which jumps to pages the user likes |
| The graph is huge and changes daily | Recomputing from scratch is expensive | Incremental updates, or periodic batch recomputation |
| Pages with no outgoing links | Rank leaks away if not handled | Dangling-page correction (uniform spreading) |
A common mistake is treating PageRank as a measure of quality. It measures link structure. A page can have high rank because a well-connected community links to it, even if it is wrong. Another mistake is changing the damping factor without thinking: a value near 1 makes the scores depend very slowly on the jump, and convergence slows.
The power iteration itself is a standard method for dominant eigenvectors (see Matrix Multiplication for the basic product it uses). Its cost is one pass over the links per iteration, which is why it scales.
History
Sergey Brin and Larry Page developed the idea at Stanford in the late 1990s. Their 1998 paper (The Anatomy of a Large-Scale Hypertextual Web Search Engine) describing a large-scale web search engine introduced PageRank as a way to order results by the link structure of the web, which was then growing very fast. The idea was built on earlier work on citation analysis in academic papers, where a paper is important when important papers cite it.
PageRank helped the search engine rank results well when most competitors relied mainly on word matching. It spread into a general technique for ranking any graph, and it is still taught as the standard example of applying linear algebra and Markov chains to a real system.
Recap
- PageRank is the stationary distribution of a random surfer on the web graph, with a jump term for the trapped-surfer problem.
- It is found by power iteration: repeated multiplication by the damped link matrix, until the scores stop changing.
- A page gains rank from important pages that link to it, and a link counts for less when its source has many other links.
This is the basis for the ranking step in web crawling and indexing, where the crawler's discovered link graph is the input.
Check yourself
QuestionRecall: what does the damping factor represent in the random surfer model?Show answer
It is the probability that the surfer follows a link on the current page. With probability , the surfer jumps to a uniformly random page instead. The jump prevents the surfer from being trapped in a small set of pages and gives every page a positive score.
QuestionComputation: with and , what is the jump term , and what does it add to each page's score on one update?Show answer
The jump term is . Each page receives 0.125 from the jump on every update, in addition to the link contributions weighted by .
QuestionWhy: explain why PageRank is defined as an eigenvector rather than as a count of incoming links.Show answer
A count of incoming links treats every link as equal, so a link from a minor page counts the same as one from an important page. The eigenvector definition makes each page's score depend on the scores of the pages linking to it, and each source shares its rank across its outgoing links. This recursion is exactly what the eigenvector equation captures.
QuestionApplied: a page with rank 0.02 has 4 outgoing links and . How much rank does each linked page receive from it?Show answer
Each linked page receives from this page. Each of the four linked pages receives this same amount, so the page passes its rank on in equal shares.