Skip to content

Power iteration and ranking pages

Multiply and rescale until a vector settles on the dominant eigenvector, predict how fast it gets there, and rank a small web of pages the same way.

Helps to know firstMarkov matrices

Helps to know first
This topic

First, the picture

Four pages link to each other. Watch importance flow along the links until every page’s share stops changing.

Ranking the web

Importance flows along links until the shares stop changing.

Four pages, each starting with a quarter of the importance. Nobody links to page 4.

step
0
shares
(0.25, 0.25, 0.25, 0.25)
0.85
0.00 / 13.40 s
Describe this picture

Four pages drawn as boxes at the corners of a square, each with a bar for its share of importance and a dotted line at its final share, and arrows for the links, thicker for more importance flowing: page 1 links to pages 2 and 3, page 2 to page 3, page 3 to pages 1 and 2, and page 4 to pages 1 and 3. Nobody links to page 4. Over about 13 s the bars start equal at 0.25 each, and at every step each page splits 85 % of its bar evenly among its links, while the other 15 % is shared out to all four pages. The bars settle on (0.2311, 0.3134, 0.4180, 0.0375)(0.2311,\ 0.3134,\ 0.4180,\ 0.0375): page 3 first, page 4 last. Readouts give the step and the shares. One control after the clip: a slider for the damping from 0.5 to 0.95; at 0.5 the bars flatten to (0.245, 0.275, 0.355, 0.125)(0.245,\ 0.275,\ 0.355,\ 0.125).

One way to rank pages imagines that importance flows along links. A page passes its importance on, split evenly among the pages it links to, and a page is important when important pages link to it. Write that flow as a matrix with the convention of Markov matrices: column qq says where page qq sends its share.

M=[000.50.50.500.500.5100.50000].\mathbf{M}=\begin{bmatrix}0&0&0.5&0.5\\0.5&0&0.5&0\\0.5&1&0&0.5\\0&0&0&0\end{bmatrix}.

Page 1 links to pages 2 and 3, so column 1 has 0.5 in rows 2 and 3. Every column adds up to 1. The ranking is a steady state, Ms=s\mathbf{M}\mathbf{s}=\mathbf{s}: here s=(2,3,4,0)/9\mathbf{s}=(2,3,4,0)/9. Page 3 wins, since three pages link to it. Page 4 gets nothing, since nobody does.

Multiply and rescale

For four pages the steady state can be solved by elimination. For billions of pages it can’t. What still works is the simplest thing possible: start anywhere, and multiply by the matrix again and again.

Diagonalisation and matrix powers explains why this finds an eigenvector. Write the start as a mix of eigenvectors, u0=c1v1+c2v2+⋯\mathbf{u}_0=c_1\mathbf{v}_1+c_2\mathbf{v}_2+\cdots. After kk steps

Aku0=c1λ1kv1+c2λ2kv2+⋯ .\mathbf{A}^k\mathbf{u}_0=c_1\lambda_1^k\mathbf{v}_1+c_2\lambda_2^k\mathbf{v}_2+\cdots.

If λ1\lambda_1 is larger in size than every other eigenvalue, and c1≠0c_1\neq0, its part outgrows the rest, and the vector turns towards v1\mathbf{v}_1. The length may grow or shrink without limit, so rescale after every step:

uk+1=Auk∥Auk∥.\mathbf{u}_{k+1}=\frac{\mathbf{A}\mathbf{u}_k}{\lVert\mathbf{A}\mathbf{u}_k\rVert}.

This is power iteration. Once uk\mathbf{u}_k has settled, the eigenvalue follows from λ1≈uk⋅Auk\lambda_1\approx\mathbf{u}_k\cdot\mathbf{A}\mathbf{u}_k, for a unit uk\mathbf{u}_k. For a Markov matrix the largest eigenvalue is exactly 1, and rescaling to a total of 1 keeps the shares as shares.

How fast

The leftover part shrinks relative to the main one by ∣λ2/λ1∣\lvert\lambda_2/\lambda_1\rvert each step, where λ2\lambda_2 is the next largest in size.

Arrow turning in

Multiply by A = [1.5 1; 0.5 1], rescale to length 1, repeat.

The arrow u_{0} = (1, 0) and the eigen-line of A through (2, 1), at 26.57°.

step
0
arrow at
0°
gap to the line
26.57°
0.00 / 11.30 s
Describe this picture

The plane with the eigen-line of A=[1.510.51]\mathbf{A}=\begin{bmatrix}1.5&1\\0.5&1\end{bmatrix} through (2,1)(2,1), dashed, at 26.57° (0.4636 rad). A unit arrow starts at (1,0)(1,0). Step after step it is multiplied by A\mathbf{A} and rescaled to length 1, and it swings up towards the line, leaving faint copies behind. It turns to 18.43°, 24.44°, 26.03°, 26.43° and 26.53°. Readouts give the step, the arrow’s angle and its gap to the line: 26.57°, then 8.13°, 2.12°, 0.54°, 0.13° and 0.03°, about four times smaller each step. The clip runs for about 11 s. There is no control.

For the matrix of Eigenvectors, with eigenvalues 2 and 0.5, the factor is 0.5/2=0.250.5/2=0.25. Track the ratio qkq_k of the arrow’s second entry to its first. One step sends it to qk+1=(0.5+qk)/(1.5+qk)q_{k+1}=(0.5+q_k)/(1.5+q_k), and from (1,0)(1,0) it runs

0,13,511,2143,85171,… → 12.0,\quad\tfrac13,\quad\tfrac5{11},\quad\tfrac{21}{43},\quad\tfrac{85}{171},\quad\dots\ \to\ \tfrac12.

Its distance from 12\tfrac12 goes 12, 16, 122, 186, 1342\tfrac12,\ \tfrac16,\ \tfrac1{22},\ \tfrac1{86},\ \tfrac1{342}: about a quarter each time.

For the three-towns matrix of the Markov page, with eigenvalues 1, 0.6 and 0.5, the factor is 0.6, and after 10 steps 0.6100.6^{10}, about 0.006, of the starting error is left.

Damping

The bare link matrix has two problems. A page with no links in, like page 4, ends up with nothing, and a group of pages that only link to each other can trap all the importance or make it swing back and forth. The fix is damping: at every step a share dd of the importance follows the links, and the rest, 1−d1-d, is spread evenly over all nn pages. With the all-ones vector 1=(1,…,1)\mathbf{1}=(1,\dots,1):

Mdamped=d M+1−dn 11⊤.\mathbf{M}_\text{damped}=d\,\mathbf{M}+\frac{1-d}{n}\,\mathbf{1}\mathbf{1}^\top.

Every entry of this matrix is positive, so by the Markov page it has one steady state, reached from every start. With d=0.85d=0.85, from equal shares:

  • after 1 step: (0.25, 0.25, 0.4625, 0.0375)(0.25,\ 0.25,\ 0.4625,\ 0.0375);
  • after 2 steps: (0.25, 0.340, 0.372, 0.0375)(0.25,\ 0.340,\ 0.372,\ 0.0375);
  • after 3 steps: (0.212, 0.302, 0.449, 0.0375)(0.212,\ 0.302,\ 0.449,\ 0.0375);
  • settled: (0.231, 0.313, 0.418, 0.0375)(0.231,\ 0.313,\ 0.418,\ 0.0375).

Page 4 now keeps exactly the damping share, 0.15/4=0.03750.15/4=0.0375. Damping also guarantees the speed: any difference between two share vectors shrinks by at least the factor dd each step. That bound promises the error falls below 5×10−55\times10^{-5} within 61 steps; this small web gets there in 14, since the other eigenvalues of its damped matrix have size 0.425.

Where this leads · random walks

Markov chains, in the probability and statistics course, reads the same matrix as a walker who clicks a random link from each page, and with chance 1−d1-d jumps to a random page instead. The ranking is the share of time the walker spends on each page.

Worked example

1. The arrow. From (1,0)(1,0) under [1.510.51]\begin{bmatrix}1.5&1\\0.5&1\end{bmatrix} the ratio goes 0, 13, 511, 2143, …0,\ \tfrac13,\ \tfrac5{11},\ \tfrac{21}{43},\ \dots towards 12\tfrac12, the direction (2,1)(2,1), the gap shrinking by about 0.25 each step.

2. The web without damping. Ms=s\mathbf{M}\mathbf{s}=\mathbf{s} gives s=(2,3,4,0)/9\mathbf{s}=(2,3,4,0)/9. Check row 2: 12⋅29+12⋅49=39\tfrac12\cdot\tfrac29+\tfrac12\cdot\tfrac49=\tfrac39.

3. The web with damping. At d=0.85d=0.85: (0.231, 0.313, 0.418, 0.0375)(0.231,\ 0.313,\ 0.418,\ 0.0375). At d=0.5d=0.5: (0.245, 0.275, 0.355, 0.125)(0.245,\ 0.275,\ 0.355,\ 0.125), flatter, since more is shared out evenly.

4. Scale. A web of 10910^9 pages with about 10 links each has 101010^{10} links. One step costs about 101010^{10} multiplications, one per link, and 50 steps 5×10115\times10^{11}. A full 109×10910^9\times10^9 table would have 101810^{18} entries, which no computer could store.

Try these before you read the answers.

  • What sets the speed of power iteration? ∣λ2/λ1∣\lvert\lambda_2/\lambda_1\rvert.
  • Does [0110]\begin{bmatrix}0&1\\1&0\end{bmatrix} converge? No: its eigenvalues 1 and −1-1 tie in size, and the arrow flips back and forth.
  • As dd approaches 1, what happens to page 4’s share? It falls towards 0.

Where you’ll meet this

Ranking. Pages, scientific papers and accounts in a social network have all been ranked by a damped steady state of this kind.

Big eigenproblems. When a matrix is too big to handle whole, power iteration still finds its dominant eigenvector: the main vibration mode of a structure, or the top principal direction of huge data, as in Principal components.

Inside eigenvalue software. General eigenvalue programs run refined versions of the same iteration, shifted and applied to many vectors at once.

Reference card

QuantityFormulaNotes
Power iterationuk+1=Auk/∥Auk∥\mathbf{u}_{k+1}=\mathbf{A}\mathbf{u}_k/\lVert\mathbf{A}\mathbf{u}_k\rVertmultiply and rescale
Limitthe dominant eigenvector v1\mathbf{v}_1needs one eigenvalue largest in size
Speederror shrinks by ∣λ2/λ1∣\lvert\lambda_2/\lambda_1\rvert per step0.25 for eigenvalues 2 and 0.5
Eigenvalue estimateλ1≈uk⋅Auk\lambda_1\approx\mathbf{u}_k\cdot\mathbf{A}\mathbf{u}_kfor a unit uk\mathbf{u}_k
Link matrixM\mathbf{M}, column qq = where page qq sends its sharecolumns add to 1
DampeddM+1−dn11⊤d\mathbf{M}+\frac{1-d}{n}\mathbf{1}\mathbf{1}^\topevery page gets at least (1−d)/n(1-d)/n
Rankingthe steady state s\mathbf{s}shrinks errors by at least dd per step

Keep reading with a free account.

By creating an account you accept the terms of use.

Sign in

Already have an account? Use the service you signed up with.

Or keep reading: get new lessons by email

Are you 13 or over?

Accounts and email updates are for people aged 13 or over. We keep only your answer, never your date of birth.

End of the lesson

Where to go next.

Phasorium

Account

Sign inKeep your place on any device

Subjects

Site

Look