Search

Search papers and lessons

Power Iteration

Level 2 · 11 min read

Power iteration finds a matrix's dominant eigenvector by multiplying a starting vector by the matrix again and again and rescaling it each time.

On this page

  • Colour = topic mix
  • Linear algebra
  • Discrete math
  • ReadReady to readNot yet

TL;DR

A matrix that stretches space has one direction that gets stretched more than all the others. That direction is its dominant eigenvector. Power iteration finds it by a very simple loop: multiply a starting Vector by the matrix, divide the result by its length, and repeat. After enough rounds the vector points along the dominant direction, and the length you divided by tells you the stretch factor.

Builds on: Eigenvalues and Eigenvectors, Vector Norm · Leads to: PageRank

Where it's used

Ranking web pages. Google's early search engine ranked pages with PageRank. The score of every page is the eigenvector of a matrix with billions of rows, one per page, and that matrix is far too large to diagonalise. Power iteration needs only products of the matrix with a vector, which the link structure supplies directly. The 1998 and 1999 papers by Brin, Page and colleagues describe repeated multiplication of this kind.

Estimating the leading mode of data. In Principal Component Analysis the first component is the direction of greatest variance, which is the top eigenvector of the data's covariance matrix. For a very large dataset, a few power-iteration steps give that direction without computing all the eigenvectors.

Long-run behaviour of a random process. A Markov Chain with a transition matrix PP settles into a steady share of time spent in each state. That steady share is a row vector π\pi with πP=π\pi P = \pi, so it is an eigenvector of PP's transpose with eigenvalue 1. Multiplying a starting distribution by PP over and over is exactly power iteration, and it is how the chain's long-run mix is often computed in practice.

How it works

Take a tiny matrix and trace one run. Let

A=(2112),x0=(10).A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix}, \qquad \mathbf{x}_0 = \begin{pmatrix} 1 \\ 0 \end{pmatrix}.

  1. Start with any nonzero vector. Here x0=(1,0)\mathbf{x}_0 = (1, 0). Check: it has length 1.
  2. Multiply by the matrix. Ax0=(2⋅1+1⋅0,  1⋅1+2⋅0)=(2,1)A\mathbf{x}_0 = (2 \cdot 1 + 1 \cdot 0,\; 1 \cdot 1 + 2 \cdot 0) = (2, 1). The vector changed direction and got longer. Check the second entry: the second row is (1,2)(1, 2), so it is 1⋅1+2⋅0=11 \cdot 1 + 2 \cdot 0 = 1.
  3. Divide by the length. The length of (2,1)(2, 1) is 5≈2.236\sqrt{5} \approx 2.236. So x1=(0.894,0.447)\mathbf{x}_1 = (0.894, 0.447). Check: its length is 1 again. The division changes only the size, never the direction, so the direction is what we keep.
  4. Repeat the multiply and divide. Multiplying x1\mathbf{x}_1 by AA gives (2.236,1.789)(2.236, 1.789), with length 2.8642.864. Dividing gives x2=(0.781,0.625)\mathbf{x}_2 = (0.781, 0.625). Each round the direction moves a little closer to the answer.
  5. Stop when the direction stops moving. After a few more rounds the vector is (0.707,0.707)(0.707, 0.707) to three decimals, and the lengths before dividing settle near 33. Check: (1,1)(1, 1) times AA is (3,3)(3, 3), which is 3 times (1,1)(1, 1).
  6. Read off the answer. The direction is the dominant eigenvector (1,1)(1, 1), and the length 33 is its eigenvalue.

The plot below shows the length from step 4 onward. It climbs quickly toward the dashed line at 3.

0.511.522.533.544.522.53step klength
  • eigenvalue 3
  • length of A x_k
The length climbs toward the eigenvalue 3 as the direction settles.
flowchart LR
  S[start with x0] --> M[multiply by A]
  M --> N[divide by its length]
  N --> T{direction still changing?}
  T -- yes --> M
  T -- no --> R[direction is the dominant eigenvector, length is its eigenvalue]

The math

A vector x\mathbf{x} is written in the eigenvector basis as a sum. Here we assume that AA is n×nn \times n, that it has nn independent eigenvectors v1,…,vn\mathbf{v}_1, \ldots, \mathbf{v}_n with eigenvalues λ1,…,λn\lambda_1, \ldots, \lambda_n, and that the eigenvalue of largest absolute value is strictly larger than the rest: ∣λ1∣>∣λ2∣≥⋯≥∣λn∣|\lambda_1| \gt |\lambda_2| \ge \cdots \ge |\lambda_n|. This is the dominant eigenvalue, and v1\mathbf{v}_1 is the dominant eigenvector.

Step 1 in symbols: split the start vector

Write the starting vector as x0=c1v1+c2v2+⋯+cnvn\mathbf{x}_0 = c_1 \mathbf{v}_1 + c_2 \mathbf{v}_2 + \cdots + c_n \mathbf{v}_n. The coefficient c1c_1 must not be zero, or the start has no component along the dominant direction. A random start satisfies this with probability 1.

For the example, (1,0)=12(1,1)+12(1,−1)(1, 0) = \tfrac{1}{2}(1, 1) + \tfrac{1}{2}(1, -1), where (1,1)(1, 1) has eigenvalue 3 and (1,−1)(1, -1) has eigenvalue 1.

Step 2 in symbols: multiply k times

Since Avi=λiviA \mathbf{v}_i = \lambda_i \mathbf{v}_i, applying AA a total of kk times scales each piece by its own eigenvalue to the kk-th power:

Akx0=c1λ1kv1+c2λ2kv2+⋯+cnλnkvn.A^k \mathbf{x}_0 = c_1 \lambda_1^k \mathbf{v}_1 + c_2 \lambda_2^k \mathbf{v}_2 + \cdots + c_n \lambda_n^k \mathbf{v}_n.

In the example, Akx0=123k(1,1)+121k(1,−1)A^k \mathbf{x}_0 = \tfrac{1}{2} 3^k (1, 1) + \tfrac{1}{2} 1^k (1, -1). The first term grows three times faster each round.

Step 3 in symbols: divide out the growth

Factor out λ1k\lambda_1^k:

Akx0λ1k=c1v1+∑i≥2ci(λiλ1)kvi.\frac{A^k \mathbf{x}_0}{\lambda_1^k} = c_1 \mathbf{v}_1 + \sum_{i \ge 2} c_i \left(\frac{\lambda_i}{\lambda_1}\right)^k \mathbf{v}_i.

Because ∣λi/λ1∣<1|\lambda_i / \lambda_1| \lt 1 for every i≥2i \ge 2, each power (λi/λ1)k(\lambda_i/\lambda_1)^k shrinks to zero as kk grows. What is left is c1v1c_1 \mathbf{v}_1, which points along the dominant eigenvector. This is why the loop works: the other directions fade relative to the dominant one.

The normalised iteration is xk+1=Axk/∥Axk∥\mathbf{x}_{k+1} = A \mathbf{x}_k / \lVert A \mathbf{x}_k \rVert. Dividing by the length at each round keeps the numbers from overflowing; it does not change the direction, so the limit is the same.

Step 4 in symbols: estimate the eigenvalue

Once xk\mathbf{x}_k is close to v1\mathbf{v}_1 with length 1, the length ∥Axk∥\lVert A \mathbf{x}_k \rVert is close to ∣λ1∣|\lambda_1|. Here ∥Axk∥\lVert A \mathbf{x}_k \rVert is 2.236,2.864,2.984,2.9982.236, 2.864, 2.984, 2.998 over four rounds, converging to 33.

The ratio of the gaps decides the speed. The error after kk rounds shrinks roughly like (∣λ2∣/∣λ1∣)k(|\lambda_2| / |\lambda_1|)^k. With ratio 1/31/3 the error falls by a factor of about three each round. If the two eigenvalues are nearly equal in size, convergence is very slow.

Worked examples

Example
1. A diagonal matrix (tiny, by hand)

Let A=(2001)A = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix} and x0=(1,1)\mathbf{x}_0 = (1, 1). Skip the division so the growth is visible.

  1. Multiply: Ax0=(2⋅1,1⋅1)=(2,1)A\mathbf{x}_0 = (2 \cdot 1, 1 \cdot 1) = (2, 1). The first entry doubled and the second stayed the same.
  2. Multiply again: A2x0=(4,1)A^2 \mathbf{x}_0 = (4, 1).
  3. Multiply once more: A3x0=(8,1)A^3 \mathbf{x}_0 = (8, 1).
  4. Read the pattern: the first entry is 2k2^k and the second is always 1. The direction (8,1)(8, 1) is already close to (1,0)(1, 0).
  5. Interpretation: the dominant eigenvector is (1,0)(1, 0) with eigenvalue 2, and the iteration found it because the first coordinate grows fastest.
Example
2. The standard case (the matrix from How it works)

Use A=(2112)A = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix} and start from x0=(1,0)\mathbf{x}_0 = (1, 0), with the division at each step.

  1. Round 1: Ax0=(2,1)A\mathbf{x}_0 = (2, 1), length 5=2.236\sqrt{5} = 2.236. So x1=(0.894,0.447)\mathbf{x}_1 = (0.894, 0.447).
  2. Round 2: Ax1=(2.236,1.789)A\mathbf{x}_1 = (2.236, 1.789), length 8.2=2.864\sqrt{8.2} = 2.864. So x2=(0.781,0.625)\mathbf{x}_2 = (0.781, 0.625).
  3. Round 3: Ax2=(2.187,2.030)A\mathbf{x}_2 = (2.187, 2.030), length 2.9842.984. So x3=(0.733,0.680)\mathbf{x}_3 = (0.733, 0.680).
  4. Round 4: the length is 2.9982.998, and the direction is (0.707,0.707)(0.707, 0.707) to three decimals.
  5. Interpretation: the lengths 2.236,2.864,2.984,2.9982.236, 2.864, 2.984, 2.998 approach 33, the dominant eigenvalue, and the direction approaches (1,1)/2(1, 1)/\sqrt{2}, its eigenvector. The gap to 3 shrinks by roughly a factor of nine each round (0.136, then 0.016, then 0.002), faster than the direction's error, which shrinks by about three, as Step 4 predicted.
Example
3. A realistic case: ranking three pages

Three pages link as follows. Page A links to B and to C. Page B links to C. Page C links to A. Think of a surfer who, on each page, picks one outgoing link at random. The chance of being on each page after one step is given by the matrix

M=(00112001210),M = \begin{pmatrix} 0 & 0 & 1 \\ \tfrac{1}{2} & 0 & 0 \\ \tfrac{1}{2} & 1 & 0 \end{pmatrix},

acting on the vector of probabilities (A,B,C)(\text{A}, \text{B}, \text{C}). Start with equal chances v0=(1/3,1/3,1/3)v_0 = (1/3, 1/3, 1/3).

  1. Round 1: A gets all of C's chance, so A=1/3\text{A} = 1/3. B gets half of A's chance, so B=1/6≈0.1667\text{B} = 1/6 \approx 0.1667. C gets half of A plus all of B: 1/6+1/3=0.51/6 + 1/3 = 0.5. So v1=(0.333,0.167,0.500)v_1 = (0.333, 0.167, 0.500).
  2. Round 2: v2=(0.500,0.167,0.333)v_2 = (0.500, 0.167, 0.333).
  3. Round 3: v3=(0.333,0.250,0.417)v_3 = (0.333, 0.250, 0.417).
  4. Round 4: v4=(0.417,0.167,0.417)v_4 = (0.417, 0.167, 0.417).
  5. Round 5: v5=(0.417,0.208,0.375)v_5 = (0.417, 0.208, 0.375).
  6. Round 6: v6=(0.375,0.208,0.417)v_6 = (0.375, 0.208, 0.417).
  7. Interpretation: the vector settles toward (0.4,0.2,0.4)(0.4, 0.2, 0.4). This is the eigenvector of MM with eigenvalue 1, and it says the surfer spends 40 percent of the time on A, 20 percent on B and 40 percent on C in the long run. PageRank does the same kind of calculation on the web, with a small extra step that makes sure the process always settles.

Try it: from v6=(0.375,0.208,0.417)v_6 = (0.375, 0.208, 0.417), compute v7v_7.

Answer: v7=(0.417,0.188,0.396)v_7 = (0.417, 0.188, 0.396). Check: the first entry is C's old value 0.4170.417; the second is half of A's 0.3750.375, which is 0.18750.1875; the third is half of A's plus B's, 0.1875+0.2083=0.3960.1875 + 0.2083 = 0.396.

Common mistakes and tradeoffs

It is tempting to think the iteration finds all the eigenvectors. In fact it finds only the dominant one, because the other components fade away. To get the second eigenvector you must remove the first from the vectors (deflation) or use a different method.

It is tempting to think the start vector must be chosen carefully. In fact almost any random start works, because only the dominant coefficient c1c_1 has to be nonzero. The only real failure is a start that lies exactly in the subspace of the other eigenvectors, which a random start almost never does.

It is tempting to think that a larger matrix needs more rounds. In fact the speed depends on the ratio ∣λ2∣/∣λ1∣|\lambda_2| / |\lambda_1|, not on the size nn. A matrix with a clear gap between its top two eigenvalues converges in a few dozen rounds even when it has millions of rows.

It is tempting to think the method always converges. In fact it can fail when two eigenvalues have equal absolute value, for example +3+3 and −3-3, because the two terms then do not fade relative to each other and the direction keeps flipping. A matrix that rotates vectors can also fail for the same reason. For a cycle in a Markov chain, a small change such as adding a tiny chance to jump anywhere restores convergence.

Use power iteration when the matrix is very large, sparse, or available only through products with vectors, and when only the top eigenvector matters. Do not use it when you need all eigenvalues or when the top two eigenvalues are close in size. For a rectangular matrix, the singular value decomposition does the same job for the top direction. For small dense matrices, a full eigenvalue decomposition is the right tool.

History

The method is old: a 1929 paper by Richard von Mises and Hilda Pollaczek-Geiringer describes the iteration, and it was used for decades before computers made it common. Its strength is that it needs only matrix-vector products, so it suits machines with little memory.

It became famous in the late 1990s. Sergey Brin and Larry Page used the same idea to rank web pages, treating the link structure as a matrix and computing its dominant eigenvector by repeated multiplication. The method caught on because a single loop scales to a matrix with billions of rows, where computing every eigenvalue is impossible.

Recap

  • A matrix stretches most directions and one direction most of all: the dominant eigenvector.
  • Repeatedly multiplying any generic start vector by the matrix and dividing by its length pulls the vector toward that direction.
  • The reason is that each eigenvalue's contribution grows as its eigenvalue to the power kk, so the largest one wins.
  • The length after the division estimates the dominant eigenvalue, and the speed depends on the gap between the top two.
  • Next, read PageRank for the concept of ranking pages with this idea, then the PageRank paper for how it was applied to the web.

Check yourself

QuestionWhat is the dominant eigenvector of a matrix, in words?Show answer
The eigenvector whose eigenvalue has the largest absolute value. Repeated multiplication by the matrix stretches it more than any other direction.
QuestionFor A=(2001)A = \begin{pmatrix} 2 & 0 \\ 0 & 1 \end{pmatrix} and x0=(1,1)\mathbf{x}_0 = (1, 1), what is A4x0A^4 \mathbf{x}_0?Show answer
A4x0=(16,1)A^4 \mathbf{x}_0 = (16, 1). Each round doubles the first entry and leaves the second as 1, so after four rounds the first entry is 24=162^4 = 16.
QuestionWhy does power iteration converge to the dominant eigenvector, and not to another one?Show answer
Each eigenvector's coefficient is multiplied by its eigenvalue to the power kk. Dividing by λ1k\lambda_1^k leaves the dominant term unchanged while the others shrink to zero, because ∣λi/λ1∣<1|\lambda_i / \lambda_1| \lt 1 for every other eigenvalue.
QuestionA matrix has eigenvalues 4 and 2. Roughly how much smaller does the error get after each round of power iteration?Show answer
The error shrinks roughly by the factor ∣λ2∣/∣λ1∣=2/4=1/2|\lambda_2| / |\lambda_1| = 2/4 = 1/2 each round, so it halves per round.

Sources