A search engine that finds thousands of pages
containing a word must decide which to list first. One
answer, which made a search engine famous, is to let the
pages vote. Each page spreads its vote over the pages it
links to, a vote counts for more when it comes from a
page that is itself important, and “important” is
whatever this circular description settles on. Written
out, the circle is an eigenvector equation for a
stochastic matrix. This section sets up that matrix,
shows why the raw web does not give a well-defined
ranking, repairs it with a single parameter, and uses
Perron’s theorem (Theorem 19.1.5) to
prove that the repaired matrix has exactly one ranking,
with every entry positive. We then prove how fast the
ranking can be computed, and work a small web
exactly.
Throughout, the field is , inequalities between
vectors and matrices are entrywise as in §01, and
stochastic means column-stochastic (Definition 9.11.1):
nonnegative entries, every column adding up to . Many accounts of
PageRank use rows instead; their matrices are the
transposes of ours. We write for the all-ones
vector and for the all-ones matrix.
The web as
a Markov chain
Number the pages . Page links
to page
if it contains a link to it; we ignore links from a page
to itself, and several links from to count as one. Let be the number of
pages that page
links to, its out-degree. A page with
is called
dangling: a document with no links out,
such as an image or a file.
Imagine a surfer who, on page , clicks one of its
links, each
with probability . If is the
probability vector of the surfer’s position after clicks, then, exactly
as in Chapter 9 §11, , where if links to and otherwise.
This hyperlink matrix is local to this
section; elsewhere in the book is a Hessian. The
long-run share of time the surfer spends on page is the candidate for
page ’s
importance. It captures the circular description: page
receives, from
each page linking
to it, the share of ’s own weight.
At a dangling page the surfer has nowhere to go, and
column of is zero. The standard
patch sends the surfer to a page chosen uniformly at
random.
Definition
19.8.1 (Link Matrix)
Let a web have pages , with , and out-degrees . Its
link matrix is the matrix whose column is:
- (a) if : the vector
with entry in
each position
such that page
links to page ,
and
elsewhere;
- (b) if (page is
dangling): the vector .
Each column is a probability vector: in case (a) it
has entries
equal to , and
in case (b)
entries equal to . So is stochastic. For
instance, the web on three pages in which page links to pages and , page links to page , and page links nowhere, has
A ranking should then be a steady state of (Definition 9.11.2): a
probability vector with .
When is
irreducible (Definition 19.2.3),
there is exactly one, with every entry positive, by Proposition 19.6.1
(c); part (a) of the same proposition gives for every
stochastic . The
real web is very far from irreducible, and the three
failures below are the typical ones.
Example
(Three ways a web can fail to rank)
For each web, describe what goes wrong with the
surfer’s chain.
- (a) Two pages; page
links to page
, and page is dangling, but we use
, without the
patch.
- (b) Four pages;
pages and link to each other, and
so do pages and
.
- (c) Two pages that
link to each other.
Solution.
(a) has a zero column, so
it is not stochastic, and . From any start
the surfer is gone after two clicks:
is not a probability vector, and has no steady state at
all, since forces and then . The patched has second column
and the steady state ,
since .
(b) is block diagonal with
two copies of the swap . Both and are steady states, and so
is every average of the two. The chain cannot say
whether page
matters more than page : the ranking is not
unique.
(c) is the swap. Its
steady state is unique, but from
the chain alternates and never settles. The
eigenvalue of
the swap has the same modulus as .
In (b) the matrix is reducible, and in (c) it is
irreducible but not primitive (Definition 19.5.1):
the powers of the swap are and the swap, and
neither is positive. Real webs have all three features,
on a vast scale.
The Google
matrix
The dangling patch of Definition 19.8.1
already repairs failure (a). One modification repairs
the remaining two at once. Let the surfer, at every
step, toss a biased coin: with probability follow a link as
before, and with probability get bored and
jump to a page chosen uniformly at random from all . The jump is called
teleportation, and the
damping factor; a value around is customary.
The Google matrix mixes following links with
jumping to a random page; its fixed probability vector
is the ranking.
Definition
19.8.2 (Google Matrix, PageRank Vector)
Let be the link matrix of a web with pages, and let
. The matrix is called the Google matrix
in the literature, with damping factor . A
PageRank vector of the web is a
probability vector 𝛑 with 𝛑𝛑. Page is ranked above page
when .
In words: column of is times column of , the link step, plus
times
the uniform vector , the jump. A
PageRank vector is a steady state of the surfer’s new
chain. The letter is local to this
section; elsewhere in the book is a Gram matrix. The
theorem below shows that there is exactly one, which
justifies calling it the PageRank
vector.
Two properties of do all the work.
- is
stochastic. Its entries are nonnegative, and
column adds up to
.
- is
positive. Every entry is at least , because and strictly.
Two degenerate values of are excluded, and
each shows why. With , , and the failures (b) and (c) of Example (Three ways a web can fail to rank)
come back. With , for every web, the PageRank vector
is , and
the links are ignored: every page ties. The damping
factor trades faithfulness to the links against the good
behavior of the chain, and we will see that the speed of
the computation is governed by alone.
For the three-page web above, with , with columns adding up to and every entry
positive.
A nonexample by minimal change.
Replace the uniform jump by a jump to page only: . It is still stochastic,
since each column of is . What fails is
positivity: in the web of Example (Three ways a web can fail to rank)
(b), has
zeros in rows and
of columns and , so Perron’s theorem no
longer applies. (Here the ranking is still unique, but
it gives pages
and weight zero,
since no surfer ever returns to them from pages and .) Exercise B3 shows
that any jump distribution with all entries positive
works as well as the uniform one.
Warning. PageRank is not a
count of incoming links. A link is worth the
rank of the page it comes from, divided by that page’s
out-degree. In the four-page example at the end of this
section, page has
more incoming links than any other page, yet page , with a single incoming
link, ranks above it, because that link comes from page
and is page ’s only link.
A unique
positive ranking
Perron’s theorem, applied to the positive matrix
, settles
existence, uniqueness, and positivity at once. It also
turns the eigenvector problem into a linear system.
Idea. Perron’s theorem hands us a
simple eigenvalue with a positive
eigenvector, so the only question is the value of ; the column sums
pin it at . For
(c), on probability vectors the rank-one part
is the constant vector , so
the eigenvector equation becomes linear with a
right-hand side.
Proof.
(a) By Theorem 16.3.3 (a), is the
largest column sum of , which is
since is stochastic; so
by
Theorem 16.4.1 (a). By Proposition 9.11.3
(c), is an
eigenvalue of .
Hence .
Since every entry of is at least , Perron’s theorem (Theorem 19.1.5)
applies: by its parts (a) and (b), is an
eigenvalue of algebraic multiplicity one, with an
eigenvector spanning .
(b) Put 𝛑, which is defined
because . It is a probability vector with positive
entries and 𝛑𝛑. If 𝛑 is another
probability vector with 𝛑𝛑,
then 𝛑 lies
in , so 𝛑𝛑 for
some , and
comparing entry sums gives . Hence 𝛑𝛑. In the
language of §01, 𝛑 is the Perron vector
of (Definition 19.1.2).
(c) If with ,
then , so is an
eigenvalue of ;
but as in (a). So is not an eigenvalue of
, and
is
invertible by Theorem 9.2.6. For a
probability vector , , so and 𝛑𝛑 is the equation 𝛑. So 𝛑 solves the system,
and by invertibility it is the only solution.
So the ranking exists, is unique, and gives every
page a positive score: no page is ignored, however
obscure. Part (c) is how one computes it for a small
web: solve an linear system, with no eigenvalue in sight. A
useful bonus is that the solution of (c) is
automatically a probability vector. Multiplying the
system on the left by , and using , 𝛑 so 𝛑 without being imposed.
Quick check. Two pages link to each
other, and . Write down , find 𝛑, and find the
eigenvalues of .
Solution. is the swap, so Then and .
So 𝛑, and the eigenvalues are and . The swap has
eigenvalues and
: the second one
has been multiplied by . The next theorem
says that this always happens.
The second
eigenvalue
The PageRank vector of a real web is computed by
iterating , since the web has billions of
pages and no one solves a system of that size exactly.
How fast the iterates settle depends on the eigenvalues
of other than
. For a general
positive matrix, Perron’s theorem says only that they
are strictly smaller than in modulus, with no
bound on how much smaller. For the Google matrix there
is an exact description.
Theorem
19.8.2 (The Eigenvalues of the Google
Matrix)
Let , let
be
stochastic, let , and let . Since is an eigenvalue of
(Proposition 9.11.3)
and splits
over (Theorem 6.5.1), it
factors as with . Then In particular, if , every
eigenvalue of
satisfies .
Idea. Both and have as a left
eigenvector for .
Change basis so that becomes the first
coordinate functional ; then both
matrices become block lower triangular with a in the corner. The
teleportation term only touches the first column
in the new basis, so the lower-right blocks are and for the
same . The eigenvalues of
other than the
in the corner are
those of ;
those of are
times
them.
Proof. Let , the matrix whose first row is
and whose other rows are zero, and let . Its first
row is and
its other rows are those of , so .
Since , , and therefore . So
is invertible with (Theorem 3.4.5).
Claim. Claim. If
satisfies , then the first row of is .
Proof. The first row is .
Since is
stochastic, , and the claim gives for some and .
For the teleportation term, using from the proof of the claim.
Its only nonzero column is the first, , whose first
entry is . So it equals
for some , and Similar matrices have the same characteristic
polynomial (Theorem 7.10.3), and
minus a block
lower triangular matrix is block lower triangular, so by
Theorem 7.8.4 Comparing the first with and canceling the
nonzero factor (in , a product of
nonzero polynomials is nonzero) gives . If , then where the second step takes the factor out of each of the
rows. If
, then
.
Either way the formula for follows.
For the last sentence, each is an eigenvalue of
, so by Theorem 16.4.1 (a) and Theorem 16.3.3 (a). The
eigenvalues of
are the roots of : the number and the , each of
modulus at most . If , none of
the
equals , so every
eigenvalue is some , and . This proves the theorem.
The theorem gives more than a bound. It shows again
that is a simple
eigenvalue of
when ,
without Perron’s theorem, and it says that the rest of
the spectrum of
is the rest of the spectrum of , shrunk by the factor
. The bound
is attained whenever itself has as a repeated
eigenvalue, as for the two separate webs of Example (Three ways a web can fail to rank)
(b) (Exercise C2), and whenever has as an eigenvalue, as
in the Quick check. So for a web with two or more pieces
that no link leaves, as large webs typically have, the
second eigenvalue of has modulus exactly
, and no
better bound is possible.
How fast
the iteration converges
The eigenvalue bound predicts that iterates approach
𝛑 at a rate like
. For this
particular matrix the prediction can be proved directly,
with an explicit constant, by measuring errors in the
-norm of Chapter
16.
Idea. The error 𝛜𝛑 is a difference of probability vectors, so
its entries add up to , and the teleportation
term kills it. What remains is , and a
stochastic matrix never increases the -norm.
Proof. Each is a
probability vector by Proposition 9.11.3
(a), since is
stochastic. Put 𝛜𝛑, so 𝛜. Since 𝛑𝛑, 𝛜𝛑𝛜𝛜𝛜𝛜 By Theorem 16.3.3 (a), , the
largest column sum of the nonnegative matrix , so 𝛜𝛜 (Definition 16.3.2). Hence
𝛜𝛜, and by induction on
, 𝛜𝛜. Finally 𝛜𝛑, as
both are probability vectors. Each entry of 𝛜 has modulus
at most 𝛜, and because
, one of the calculus facts recorded in
Chapter 9 §11. A sequence whose terms are at most in absolute
value, with , tends to straight from the
definition of a limit: once , so is every such term. So 𝛑
entrywise.
The bound does not depend on the web at all: not on
the number of pages, not on how they link. With , fifty
steps guarantee 𝛑, and ninety
guarantee an error below , for a web of any
size. Each step is cheap, because is never formed: by
the proof of Theorem 19.8.1 (c),
for a
probability vector , and needs one
operation per link, plus one shared correction for the
dangling pages.
In the language of §05, is primitive (Definition 19.5.1),
since is
already positive, and Theorem 19.5.2 gives
𝛑,
with right Perron vector 𝛑 and left Perron
vector ,
normalized by 𝛑. The proposition adds the rate, and the rate
is what makes the method practical. The iteration is the power
method; Chapter 24 studies it for general
matrices, where the rate is governed by the ratio of the
two largest eigenvalue moduli, here at most .
A small
web, exactly
Solution. The link matrix.
Pages and have out-degree , page has out-degree , and page is dangling, so by Definition 19.8.1
since and . Every column of adds up to , and every entry is
positive.
The linear system. By Theorem 19.8.1 (c),
𝛑. Multiplying by gives 𝛑, that is, Express everything through . The fourth
equation gives . The second then gives , so . The first gives , so . Substituting into the third,
so and .
Back-substituting, 𝛑 Check. The entries add up to , as they
must. With , the first row of gives , and the other rows
give , and . So 𝛑𝛑.
The ranking. Page first (), then page
(), page
() and page
(). Page
is linked from
pages and , while the dangling
page feeds every
page equally; page is linked only from
page . Yet page
wins, because
page passes its
whole weight to it, while pages , and split theirs.
The second eigenvalue. Expanding the
determinant gives and the second cubic is times the first
evaluated at , as Theorem 19.8.2
predicts: , , . The cubic for has one real root near
and two
complex ones of modulus about . So , comfortably
below :
for this web the iteration converges faster than Proposition 19.8.3
guarantees.
Exercises
A. Check your
understanding
Solution.
(a) For a web
with link matrix
(Definition 19.8.1) and
, . A PageRank vector is a
probability vector 𝛑 with 𝛑𝛑.
(b) has nonnegative
entries and has
every entry equal to , since . Perron’s theorem then gives: is an eigenvalue
of algebraic multiplicity one; it has an eigenvector
with all entries positive; every other eigenvalue has
modulus strictly less than . Here .
(c) False. With
, , and for two
pairs of pages linking only to each other, Example (Three ways a web can fail to rank)
(b) gives two different steady states.
(d) False. In Example (Four pages, one dangling),
page has the most
incoming links, but page ranks first.
(e) Every
eigenvalue has . The bound cannot be improved for every
web: when the link matrix has or a repeated among its eigenvalues,
has an
eigenvalue of modulus exactly (the Quick check,
and Exercise C2).
(f) True, by Proposition 19.8.3
with .
B. Practice
Solution. With as in the text, 𝛑. Multiplying by gives 𝛑:
The first gives . The
second becomes , so .
The third becomes , so
and . Then
and . So 𝛑 whose entries add up to . Check against the
original system: , ,
. Hence page ranks first, then page
, then page .
Solution.
(a) Column of is , with
read as
: expanding along the first row.
(b) with , so , , and
the eigenvalues of are . Their sum is . Directly, ,
which agrees (Theorem 9.3.3).
(c) and , so , and 𝛑 by the uniqueness in Theorem 19.8.1. The
eigenvalues and have
modulus , so the bound holds with equality.
Solution.
(a) The entries
of
are . Column
adds up to . So is
stochastic and positive. The proof of Theorem 19.8.1 (a) and
(b) used only these two facts, so it applies word for
word: is an eigenvalue of algebraic multiplicity
one with a positive eigenvector, and its normalization
𝛑 is the only
probability vector fixed by .
(b) For a
probability vector , , so
𝛑𝛑 says 𝛑. The
matrix is invertible, as in the proof of Theorem 19.8.1 (c), so
the solution is unique.
(c) is the swap, and the
system is , . The first gives , and the second becomes , so and . So 𝛑: the preferred page gains, but less than
its jump weight , because half
the time the surfer follows the link to page .
C. Going deeper
Solution.
(a) By Theorem 16.3.3 (a), , the largest
column sum of . By Theorem 16.5.1 (a), is
invertible and . By
Theorem 19.8.1 (c),
𝛑, which is the stated
series.
(b) Every term
has
nonnegative entries, and the term is . So each entry of the
sum is at least ,
since a limit of partial sums that are all at least
is at least , and .
(c) From 𝛑𝛑 and the
proof of Theorem 19.8.1 (c),
𝛑𝛑. Row of is zero: only if page
links to page
or page is dangling, and
neither happens. So 𝛑 and , the smallest possible value
by (b).
Solution.
(a) Put . Both are probability vectors, so
and . Hence , and is an eigenvalue
of with
eigenvector .
(b) is block diagonal with
two blocks , each with
characteristic polynomial , so by Theorem 7.8.4. By Theorem 19.8.2, with
and , the
eigenvalues of
are . The eigenvalue is the one found
in (a), with , and eigenvector ; indeed and
, so .