Power method

← Numerical Methods

Source inspiration: (Mathew 2000-2019).

Description

The power method finds the dominant eigenvalue of a square matrix \(\mathbf{A}\), the eigenvalue \(\lambda_1\) of largest magnitude, together with an eigenvector \(\mathbf{V}_1\) for it. It needs nothing but repeated matrix–vector products: start from a vector \(\mathbf{X}_0\), multiply by \(\mathbf{A}\), and rescale the product so that its coordinate of largest magnitude equals \(1\). When \(|\lambda_1|\) is strictly larger than every other eigenvalue magnitude and \(\mathbf{X}_0\) has a component along \(\mathbf{V}_1\), the scale factor converges to \(\lambda_1\) and the rescaled vectors converge to \(\mathbf{V}_1\):

\[ \mathbf{Y}_k = \mathbf{A}\mathbf{X}_k, \qquad c_{k+1} = \text{the coordinate of } \mathbf{Y}_k \text{ of largest magnitude}, \qquad \mathbf{X}_{k+1} = \frac{1}{c_{k+1}}\,\mathbf{Y}_k . \]

Each multiplication by \(\mathbf{A}\) stretches the component of the vector along \(\mathbf{V}_1\) by \(|\lambda_1|\) and every other component by less, so the other components fade, at a rate set by the ratio \(|\lambda_2/\lambda_1|\) of the two largest eigenvalue magnitudes. The shifted-inverse power method applies the same iteration to \((\mathbf{A} - \alpha\mathbf{I})^{-1}\), which turns the eigenvalue of \(\mathbf{A}\) closest to a chosen shift \(\alpha\) into the dominant one, so that any eigenvalue can be found, and found quickly, once a good approximation \(\alpha\) to it is known. Mathews’ module works two examples of the power method (a \(3\times 3\) and a \(6\times 6\) matrix), one of the shifted-inverse method, and two Markov chains, whose limiting distribution is the dominant eigenvector of the transition matrix. Every number below has been recomputed, most of them in exact rational arithmetic.

Animations

Each animation below follows one of Mathews’ worked examples, one iteration per frame. A panel with a logarithmic axis shows how fast the errors shrink: an error that is multiplied by a fixed ratio \(r\) at every step falls on a straight line there, and in Cases 1, 3 and 4 grey dashed lines show the slopes that the eigenvalue ratios predict. The iterations run in exact rational arithmetic, as in the tables below, so every error is computed exactly before it is rounded for display.

All four animations are new. Mathews’ Power Method module has no animation, and the archive of his animations has none for eigenvalue methods. Every example of the module appears in one of them, but the hand-worked first steps, the Aitken acceleration of Example 1, and the checks of the eigenpairs (among them Mathews’ comparisons with Mathematica’s Eigensystem) are not animated.

Julia source scripts that generated these animations are linked under each case.

Case 1 — The power method on the \(3 \times 3\) matrix of Example 1, \(\mathbf{X}_0 = (1, 1, 1)\), \(\varepsilon = 10^{-6}\), \(22\) iterations

Behavior: The third coordinate of every \(\mathbf{X}_k\) is \(1\), so the left panel draws \(\mathbf{X}_k\) in the plane \(x_3 = 1\), as offsets from \(\mathbf{V}_1 = (0.4, 0.6, 1)\), and zooms in each frame on \(\mathbf{X}_{k-1}\) and \(\mathbf{X}_k\). Since \(\mathbf{X}_0 = (2, 3, 5) - (1, 2, 4)\) has no component along the eigenvector \((1, 1, 2)\), every \(\mathbf{X}_k\) lies on the dashed line through \(\mathbf{V}_1\) and the normalized eigenvector \(\mathbf{W}_2 = (\tfrac14, \tfrac12, 1)\) for \(\lambda = 2\) (shown in the first two frames). The iterates approach \(\mathbf{V}_1\) along this line from the side away from \(\mathbf{W}_2\), with \(\mathbf{X}_k - \mathbf{V}_1 = (3, 2, 0)/\bigl(5(5 \cdot 2^k - 4)\bigr)\). The distance to \(\mathbf{V}_1\) is multiplied at each step by a ratio that rises from \(\tfrac16\) toward \(\tfrac12 = |\lambda_2/\lambda_1|\) without reaching it, so after the first few frames the window shrinks by about half per frame. In the right panel \(c_k - 4\) falls from \(8\) at \(k = 1\) to \(7.629 \times 10^{-7}\) at \(k = 22\), and \(\lVert \mathbf{X}_k - \mathbf{V}_1 \rVert_2\) falls from \(0.7211\) to \(3.439 \times 10^{-8}\); both lines become parallel to the dashed line of slope \(\tfrac12\). The step of the stopping test (4) is \(|c_k - c_{k-1}|\) at every \(k\), because the vector part is smaller. From \(k = 9\) on it is within \(1\%\) of \(c_k - 4\), as the ratio \(\tfrac12\) predicts, and it first falls below \(\varepsilon\) at \(k = 22\).

Julia source

The power method on Mathews’ Example 1: in the plane x₃ = 1 the iterates X_k move along a straight line toward the eigenvector V₁ = (0.4, 0.6, 1), the window zooming in with every frame, while a log-scale panel shows c_k − 4 falling from 8 to 7.629 × 10⁻⁷ and the vector error from 0.7211 to 3.439 × 10⁻⁸ in 22 iterations, parallel to a line of slope ½

Case 2 — The power method on the \(6 \times 6\) matrix of Example 2, \(\mathbf{X}_0 = (1, 1, 1, 1, 1, 1)\), \(\varepsilon = 2 \times 10^{-6}\), \(40\) iterations

Behavior: The bars of \(\mathbf{X}_k\) settle onto the black marks of \(\mathbf{V}_1 = (\tfrac13, 0, -\tfrac23, 1, 0, \tfrac13)\). From \(k = 3\) on the largest coordinate error is in \(x_2\) or \(x_5\), the coordinates where \(\mathbf{V}_1\) is \(0\) but the eigenvector \((-1, 4, 1, 0, 4, 3)\) for \(\lambda_2 = 3\) is not, and at \(k = 40\) both are still \(3.576 \times 10^{-6}\). The right panel shows the two rates explained in Example 2. The vector error \(\lVert \mathbf{X}_k - \mathbf{V}_1 \rVert_2\) decreases at every step, by a ratio that approaches \(\tfrac34 = |\lambda_2/\lambda_1|\) (\(0.7500\) to four decimals from \(k = 23\) on). The eigenvalue estimate \(c_k\) is read from the fourth coordinate, where the eigenvectors for \(3\) and \(-1\) are \(0\). So \(c_2 - 4\) is exactly \(0\) (it has no point on the log axis), and from \(k = 3\) on \(c_k - 4\) changes sign at every step: \(c_k > 4\) (filled markers) at odd \(k\) and \(c_k < 4\) (hollow markers) at even \(k\). Its size zigzags down by a factor approaching \(\tfrac14\) every two steps, to \(1.698 \times 10^{-12}\) at \(k = 40\). From \(k = 7\) on, the step of the stopping test runs below the vector error, and from \(k = 9\) on it is the vector part \(\lVert \mathbf{X}_k - \mathbf{X}_{k-1} \rVert_2\). At \(k = 40\) the step is \(1.954 \times 10^{-6} < \varepsilon\) and the run stops, while the error \(\lVert \mathbf{X}_{40} - \mathbf{V}_1 \rVert_2 = 5.862 \times 10^{-6}\) is three times larger.

Julia source

The power method on Mathews’ 6 × 6 Example 2: bars of the six coordinates of X_k settle onto the eigenvector (1/3, 0, −2/3, 1, 0, 1/3), with the second and fifth coordinates last; on a log scale the vector error falls by about 3/4 per step to 5.862 × 10⁻⁶ while c_k − 4 alternates in sign and falls by about 1/4 every two steps to 1.698 × 10⁻¹² at k = 40

Case 3 — Shifted-inverse power method with \(\alpha = 4.2\) (Example 3) against the power method (Example 1), \(\mathbf{X}_0 = (1, 1, 1)\), \(\varepsilon = 10^{-7}\)

Behavior: Both runs start from \(\mathbf{X}_0 = (1, 1, 1)\) on the matrix of Example 1, and both use the tolerance \(\varepsilon = 10^{-7}\) of Example 3, so the plain power method runs \(25\) iterations here instead of the \(22\) of Example 1. Each shifted-inverse step solves \((\mathbf{A} - 4.2\,\mathbf{I})\mathbf{Y}_k = \mathbf{X}_k\) using one factorization of \(\mathbf{A} - 4.2\,\mathbf{I}\). Its eigenvalue error \(\alpha + 1/c_k - 4\) is multiplied at each step by a ratio that approaches \(\tfrac{1}{11} = |\mu_2/\mu_1|\), so its line is much steeper than the plain method’s, whose ratio approaches \(\tfrac12\). The shifted-inverse run stops at \(k = 10\) with \(\alpha + 1/c_{10} - 4 = 6.169 \times 10^{-11}\) and \(\lVert \mathbf{X}_{10} - \mathbf{V}_1 \rVert_2 = 5.560 \times 10^{-12}\). The plain run stops at \(k = 25\) with \(c_{25} - 4 = 9.537 \times 10^{-8}\) and \(\lVert \mathbf{X}_{25} - \mathbf{V}_1 \rVert_2 = 4.298 \times 10^{-9}\). At every iteration \(k \ge 1\) of both runs the vector error (dotted) lies below the eigenvalue error (solid).

Julia source

Log-scale errors of the shifted-inverse power method with shift 4.2 and of the plain power method on the matrix of Example 1, both from (1, 1, 1) with tolerance 10⁻⁷: the shifted-inverse errors fall by about 1/11 per step and stop at k = 10 with eigenvalue error 6.169 × 10⁻¹¹, while the plain errors fall by about 1/2 per step and stop at k = 25 with eigenvalue error 9.537 × 10⁻⁸

Case 4 — The Markov chains of Examples 4 and 5, \(\mathbf{P}_{k+1} = \mathbf{A}\mathbf{P}_k\), months \(0\) to \(12\)

Behavior: Each month the bars of \(\mathbf{P}_k\) move toward the black marks of the limiting distributions \((3000, 4500, 4500)\) (Example 4) and \((2800, 4400, 3600)\) (Example 5), while the totals stay \(12000\) and \(10800\). By month \(6\) the largest deviations from the limits are \(1.362\) and \(5.734\) users, too small to see on the bars, and the right panel follows them further. In Example 5 the largest deviation is exactly \(1400\,(0.4)^k\) from \(k = 1\) on, a straight line with ratio \(\lambda_2 = 0.4\). In Example 4 its ratio is \(0.2\), \(0.4\) and \(0.35\) in the first three months and then decreases toward \(\lambda_2 = 0.3\) (\(0.3009\) at \(k = 12\)). Example 4’s deviation is the smaller of the two in every month, and it falls by the smaller ratio in every month except the second, where both ratios are \(0.4\): at \(k = 12\) it is \(0.001057\), against \(0.02349\) in Example 5. Example 4 is carried one month past Mathews’ last term \(\mathbf{P}_{11}\), so that both chains run for twelve months.

Julia source

Two Markov chains from Mathews’ Examples 4 and 5: bars for the numbers of users of brands X, Y and Z move onto the limiting distributions (3000, 4500, 4500) and (2800, 4400, 3600) over twelve months, while a log-scale panel shows the largest deviation from the limit falling by ratios approaching 0.3 and 0.4, to 0.001057 and 0.02349 at month 12

The Power Method

NoteDefinition — Dominant eigenvalue and eigenvector

If \(\lambda_1\) is an eigenvalue of \(\mathbf{A}\) that is larger in absolute value than every other eigenvalue of \(\mathbf{A}\), it is called the dominant eigenvalue. An eigenvector \(\mathbf{V}_1\) for \(\lambda_1\) is called a dominant eigenvector.

NoteDefinition — Normalized vector

A vector is normalized (in Mathews’ sense) if its coordinate of largest magnitude equals \(1\). Any nonzero vector \(\mathbf{V} = (v_1, \ldots, v_n)\) can be normalized by dividing it by its coordinate of largest magnitude:

\[ \frac{1}{c}\,\mathbf{V}, \qquad c = v_j \text{ where } |v_j| = \max_{1 \le i \le n} |v_i| . \]

The sign of \(c\) is kept, so the coordinate that becomes \(1\) is exactly \(+1\).

This is not the unit-length normalization \(\mathbf{V}/\lVert\mathbf{V}\rVert\) that most eigenvalue software returns; the two differ by a scalar factor.

TipTheorem — Power method

Assume that the \(n \times n\) matrix \(\mathbf{A}\) has \(n\) distinct eigenvalues \(\lambda_1, \lambda_2, \ldots, \lambda_n\), ordered by decreasing magnitude with a strict gap at the top:

\[ |\lambda_1| > |\lambda_2| \ge |\lambda_3| \ge \cdots \ge |\lambda_n| . \]

If the starting vector \(\mathbf{X}_0\) is chosen appropriately, then the sequences \(\{\mathbf{X}_k\}\) and \(\{c_k\}\) generated by

\[ \mathbf{Y}_k = \mathbf{A}\mathbf{X}_k, \qquad \mathbf{X}_{k+1} = \frac{1}{c_{k+1}}\,\mathbf{Y}_k, \tag{1} \]

where \(c_{k+1}\) is the coordinate of \(\mathbf{Y}_k\) of largest magnitude, converge to the normalized dominant eigenvector \(\mathbf{V}_1\) and to the dominant eigenvalue \(\lambda_1\):

\[ \lim_{k\to\infty} \mathbf{X}_k = \mathbf{V}_1, \qquad \lim_{k\to\infty} c_k = \lambda_1 . \]

“Chosen appropriately” means that \(\mathbf{X}_0\) has a nonzero component along \(\mathbf{V}_1\). If \(\mathbf{X}_0\) happens to be an eigenvector for some other eigenvalue, the iteration never leaves that eigenvector, and another starting vector must be chosen. (The argument below also assumes that the largest coordinate of \(\mathbf{V}_1\) is unique in magnitude, so that the normalization settles on one coordinate; this holds in every example below.)

Why it works

Distinct eigenvalues give \(n\) linearly independent eigenvectors \(\mathbf{V}_1, \ldots, \mathbf{V}_n\), so the starting vector can be written \(\mathbf{X}_0 = b_1\mathbf{V}_1 + b_2\mathbf{V}_2 + \cdots + b_n\mathbf{V}_n\) with \(b_1 \ne 0\). Each \(\mathbf{X}_k\) is \(\mathbf{A}^k\mathbf{X}_0\) divided by the product \(c_1 c_2 \cdots c_k\), and

\[ \mathbf{A}^k\mathbf{X}_0 = \lambda_1^k \left( b_1\mathbf{V}_1 + \sum_{i=2}^{n} b_i \left(\frac{\lambda_i}{\lambda_1}\right)^{k} \mathbf{V}_i \right). \tag{2} \]

Since \(|\lambda_i/\lambda_1| < 1\) for \(i \ge 2\), the sum tends to \(\mathbf{0}\), so the direction of \(\mathbf{A}^k\mathbf{X}_0\) tends to that of \(\mathbf{V}_1\). Normalizing removes the growing factor \(\lambda_1^k b_1\), and \(\mathbf{X}_k \to \mathbf{V}_1\). Then \(\mathbf{Y}_k = \mathbf{A}\mathbf{X}_k \to \lambda_1\mathbf{V}_1\), whose largest coordinate is \(\lambda_1\), so \(c_{k+1} \to \lambda_1\). Because the sign of \(c_{k+1}\) is kept, this works for a negative \(\lambda_1\) as well.

Speed of convergence

In (2) the coefficient of \(\mathbf{V}_2\) goes to zero in proportion to \(|\lambda_2/\lambda_1|^k\). In general, therefore, the errors in \(\mathbf{X}_k\) and in \(c_k\) shrink roughly by the factor \(|\lambda_2/\lambda_1|\) per iteration: the convergence is linear, fast when \(|\lambda_2|\) is much smaller than \(|\lambda_1|\) and slow when the two are close. The examples below show two refinements of this rule. Only the eigenvalues whose components \(b_i\) are present in \(\mathbf{X}_0\) count (in Examples 1 and 3 the component for \(\lambda = 1\) is absent), and the error in \(c_k\) is only affected by eigenvectors that are nonzero in the coordinate used for the normalization (Example 2).

A linearly convergent sequence \(\{p_k\}\) can be accelerated by Aitken’s \(\Delta^2\) process, which forms the new sequence

\[ \hat{p}_k = p_k - \frac{(p_{k+1} - p_k)^2}{p_{k+2} - 2p_{k+1} + p_k} \tag{3} \]

that converges faster (see Aitken’s method and Steffensen’s acceleration). It can be applied to the eigenvalue estimates \(c_k\) of the power method; Example 1 shows the effect.

Algorithm

Mathews’ program for the power method carries out (1) from a starting vector \(\mathbf{X}_0\), with a tolerance \(\varepsilon\) and an iteration limit:

  1. Set \(c_0 = 0\).
  2. For \(k = 0, 1, 2, \ldots\): form \(\mathbf{Y}_k = \mathbf{A}\mathbf{X}_k\), take \(c_{k+1}\) = the coordinate of \(\mathbf{Y}_k\) of largest magnitude (if a positive and a negative coordinate tie, the positive one), and set \(\mathbf{X}_{k+1} = \mathbf{Y}_k / c_{k+1}\).
  3. Stop as soon as both the eigenvalue estimate and the vector have settled, \[ \max\bigl( |c_{k+1} - c_k|,\ \lVert \mathbf{X}_{k+1} - \mathbf{X}_k \rVert_2 \bigr) < \varepsilon , \tag{4} \] and return \(c_{k+1}\) and \(\mathbf{X}_{k+1}\); otherwise continue, up to the iteration limit.

The stopping test (4) measures the size of the last step, not the error. For a linearly convergent sequence with ratio \(r\) the error is about \(r/(1 - r)\) times the last step: about equal to it when \(r = \tfrac12\), but three times larger when \(r = \tfrac34\) (Example 2).

Example 1 — A \(3 \times 3\) matrix

Use the power method to find the dominant eigenvalue and eigenvector of

\[ \mathbf{A} = \begin{pmatrix} 0 & 11 & -5 \\ -2 & 17 & -7 \\ -4 & 26 & -10 \end{pmatrix}. \]

Mathews starts from \(\mathbf{X}_0 = (1, 1, 1)\), with tolerance \(\varepsilon = 10^{-6}\) in (4) and an iteration limit of \(50\).

Step 1: \(\mathbf{Y}_0 = \mathbf{A}\mathbf{X}_0 = (6, 8, 12)\). Its largest coordinate is \(c_1 = 12\), so

\[ \mathbf{X}_1 = \tfrac{1}{12}(6, 8, 12) = \left(\tfrac12, \tfrac23, 1\right). \]

Step 2: \(\mathbf{Y}_1 = \mathbf{A}\mathbf{X}_1 = \left(\tfrac73, \tfrac{10}{3}, \tfrac{16}{3}\right)\), so \(c_2 = \tfrac{16}{3}\) and

\[ \mathbf{X}_2 = \tfrac{3}{16}\left(\tfrac73, \tfrac{10}{3}, \tfrac{16}{3}\right) = \left(\tfrac{7}{16}, \tfrac58, 1\right). \]

Step 3: \(\mathbf{Y}_2 = \mathbf{A}\mathbf{X}_2 = \left(\tfrac{15}{8}, \tfrac{11}{4}, \tfrac92\right)\), so \(c_3 = \tfrac92\) and \(\mathbf{X}_3 = \left(\tfrac{5}{12}, \tfrac{11}{18}, 1\right)\).

The third coordinate is the largest at every step, so the normalization always divides by it. The test (4) is first passed at \(k = 22\):

\(k\) \(c_k\) \(\mathbf{X}_k\) \(c_k - 4\) step size in (4)
1 12.0000000 (0.5000000, 0.6666667, 1) 8.000 12.00
2 5.3333333 (0.4375000, 0.6250000, 1) 1.333 6.667
3 4.5000000 (0.4166667, 0.6111111, 1) 0.5000 0.8333
4 4.2222222 (0.4078947, 0.6052632, 1) 0.2222 0.2778
5 4.1052632 (0.4038462, 0.6025641, 1) 0.1053 0.1170
6 4.0512821 (0.4018987, 0.6012658, 1) 0.05128 0.05398
7 4.0253165 (0.4009434, 0.6006289, 1) 0.02532 0.02597
8 4.0125786 (0.4004702, 0.6003135, 1) 0.01258 0.01274
9 4.0062696 (0.4002347, 0.6001565, 1) 0.006270 0.006309
10 4.0031299 (0.4001173, 0.6000782, 1) 0.003130 0.003140
11 4.0015637 (0.4000586, 0.6000391, 1) 0.001564 0.001566
12 4.0007816 (0.4000293, 0.6000195, 1) \(7.816 \times 10^{-4}\) \(7.822 \times 10^{-4}\)
13 4.0003907 (0.4000146, 0.6000098, 1) \(3.907 \times 10^{-4}\) \(3.909 \times 10^{-4}\)
14 4.0001953 (0.4000073, 0.6000049, 1) \(1.953 \times 10^{-4}\) \(1.954 \times 10^{-4}\)
15 4.0000977 (0.4000037, 0.6000024, 1) \(9.766 \times 10^{-5}\) \(9.767 \times 10^{-5}\)
16 4.0000488 (0.4000018, 0.6000012, 1) \(4.883 \times 10^{-5}\) \(4.883 \times 10^{-5}\)
17 4.0000244 (0.4000009, 0.6000006, 1) \(2.441 \times 10^{-5}\) \(2.441 \times 10^{-5}\)
18 4.0000122 (0.4000005, 0.6000003, 1) \(1.221 \times 10^{-5}\) \(1.221 \times 10^{-5}\)
19 4.0000061 (0.4000002, 0.6000002, 1) \(6.104 \times 10^{-6}\) \(6.104 \times 10^{-6}\)
20 4.0000031 (0.4000001, 0.6000001, 1) \(3.052 \times 10^{-6}\) \(3.052 \times 10^{-6}\)
21 4.0000015 (0.4000001, 0.6000000, 1) \(1.526 \times 10^{-6}\) \(1.526 \times 10^{-6}\)
22 4.0000008 (0.4000000, 0.6000000, 1) \(7.629 \times 10^{-7}\) \(7.629 \times 10^{-7}\)

The run returns

\[ \boxed{\ c_{22} = 4.0000008 \approx \lambda_1 = 4, \qquad \mathbf{X}_{22} = (0.4000000,\ 0.6000000,\ 1) \approx \mathbf{V}_1 = \left(\tfrac25, \tfrac35, 1\right)\ } \]

in agreement with Mathews’ printout, which shows the same 22 iterations to six digits.

Why the error halves. The eigenvalues of \(\mathbf{A}\) are \(4\), \(2\) and \(1\), with eigenvectors \((2, 3, 5)\), \((1, 2, 4)\) and \((1, 1, 2)\). The starting vector has no component along the third:

\[ (1, 1, 1) = (2, 3, 5) - (1, 2, 4), \qquad\text{so}\qquad \mathbf{A}^k\mathbf{X}_0 = 4^k (2, 3, 5) - 2^k (1, 2, 4). \]

Normalizing by the third coordinate gives, with \(t = 2^k\), the exact iterates

\[ \mathbf{X}_k = \left( \frac{2t - 1}{5t - 4},\ \frac{3t - 2}{5t - 4},\ 1 \right), \qquad c_k = \frac{4(5t - 4)}{5t - 8}, \qquad c_k - 4 = \frac{16}{5 \cdot 2^k - 8}, \]

which reproduce every row of the table. The error ratio \((c_k - 4)/(c_{k-1} - 4)\) is \(0.1667\) at \(k = 2\) and \(0.375\) at \(k = 3\), and then increases toward \(\tfrac12 = |\lambda_2/\lambda_1|\) without reaching it (\(0.4969\) at \(k = 8\), \(0.49999981\) at \(k = 22\)). The error in \(\mathbf{X}_k\) halves in the same way: \(\lVert \mathbf{X}_k - \mathbf{V}_1 \rVert_2 = 1.375 \times 10^{-7}\), \(6.877 \times 10^{-8}\) and \(3.439 \times 10^{-8}\) at \(k = 20\), \(21\), \(22\). With ratio \(\tfrac12\) the last step, \(7.629 \times 10^{-7}\), is also the error in \(c_{22}\).

Aitken acceleration. Applying (3) to \(c_1, c_2, c_3, \ldots\) gives, in exact arithmetic,

\(k\) \(c_k\) \(c_k - 4\) \(\hat{c}_k\) (from \(c_k, c_{k+1}, c_{k+2}\)) \(\hat{c}_k - 4\)
1 12.0000000 8.000 \(92/21 = 4.3809524\) 0.3810
2 5.3333333 1.333 \(49/12 = 4.0833333\) 0.08333
3 4.5000000 0.5000 \(398/99 = 4.0202020\) 0.02020
4 4.2222222 0.2222 \(1598/399 = 4.0050125\) 0.005013
5 4.1052632 0.1053 \(6398/1599 = 4.0012508\) 0.001251
6 4.0512821 0.05128 \(25598/6399 = 4.0003125\) \(3.125 \times 10^{-4}\)
7 4.0253165 0.02532 \(102398/25599 = 4.0000781\) \(7.813 \times 10^{-5}\)
8 4.0125786 0.01258 \(409598/102399 = 4.0000195\) \(1.953 \times 10^{-5}\)

The accelerated error shrinks by a factor approaching \(\tfrac14\) per step instead of \(\tfrac12\). For instance \(\hat{c}_8\), which uses \(c_8\), \(c_9\) and \(c_{10}\), is closer to \(4\) than \(c_{10}\) (\(1.953 \times 10^{-5}\) against \(3.130 \times 10^{-3}\)).

Verification:

\[ \mathbf{A}\begin{pmatrix} 2 \\ 3 \\ 5 \end{pmatrix} = \begin{pmatrix} 0 + 33 - 25 \\ -4 + 51 - 35 \\ -8 + 78 - 50 \end{pmatrix} = \begin{pmatrix} 8 \\ 12 \\ 20 \end{pmatrix} = 4\begin{pmatrix} 2 \\ 3 \\ 5 \end{pmatrix} \ \checkmark \]

and the characteristic polynomial is \(\det(\mathbf{A} - \lambda\mathbf{I}) = -(\lambda - 4)(\lambda - 2)(\lambda - 1)\), so \(4\) is dominant. Mathews compares with Mathematica’s Eigensystem, which in floating point returns a unit-length eigenvector; that vector is \(\pm(2, 3, 5)/\sqrt{38} = \pm(0.324443,\ 0.486664,\ 0.811107)\), a multiple of \(\mathbf{V}_1 = (0.4, 0.6, 1)\). As Mathews notes, the accuracy of the power method’s answer is limited by the number of iterations.

Example 2 — A \(6 \times 6\) matrix

Use the power method to find the dominant eigenvalue and eigenvector of

\[ \mathbf{A} = \begin{pmatrix} 87 & 270 & -12 & -49 & -276 & 40 \\ -14 & -45 & 6 & 10 & 46 & -4 \\ -50 & -156 & 4 & 25 & 162 & -25 \\ 94 & 294 & -5 & -47 & -306 & 49 \\ 1 & 1 & 3 & 1 & 0 & 2 \\ 16 & 48 & 1 & -6 & -48 & 8 \end{pmatrix}. \]

Mathews starts from \(\mathbf{X}_0 = (1, 1, 1, 1, 1, 1)\), with tolerance \(\varepsilon = 2 \times 10^{-6}\) and an iteration limit of \(50\).

Step 1: \(\mathbf{Y}_0 = \mathbf{A}\mathbf{X}_0\) is the vector of row sums, \((60, -1, -40, 79, 8, 19)\), so \(c_1 = 79\) and \(\mathbf{X}_1 = \tfrac{1}{79}(60, -1, -40, 79, 8, 19)\).

Step 2: \(\mathbf{Y}_1 = \mathbf{A}\mathbf{X}_1 = \tfrac{1}{79}(111, 47, -208, 316, 56, 166)\), whose largest coordinate is exactly \(c_2 = 4\), so

\[ \mathbf{X}_2 = \left( \tfrac{111}{316},\ \tfrac{47}{316},\ -\tfrac{52}{79},\ 1,\ \tfrac{14}{79},\ \tfrac{83}{158} \right). \]

The fourth coordinate is the largest at every step of the run. The test (4) is first passed at \(k = 40\). In the table, \(e_k = \max_i |x_{k,i} - v_i|\) is the error of \(\mathbf{X}_k\) against the exact \(\mathbf{V}_1\) found below:

\(k\) \(c_k\) \(\mathbf{X}_k\) \(c_k - 4\) \(e_k\) step size in (4)
1 79.0000000 (0.7594937, −0.0126582, −0.5063291, 1, 0.1012658, 0.2405063) 75.00 0.4262 79.00
2 4.0000000 (0.3512658, 0.1487342, −0.6582278, 1, 0.1772152, 0.5253165) 0 0.1920 75.00
3 4.5506329 (0.3776078, 0.1077886, −0.6203060, 1, 0.1265647, 0.3949930) 0.5506 0.1266 0.5506
4 3.9123783 (0.3236758, 0.0979381, −0.6512620, 1, 0.1059367, 0.4294348) −0.08762 0.1059 0.6383
5 4.1013153 (0.3308919, 0.0753662, −0.6440149, 1, 0.0796568, 0.3850221) 0.1013 0.07966 0.1889
6 3.9726965 (0.3222678, 0.0594223, −0.6542011, 1, 0.0614841, 0.3837410) −0.02730 0.06148 0.1286
7 4.0234984 (0.3260226, 0.0453205, −0.6544475, 1, 0.0463698, 0.3661101) 0.02350 0.04637 0.05080
8 3.9928257 (0.3256367, 0.0345987, −0.6586221, 1, 0.0351182, 0.3607542) −0.007174 0.03512 0.03067
9 4.0057652 (0.3277906, 0.0261704, −0.6599057, 1, 0.0264313, 0.3526574) 0.005765 0.02643 0.01478
10 3.9981844 (0.3286298, 0.0197686, −0.6618763, 1, 0.0198987, 0.3485284) −0.001816 0.01990 0.01026
11 4.0014345 (0.3298615, 0.0148861, −0.6628908, 1, 0.0149512, 0.3444220) 0.001435 0.01495 0.008230
12 3.9995447 (0.3305934, 0.0111985, −0.6639050, 1, 0.0112311, 0.3418244) \(-4.553 \times 10^{-4}\) 0.01123 0.005979
13 4.0003582 (0.3312921, 0.0084144, −0.6645495, 1, 0.0084307, 0.3396251) \(3.582 \times 10^{-4}\) 0.008431 0.004619
14 3.9998861 (0.3317685, 0.0063191, −0.6650964, 1, 0.0063273, 0.3380957) \(-1.139 \times 10^{-4}\) 0.006327 0.003418
15 4.0000895 (0.3321631, 0.0047433, −0.6654774, 1, 0.0047474, 0.3368861) \(8.953 \times 10^{-5}\) 0.004747 0.002597
16 3.9999715 (0.3324472, 0.0035595, −0.6657792, 1, 0.0035616, 0.3360088) \(-2.848 \times 10^{-5}\) 0.003562 0.001936
17 4.0000224 (0.3326696, 0.0026707, −0.6659982, 1, 0.0026717, 0.3353351) \(2.238 \times 10^{-5}\) 0.002672 0.001461
18 3.9999929 (0.3328334, 0.0020035, −0.6661664, 1, 0.0020040, 0.3348374) \(-7.121 \times 10^{-6}\) 0.002004 0.001093
19 4.0000056 (0.3329586, 0.0015029, −0.6662907, 1, 0.0015031, 0.3344602) \(5.595 \times 10^{-6}\) 0.001503 \(8.215 \times 10^{-4}\)
20 3.9999982 (0.3330517, 0.0011273, −0.6663850, 1, 0.0011274, 0.3341792) \(-1.780 \times 10^{-6}\) 0.001127 \(6.155 \times 10^{-4}\)
21 4.0000014 (0.3331222, 0.0008455, −0.6664552, 1, 0.0008456, 0.3339674) \(1.399 \times 10^{-6}\) \(8.456 \times 10^{-4}\) \(4.621 \times 10^{-4}\)
22 3.9999996 (0.3331748, 0.0006342, −0.6665082, 1, 0.0006342, 0.3338091) \(-4.450 \times 10^{-7}\) \(6.342 \times 10^{-4}\) \(3.464 \times 10^{-4}\)
23 4.0000003 (0.3332145, 0.0004756, −0.6665477, 1, 0.0004757, 0.3336901) \(3.497 \times 10^{-7}\) \(4.757 \times 10^{-4}\) \(2.599 \times 10^{-4}\)
24 3.9999999 (0.3332442, 0.0003567, −0.6665775, 1, 0.0003568, 0.3336009) \(-1.113 \times 10^{-7}\) \(3.568 \times 10^{-4}\) \(1.949 \times 10^{-4}\)
25 4.0000001 (0.3332665, 0.0002676, −0.6665998, 1, 0.0002676, 0.3335340) \(8.742 \times 10^{-8}\) \(2.676 \times 10^{-4}\) \(1.462 \times 10^{-4}\)
26 4.0000000 (0.3332832, 0.0002007, −0.6666165, 1, 0.0002007, 0.3334838) \(-2.782 \times 10^{-8}\) \(2.007 \times 10^{-4}\) \(1.097 \times 10^{-4}\)
27 4.0000000 (0.3332957, 0.0001505, −0.6666290, 1, 0.0001505, 0.3334462) \(2.186 \times 10^{-8}\) \(1.505 \times 10^{-4}\) \(8.225 \times 10^{-5}\)
28 4.0000000 (0.3333051, 0.0001129, −0.6666384, 1, 0.0001129, 0.3334180) \(-6.954 \times 10^{-9}\) \(1.129 \times 10^{-4}\) \(6.168 \times 10^{-5}\)
29 4.0000000 (0.3333122, 0.0000847, −0.6666455, 1, 0.0000847, 0.3333968) \(5.464 \times 10^{-9}\) \(8.466 \times 10^{-5}\) \(4.626 \times 10^{-5}\)
30 4.0000000 (0.3333175, 0.0000635, −0.6666508, 1, 0.0000635, 0.3333810) \(-1.738 \times 10^{-9}\) \(6.350 \times 10^{-5}\) \(3.470 \times 10^{-5}\)
31 4.0000000 (0.3333214, 0.0000476, −0.6666548, 1, 0.0000476, 0.3333690) \(1.366 \times 10^{-9}\) \(4.762 \times 10^{-5}\) \(2.602 \times 10^{-5}\)
32 4.0000000 (0.3333244, 0.0000357, −0.6666577, 1, 0.0000357, 0.3333601) \(-4.346 \times 10^{-10}\) \(3.572 \times 10^{-5}\) \(1.952 \times 10^{-5}\)
33 4.0000000 (0.3333266, 0.0000268, −0.6666600, 1, 0.0000268, 0.3333534) \(3.415 \times 10^{-10}\) \(2.679 \times 10^{-5}\) \(1.464 \times 10^{-5}\)
34 4.0000000 (0.3333283, 0.0000201, −0.6666616, 1, 0.0000201, 0.3333484) \(-1.087 \times 10^{-10}\) \(2.009 \times 10^{-5}\) \(1.098 \times 10^{-5}\)
35 4.0000000 (0.3333296, 0.0000151, −0.6666629, 1, 0.0000151, 0.3333446) \(8.537 \times 10^{-11}\) \(1.507 \times 10^{-5}\) \(8.234 \times 10^{-6}\)
36 4.0000000 (0.3333305, 0.0000113, −0.6666638, 1, 0.0000113, 0.3333418) \(-2.716 \times 10^{-11}\) \(1.130 \times 10^{-5}\) \(6.175 \times 10^{-6}\)
37 4.0000000 (0.3333312, 0.0000085, −0.6666645, 1, 0.0000085, 0.3333397) \(2.134 \times 10^{-11}\) \(8.476 \times 10^{-6}\) \(4.632 \times 10^{-6}\)
38 4.0000000 (0.3333317, 0.0000064, −0.6666651, 1, 0.0000064, 0.3333381) \(-6.791 \times 10^{-12}\) \(6.357 \times 10^{-6}\) \(3.474 \times 10^{-6}\)
39 4.0000000 (0.3333321, 0.0000048, −0.6666655, 1, 0.0000048, 0.3333369) \(5.336 \times 10^{-12}\) \(4.768 \times 10^{-6}\) \(2.605 \times 10^{-6}\)
40 4.0000000 (0.3333324, 0.0000036, −0.6666658, 1, 0.0000036, 0.3333360) \(-1.698 \times 10^{-12}\) \(3.576 \times 10^{-6}\) \(1.954 \times 10^{-6}\)

The run returns

\[ \boxed{\ c_{40} \approx \lambda_1 = 4, \qquad \mathbf{X}_{40} = (0.3333324,\ 0.0000036,\ -0.6666658,\ 1,\ 0.0000036,\ 0.3333360) \approx \mathbf{V}_1 = \left(\tfrac13, 0, -\tfrac23, 1, 0, \tfrac13\right)\ } \]

in agreement with Mathews’ printout of the same 40 iterations, whose last line shows \(\mathbf{X}_{40}\) to six significant digits as \((0.333332,\ 3.57567 \times 10^{-6},\ -0.666666,\ 1,\ 3.57567 \times 10^{-6},\ 0.333336)\) (exactly, the second and fifth coordinates are \(3.575674 \times 10^{-6}\) and \(3.575675 \times 10^{-6}\)).

Two different rates. The eigenvalues of \(\mathbf{A}\) are \(4, 3, 2, 1, -1, -2\), so the general rule predicts the ratio \(|\lambda_2/\lambda_1| = \tfrac34\), and that is what the eigenvector does: \(e_k/e_{k-1}\) equals \(0.7500\) (to four decimals) from \(k = 20\) on. The eigenvalue estimates behave differently. The starting vector has components along all six eigenvectors, but the eigenvector for \(\lambda_2 = 3\) is \((-1, 4, 1, 0, 4, 3)\), whose fourth coordinate is \(0\), and \(c_k\) is read from the fourth coordinate. In exact arithmetic the fourth coordinate of \(\mathbf{A}^k\mathbf{X}_0\) is

\[ \tfrac{45}{2}\,4^k - 3 \cdot 2^k - 14 - \tfrac92 (-2)^k , \]

so \(c_k\) only feels the eigenvalues \(2\), \(1\) and \(-2\) (the eigenvector for \(-1\) also has fourth coordinate \(0\)). The terms in \(2^k\) and \((-2)^k\) add to \(-\tfrac{15}{2}\,2^k\) for even \(k\) and partly cancel to \(+\tfrac32\,2^k\) for odd \(k\). As a result \(c_k - 4\) is exactly \(0\) at \(k = 2\), alternates in sign from \(k = 3\) on, and its magnitude shrinks by a factor approaching \(\tfrac14 = (\tfrac24)^2\) over every two steps (\(0.2500\) to four decimals from \(k = 16\) on). The per-step ratio \((c_k - 4)/(c_{k-1} - 4)\) does not settle to one value: it approaches \(-\tfrac{7}{22} \approx -0.3182\) at even \(k\) and \(-\tfrac{11}{14} \approx -0.7857\) at odd \(k\), and equals these to four decimals from \(k = 18\) on. At \(k = 40\) the eigenvalue estimate is correct to \(1.7 \times 10^{-12}\) while the vector is still off by \(3.6 \times 10^{-6}\).

The step is not the error. The test (4) stops the run when the step \(\lVert \mathbf{X}_{40} - \mathbf{X}_{39} \rVert_2 = 1.954 \times 10^{-6}\) falls below \(2 \times 10^{-6}\), but the actual error is \(\lVert \mathbf{X}_{40} - \mathbf{V}_1 \rVert_2 = 5.862 \times 10^{-6}\), three times larger, as the ratio \(r = \tfrac34\) predicts (\(r/(1-r) = 3\)).

Verification: The characteristic polynomial factors exactly as

\[ \det(\mathbf{A} - \lambda\mathbf{I}) = (\lambda - 4)(\lambda - 3)(\lambda - 2)(\lambda - 1)(\lambda + 1)(\lambda + 2), \]

and with \(\mathbf{V} = (1, 0, -2, 3, 0, 1) = 3\mathbf{V}_1\):

Row \((\mathbf{A}\mathbf{V})_i\) \(4v_i\)
1 \(87 + 0 + 24 - 147 + 0 + 40 = 4\) \(4 \ \checkmark\)
2 \(-14 + 0 - 12 + 30 + 0 - 4 = 0\) \(0 \ \checkmark\)
3 \(-50 + 0 - 8 + 75 + 0 - 25 = -8\) \(-8 \ \checkmark\)
4 \(94 + 0 + 10 - 141 + 0 + 49 = 12\) \(12 \ \checkmark\)
5 \(1 + 0 - 6 + 3 + 0 + 2 = 0\) \(0 \ \checkmark\)
6 \(16 + 0 - 2 - 18 + 0 + 8 = 4\) \(4 \ \checkmark\)

A unit-length eigenvector, as a floating-point eigensolver returns, is \(\pm(1, 0, -2, 3, 0, 1)/\sqrt{15} = \pm(0.258199,\ 0,\ -0.516398,\ 0.774597,\ 0,\ 0.258199)\).

The Shifted-Inverse Power Method

The shifted-inverse power method needs a good starting approximation to an eigenvalue, and then refines it by iteration. The approximation can come from another method, such as the QR method or Givens’ method, which may converge fast but with limited precision; the shifted-inverse power method then recovers full precision. Complex eigenvalues, repeated eigenvalues, or two eigenvalues of equal or nearly equal magnitude cause difficulties that need more advanced methods; as in Mathews’ module, the eigenvalues here are distinct. The method rests on three elementary facts.

TipTheorem — Shifting eigenvalues

If \(\lambda, \mathbf{V}\) is an eigenpair of \(\mathbf{A}\) and \(\alpha\) is any constant, then \(\lambda - \alpha, \mathbf{V}\) is an eigenpair of \(\mathbf{A} - \alpha\mathbf{I}\).

TipTheorem — Inverse eigenvalues

If \(\lambda, \mathbf{V}\) is an eigenpair of \(\mathbf{A}\) and \(\lambda \ne 0\), then \(1/\lambda, \mathbf{V}\) is an eigenpair of \(\mathbf{A}^{-1}\).

TipTheorem — Shifted-inverse eigenvalues

If \(\lambda, \mathbf{V}\) is an eigenpair of \(\mathbf{A}\) and \(\alpha \ne \lambda\), then \(1/(\lambda - \alpha), \mathbf{V}\) is an eigenpair of \((\mathbf{A} - \alpha\mathbf{I})^{-1}\).

Each follows in one line: \((\mathbf{A} - \alpha\mathbf{I})\mathbf{V} = (\lambda - \alpha)\mathbf{V}\), and multiplying \(\mathbf{A}\mathbf{V} = \lambda\mathbf{V}\) by \(\lambda^{-1}\mathbf{A}^{-1}\) gives \(\mathbf{A}^{-1}\mathbf{V} = \lambda^{-1}\mathbf{V}\); the third combines the first two.

TipTheorem — Shifted-inverse power method

Assume that the \(n \times n\) matrix \(\mathbf{A}\) has distinct eigenvalues \(\lambda_1, \ldots, \lambda_n\), and consider the eigenvalue \(\lambda_j\). Then a constant \(\alpha\) can be chosen so that \(\mu_1 = 1/(\lambda_j - \alpha)\) is the dominant eigenvalue of \((\mathbf{A} - \alpha\mathbf{I})^{-1}\). If \(\mathbf{X}_0\) is chosen appropriately, the sequences generated by

\[ \mathbf{Y}_k = (\mathbf{A} - \alpha\mathbf{I})^{-1}\mathbf{X}_k, \qquad \mathbf{X}_{k+1} = \frac{1}{c_{k+1}}\,\mathbf{Y}_k, \tag{5} \]

where \(c_{k+1}\) is the coordinate of \(\mathbf{Y}_k\) of largest magnitude, converge to the dominant eigenpair \(\mu_1, \mathbf{V}_j\) of \((\mathbf{A} - \alpha\mathbf{I})^{-1}\). The eigenvalue of \(\mathbf{A}\) is then

\[ \lambda_j = \alpha + \frac{1}{\mu_1} . \tag{6} \]

Any \(\alpha\) closer to \(\lambda_j\) than to every other eigenvalue works, and the closer it is, the faster the convergence. By the speed-of-convergence rule above, the general rate is

\[ \frac{|\mu_2|}{|\mu_1|} = \frac{|\lambda_j - \alpha|}{|\lambda_i - \alpha|}, \qquad \lambda_i = \text{the eigenvalue next closest to } \alpha . \]

In practice the inverse matrix is never formed. Each step solves the linear system \((\mathbf{A} - \alpha\mathbf{I})\mathbf{Y}_k = \mathbf{X}_k\) instead, and Mathews’ program factors \(\mathbf{A} - \alpha\mathbf{I}\) into \(\mathbf{L}\mathbf{U}\) once, before the loop, so that every step costs only a forward and a back substitution. Its stopping test is (4) applied to the \(c_k\) (the estimates of \(\mu_1\), starting from \(c_0 = 0\)) and the vectors, with “\(\le \varepsilon\)” in place of “\(< \varepsilon\)”, and at each step it prints \(\alpha + 1/c_{k+1}\), the current estimate of \(\lambda_j\).

Example 3 — The shifted-inverse power method with \(\alpha = 4.2\)

Find the eigenvalue near \(\alpha = 4.2\) and its eigenvector for the matrix of Example 1,

\[ \mathbf{A} = \begin{pmatrix} 0 & 11 & -5 \\ -2 & 17 & -7 \\ -4 & 26 & -10 \end{pmatrix}, \]

using the shifted-inverse power method with \(\mathbf{X}_0 = (1, 1, 1)\), tolerance \(\varepsilon = 10^{-7}\) and an iteration limit of \(50\), as Mathews does. (Mathews calls it the dominant eigenvalue; \(\lambda = 4\) is both the dominant eigenvalue and the eigenvalue nearest the shift.)

The eigenvalues \(4, 2, 1\) of \(\mathbf{A}\) become, for \((\mathbf{A} - 4.2\mathbf{I})^{-1}\),

\[ \mu = \frac{1}{4 - 4.2} = -5, \qquad \frac{1}{2 - 4.2} = -\frac{5}{11}, \qquad \frac{1}{1 - 4.2} = -\frac{5}{16}, \]

so \(\mu_1 = -5\) is dominant, and the predicted rate is \(|\mu_2/\mu_1| = \tfrac{1}{11} \approx 0.0909\), compared with \(\tfrac12\) for the plain power method in Example 1.

Step 1: Solve \((\mathbf{A} - 4.2\mathbf{I})\mathbf{Y}_0 = (1, 1, 1)\):

\[ \begin{pmatrix} -4.2 & 11 & -5 \\ -2 & 12.8 & -7 \\ -4 & 26 & -14.2 \end{pmatrix} \mathbf{Y}_0 = \begin{pmatrix} 1 \\ 1 \\ 1 \end{pmatrix} \quad\Longrightarrow\quad \mathbf{Y}_0 = \left( -\tfrac{105}{11},\ -\tfrac{155}{11},\ -\tfrac{255}{11} \right). \]

The largest coordinate is \(c_1 = -\tfrac{255}{11} = -23.1818181818\), so

\[ \mathbf{X}_1 = \left( \tfrac{7}{17},\ \tfrac{31}{51},\ 1 \right), \qquad \lambda \approx 4.2 + \frac{1}{c_1} = 4.2 - \frac{11}{255} = 4.156862745098 . \]

Step 2: Solving \((\mathbf{A} - 4.2\mathbf{I})\mathbf{Y}_1 = \mathbf{X}_1\) gives \(c_2 = -\tfrac{3005}{561}\), \(\mathbf{X}_2 = \left(\tfrac{241}{601}, \tfrac{361}{601}, 1\right)\) and \(\lambda \approx 4.2 - \tfrac{561}{3005} = 4.013311148087\).

The test is first passed at \(k = 10\):

\(k\) \(c_k\) \(\alpha + 1/c_k\) \(\mathbf{X}_k\) \(\alpha + 1/c_k - 4\) step size
1 −23.1818181818 4.156862745098 (0.411764705882, 0.607843137255, 1) 0.1569 23.18
2 −5.3565062389 4.013311148087 (0.400998336106, 0.600665557404, 1) 0.01331 17.83
3 −5.0302526093 4.001202826643 (0.400090211998, 0.600060141332, 1) 0.001203 0.3263
4 −5.0027336969 4.000109288124 (0.400008196609, 0.600005464406, 1) \(1.093 \times 10^{-4}\) 0.02752
5 −5.0002483821 4.000009934791 (0.400000745109, 0.600000496740, 1) \(9.935 \times 10^{-6}\) 0.002485
6 −5.0000225791 4.000000903159 (0.400000067737, 0.600000045158, 1) \(9.032 \times 10^{-7}\) \(2.258 \times 10^{-4}\)
7 −5.0000020526 4.000000082105 (0.400000006158, 0.600000004105, 1) \(8.211 \times 10^{-8}\) \(2.053 \times 10^{-5}\)
8 −5.0000001866 4.000000007464 (0.400000000560, 0.600000000373, 1) \(7.464 \times 10^{-9}\) \(1.866 \times 10^{-6}\)
9 −5.0000000170 4.000000000679 (0.400000000051, 0.600000000034, 1) \(6.786 \times 10^{-10}\) \(1.696 \times 10^{-7}\)
10 −5.0000000015 4.000000000062 (0.400000000005, 0.600000000003, 1) \(6.169 \times 10^{-11}\) \(1.542 \times 10^{-8}\)

\[ \boxed{\ \lambda \approx 4.2 + \frac{1}{c_{10}} = 4.000000000062, \qquad \mathbf{X}_{10} = (0.400000000005,\ 0.600000000003,\ 1) \approx \left(\tfrac25, \tfrac35, 1\right)\ } \]

Mathews’ printout has the same ten lines, from \(4.1568627451\) to \(4.00000000006\) (\(\alpha + 1/c_k\) to twelve significant digits, trailing zeros dropped).

Measured rate. The ratio of successive errors in \(\alpha + 1/c_k\) is \(0.0849\), \(0.0904\), \(0.0909\) and \(0.09090\) at \(k = 2, 3, 4, 5\), and from \(k = 6\) on it equals \(0.09091\) to four significant figures, which is \(\tfrac{1}{11}\). Each step gains slightly more than one decimal digit. (As in Example 1, \((1, 1, 1)\) has no component along the eigenvector for \(\lambda = 1\); that component would have decayed even faster, at the ratio \(\tfrac{0.2}{3.2} = \tfrac{1}{16}\).)

Comparison with Example 1. The shifted-inverse run reaches an eigenvalue error of \(6.2 \times 10^{-11}\) in \(10\) iterations. The plain power method on the same matrix from the same \(\mathbf{X}_0\) needs \(36\) iterations to get \(c_k - 4 = 16/(5 \cdot 2^k - 8)\) that small, and with Mathews’ program and the same tolerance \(\varepsilon = 10^{-7}\) it stops after \(25\) iterations with an error of \(9.5 \times 10^{-8}\). Each shifted-inverse step costs a linear solve instead of a matrix–vector product, but with the LU factors computed once it is a pair of triangular solves.

Verification: \(\mathbf{A}(2, 3, 5)^T = 4(2, 3, 5)^T\) as in Example 1, and \((\mathbf{A} - 4.2\mathbf{I})(2, 3, 5)^T = -0.2\,(2, 3, 5)^T\), so \((2, 3, 5)\) is an eigenvector of \((\mathbf{A} - 4.2\mathbf{I})^{-1}\) with eigenvalue \(1/(-0.2) = -5\), and \(4.2 + 1/(-5) = 4\).

Application to Markov Chains

In a Markov chain the entries of the transition matrix are the probabilities of moving from any state to any other state in one time step. Mathews’ transition matrices have positive entries and every column sums to \(1\); for three states,

\[ \mathbf{A} = \begin{pmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \end{pmatrix}, \qquad a_{1j} + a_{2j} + a_{3j} = 1 \quad (j = 1, 2, 3). \]

Entry \(a_{ij}\) is the probability of moving from state \(j\) to state \(i\). If the initial state vector is \(\mathbf{P}_0 = (x_0, y_0, z_0)\), the \(x_0\) members of state 1 are redistributed as \((a_{11}x_0,\ a_{21}x_0,\ a_{31}x_0)\), those of state 2 as \((a_{12}y_0,\ a_{22}y_0,\ a_{32}y_0)\), and those of state 3 as \((a_{13}z_0,\ a_{23}z_0,\ a_{33}z_0)\). Adding the three gives the next state, \(\mathbf{P}_1 = \mathbf{A}\mathbf{P}_0\), and in general

\[ \mathbf{P}_{k+1} = \mathbf{A}\mathbf{P}_k, \qquad k = 0, 1, 2, \ldots \tag{7} \]

Because the columns sum to \(1\), the total \(x_k + y_k + z_k\) is the same at every step. If the sequence has a limiting distribution \(\mathbf{P} = \lim_{k\to\infty}\mathbf{P}_k\), then letting \(k \to \infty\) in (7) gives

\[ \mathbf{A}\mathbf{P} = \mathbf{P}, \]

so \(\mathbf{P}\) is an eigenvector of \(\mathbf{A}\) for the eigenvalue \(\lambda_1 = 1\). Iteration (7) is the power method without the normalization: it is not needed, because the dominant eigenvalue is \(1\) and the iterates neither grow nor shrink.

TipTheorem — Dominant eigenvalue of a transition matrix (general)

If every column of \(\mathbf{A}\) sums to \(1\), then \(\lambda = 1\) is an eigenvalue of \(\mathbf{A}\), since \(\mathbf{A}^T\) maps \((1, 1, \ldots, 1)\) to itself. If in addition every entry of \(\mathbf{A}\) is positive, then (by the Perron–Frobenius theorem) \(\lambda = 1\) is a simple eigenvalue with an eigenvector whose entries are all positive, and every other eigenvalue has \(|\lambda| < 1\). Then \(\mathbf{P}_k \to \mathbf{P}\), the eigenvector for \(\lambda = 1\) scaled to have the same total as \(\mathbf{P}_0\), for every nonnegative starting vector \(\mathbf{P}_0 \ne \mathbf{0}\).

Example 4 — Three brands, first transition matrix

Let \(\mathbf{P}_k = (x_k, y_k, z_k)\) record the numbers of people in a certain city who use brands X, Y and Z in month \(k\). Each month people decide to keep using the same brand or to switch:

  • a user of brand X switches to brand Y or Z with probabilities \(0.3\) and \(0.3\) (and stays with X with probability \(0.4\));
  • a user of brand Y switches to brand X or Z with probabilities \(0.3\) and \(0.2\) (stays with probability \(0.5\));
  • a user of brand Z switches to brand X or Y with probabilities \(0.1\) and \(0.3\) (stays with probability \(0.6\)).

Column \(j\) of the transition matrix lists where the users of brand \(j\) go:

\[ \begin{pmatrix} x_{k+1} \\ y_{k+1} \\ z_{k+1} \end{pmatrix} = \underbrace{\begin{pmatrix} 0.4 & 0.3 & 0.1 \\ 0.3 & 0.5 & 0.3 \\ 0.3 & 0.2 & 0.6 \end{pmatrix}}_{\mathbf{A}} \begin{pmatrix} x_k \\ y_k \\ z_k \end{pmatrix}, \qquad \mathbf{P}_0 = (2000,\ 6000,\ 4000). \]

(a) The first few terms. Mathews computes \(\mathbf{P}_0\) to \(\mathbf{P}_{11}\). Because the entries of \(\mathbf{A}\) have one decimal place, \(\mathbf{P}_k\) has at most \(k\) decimal places; the table rounds to four.

\(k\) \(x_k\) \(y_k\) \(z_k\) total
0 2000.0000 6000.0000 4000.0000 12000
1 3000.0000 4800.0000 4200.0000 12000
2 3060.0000 4560.0000 4380.0000 12000
3 3030.0000 4512.0000 4458.0000 12000
4 3011.4000 4502.4000 4486.2000 12000
5 3003.9000 4500.4800 4495.6200 12000
6 3001.2660 4500.0960 4498.6380 12000
7 3000.3990 4500.0192 4499.5818 12000
8 3000.1235 4500.0038 4499.8726 12000
9 3000.0378 4500.0008 4499.9614 12000
10 3000.0115 4500.0002 4499.9883 12000
11 3000.0035 4500.0000 4499.9965 12000

Mathews’ printout, which shows six significant digits, displays \(\mathbf{P}_{11}\) as \((3000.,\ 4500.,\ 4500.)\).

(b) The dominant eigenvalue. The characteristic polynomial is

\[ \det(\mathbf{A} - \lambda\mathbf{I}) = -(\lambda - 1)(\lambda - 0.3)(\lambda - 0.2), \]

so the eigenvalues are \(1\), \(0.3\) and \(0.2\), and \(\lambda_1 = 1\) is dominant.

(c) A corresponding eigenvector. The eigenvectors are \((2, 3, 3)\) for \(\lambda = 1\), \((-1, 0, 1)\) for \(0.3\) and \((-2, 1, 1)\) for \(0.2\). Scaling the first to the total \(12000\) of \(\mathbf{P}_0\) gives \(\mathbf{V}_1 = (3000, 4500, 4500)\).

Row \((\mathbf{A}\mathbf{V}_1)_i\) \((\mathbf{V}_1)_i\)
1 \(0.4(3000) + 0.3(4500) + 0.1(4500) = 1200 + 1350 + 450\) \(3000 \ \checkmark\)
2 \(0.3(3000) + 0.5(4500) + 0.3(4500) = 900 + 2250 + 1350\) \(4500 \ \checkmark\)
3 \(0.3(3000) + 0.2(4500) + 0.6(4500) = 900 + 900 + 2700\) \(4500 \ \checkmark\)

(d) The limiting distribution. Writing \(\mathbf{P}_0 - \mathbf{V}_1 = (-1000, 1500, -500)\) in the other two eigenvectors gives the exact iterates

\[ \mathbf{P}_k = \mathbf{V}_1 - 2000\,(0.3)^k\,(-1, 0, 1) + 1500\,(0.2)^k\,(-2, 1, 1), \]

so

\[ \boxed{\ \lim_{k\to\infty}\mathbf{P}_k = \mathbf{V}_1 = (3000,\ 4500,\ 4500)\ } \]

In the long run \(25\%\) of the people use brand X and \(37.5\%\) each use brands Y and Z. The largest deviation \(\max_i |(\mathbf{P}_k - \mathbf{V}_1)_i|\) is \(1500\) at \(k = 0\), \(300\) at \(k = 1\) and \(0.0035\) at \(k = 11\). Its ratio from one month to the next is \(0.2\), \(0.4\) and \(0.35\) for the first three months, and then decreases toward \(|\lambda_2/\lambda_1| = 0.3\) (\(0.3013\) at \(k = 11\)). The deviation in \(y_k\) alone is exactly \(1500\,(0.2)^k\), because the eigenvector for \(0.3\) has a zero second coordinate.

Example 5 — Three brands, second transition matrix

The setting is that of Example 4 with different switching probabilities:

  • a user of brand X switches to brand Y or Z with probabilities \(0.4\) and \(0.2\) (stays with probability \(0.4\));
  • a user of brand Y switches to brand X or Z with probabilities \(0.3\) and \(0.2\) (stays with probability \(0.5\));
  • a user of brand Z switches to brand X or Y with probabilities \(0.1\) and \(0.3\) (stays with probability \(0.6\)).

\[ \begin{pmatrix} x_{k+1} \\ y_{k+1} \\ z_{k+1} \end{pmatrix} = \underbrace{\begin{pmatrix} 0.4 & 0.3 & 0.1 \\ 0.4 & 0.5 & 0.3 \\ 0.2 & 0.2 & 0.6 \end{pmatrix}}_{\mathbf{A}} \begin{pmatrix} x_k \\ y_k \\ z_k \end{pmatrix}, \qquad \mathbf{P}_0 = (3400,\ 2400,\ 5000). \]

(a) The first few terms. Mathews computes \(\mathbf{P}_0\) to \(\mathbf{P}_{12}\) (rounded here to four decimals):

\(k\) \(x_k\) \(y_k\) \(z_k\) total
0 3400.0000 2400.0000 5000.0000 10800
1 2580.0000 4060.0000 4160.0000 10800
2 2666.0000 4310.0000 3824.0000 10800
3 2741.8000 4368.6000 3689.6000 10800
4 2776.2600 4387.9000 3635.8400 10800
5 2790.4580 4395.2060 3614.3360 10800
6 2796.1786 4398.0870 3605.7344 10800
7 2798.4710 4399.2353 3602.2938 10800
8 2799.3883 4399.6942 3600.9175 10800
9 2799.7553 4399.8777 3600.3670 10800
10 2799.9021 4399.9511 3600.1468 10800
11 2799.9609 4399.9804 3600.0587 10800
12 2799.9843 4399.9922 3600.0235 10800

Mathews’ printout displays \(\mathbf{P}_{12}\) to six significant digits as \((2799.98,\ 4399.99,\ 3600.02)\).

(b) The dominant eigenvalue. Here

\[ \det(\mathbf{A} - \lambda\mathbf{I}) = -(\lambda - 1)(\lambda - 0.4)(\lambda - 0.1), \]

so the eigenvalues are \(1\), \(0.4\) and \(0.1\), and \(\lambda_1 = 1\) is dominant.

(c) A corresponding eigenvector. The eigenvectors are \((7, 11, 9)\) for \(\lambda = 1\), \((-2, -1, 3)\) for \(0.4\) and \((-1, 1, 0)\) for \(0.1\). Scaling the first to the total \(10800\) of \(\mathbf{P}_0\) gives \(\mathbf{V}_1 = (2800, 4400, 3600)\).

Row \((\mathbf{A}\mathbf{V}_1)_i\) \((\mathbf{V}_1)_i\)
1 \(0.4(2800) + 0.3(4400) + 0.1(3600) = 1120 + 1320 + 360\) \(2800 \ \checkmark\)
2 \(0.4(2800) + 0.5(4400) + 0.3(3600) = 1120 + 2200 + 1080\) \(4400 \ \checkmark\)
3 \(0.2(2800) + 0.2(4400) + 0.6(3600) = 560 + 880 + 2160\) \(3600 \ \checkmark\)

(d) The limiting distribution. Writing \(\mathbf{P}_0 - \mathbf{V}_1 = (600, -2000, 1400)\) in the other two eigenvectors gives

\[ \mathbf{P}_k = \mathbf{V}_1 + \tfrac{1400}{3}\,(0.4)^k\,(-2, -1, 3) - \tfrac{4600}{3}\,(0.1)^k\,(-1, 1, 0), \]

so

\[ \boxed{\ \lim_{k\to\infty}\mathbf{P}_k = \mathbf{V}_1 = (2800,\ 4400,\ 3600)\ } \]

In the long run \(25.9\%\) of the people use brand X, \(40.7\%\) brand Y and \(33.3\%\) brand Z. Since the eigenvector for \(0.1\) has a zero third coordinate, \(z_k - 3600 = 1400\,(0.4)^k\) exactly, and this is the largest deviation from \(k = 1\) on, so \(\max_i |(\mathbf{P}_k - \mathbf{V}_1)_i|\) shrinks by exactly \(|\lambda_2/\lambda_1| = 0.4\) every month after the first (\(2000\), \(560\), \(224\), \(89.6\), …, \(0.0235\) at \(k = 12\)). Convergence is slower than in Example 4, where the ratio approaches \(0.3\).

References

Mathew, John H. 2000-2019. Numerical Analysis - Numerical Methods Modules. https://web.archive.org/web/20190808102217/http://mathfaculty.fullerton.edu/mathews/n2003/NumericalUndergradMod.html.