🌀Eigenvalue Problems
The QR Algorithm
Similarity transforms, QR iteration, Hessenberg reduction, shifts and deflation, eig versus eigh
London, 1959
The National Research Development Corporation is a small British government body set up to turn research into products. Its staff include Christopher Strachey, one of Britain's computing pioneers, and his assistant John Francis — 25 years old, who left Cambridge without finishing a degree.
Francis is studying a method by Heinz Rutishauser for finding eigenvalues by repeatedly factoring a matrix into triangular pieces. It is elegant and unstable. Francis replaces the triangular factorisation with an orthogonal one, adds a clever way of choosing shifts, and in two papers in The Computer Journal in 1961–62 describes what he calls the QR transformation. In the Soviet Union, Vera Kublanovskaya discovers the same idea independently in 1961.
Then Francis leaves numerical analysis for good. Over the following decades his algorithm becomes the way every computer computes eigenvalues; in 2000 it is named one of the ten algorithms with the greatest influence on science and engineering in the twentieth century.
In 2007 Gene Golub and Frank Uhlig tracked him down, retired in Hove on the south coast of England. He had had no idea.
Two matrices and are similar: they represent the same linear map in different coordinates and have the same eigenvalues. Every practical eigenvalue algorithm applies similarity transforms until the eigenvalues can simply be read off — from the diagonal of a triangular matrix (or a diagonal one, if is symmetric). For stability the transforms should be orthogonal, , so that rounding errors are never amplified (lesson 5-2).
💡The QR iteration
Starting from :
Since , we have : a similarity transform, so the eigenvalues never change. Remarkably, under mild conditions converges to upper-triangular form with the eigenvalues on the diagonal in decreasing order of magnitude. The subdiagonal entry shrinks like — the QR iteration is secretly the power method applied to a whole set of vectors at once, kept orthogonal by the factorisation.
Derivation
Why QR iteration is the power method in disguise
Collect the orthogonal factors: and . Two facts follow by induction.
The iterates are seen in rotating coordinates. Each step is , so after steps , that is .
The accumulated factors are a QR factorisation of . It holds for . If , then
Read the first column of : since is upper triangular, is a multiple of the first column of . That column is exactly the power method started from , so it turns towards the dominant eigenvector, and the first column of approaches . The first two columns of span applied to — the power method on a plane, which settles on the plane of the two dominant eigenvectors — and so on down the matrix. The subdiagonal entry measures how far the -th subspace still is from settling, which happens at the rate .
📐Watching it converge
For a symmetric tridiagonal matrix with eigenvalues , the off-diagonal part shrinks from after one step to after 10, after 20 and after 40. The smallest eigenvalue appears first — it is already correct to eight digits after five steps, because its ratio is small — while the top pair, with ratio , takes longest.
Plain QR iteration is too slow and too expensive — per step, many steps. Three refinements make it the algorithm inside every library:
- Hessenberg reduction. First transform by Householder reflections (similarity, once) to upper Hessenberg form — zeros below the first subdiagonal. QR iteration preserves this form, and each step now costs only . For symmetric the Hessenberg form is tridiagonal, and a step costs .
- Shifts. Iterate on , with an estimate of the bottom eigenvalue (the Wilkinson shift, from the bottom block). The last subdiagonal entry then converges quadratically, cubically for symmetric matrices — the QR algorithm has absorbed Rayleigh quotient iteration.
- Deflation. As soon as the last subdiagonal entry is negligible, its diagonal entry is an eigenvalue: cut it off and continue on the smaller matrix.
On a random symmetric matrix, shifted QR with deflation finds all eight eigenvalues in 16 iterations — two per eigenvalue. Francis's final touch, the implicit double shift, handles complex-conjugate pairs of real nonsymmetric matrices without complex arithmetic.
Derivation
A shifted step is still a similarity transform
From we get . Substitute into the next iterate:
Subtracting the shift before factorising and adding it back afterwards changes nothing about the eigenvalues — only how fast they appear. Shifting by makes the bottom eigenvalue of tiny, so the ratio that governs the last subdiagonal entry is tiny too.
Simplicity is prerequisite for reliability.
⚠eig or eigh?
numpy.linalg.eigh (and scipy.linalg.eigh) is for symmetric (Hermitian) matrices: it reduces to tridiagonal form, returns real eigenvalues in ascending order and orthonormal eigenvectors, and is several times faster and more accurate. numpy.linalg.eig is for general matrices: eigenvalues may be complex, eigenvectors need not be orthogonal, and they come in no particular order. A state matrix is not symmetric even when , and are — use eig, and read the natural frequency and damping ratio off each complex pair. Calling eigh on a nonsymmetric matrix silently uses only one triangle and returns wrong answers.Derivation
The state matrix, and reading frequency and damping from an eigenvalue
First-order form. A damped structure obeys . Take positions and velocities together as the state, . Its derivative is , and the equation of motion gives :
The identity block in the top right has no partner in the bottom left: the matrix is not symmetric.
One mode. For a single damped oscillator, , the eigenvalues solve :
Its size is , so , and the real part over the size gives the damping ratio, . For : rad/s ( Hz) and .
💡Where you will use this
Control Systems and Attitude Control: closed-loop poles of state-space models, computed by
eig — QR underneath. Rocket Propulsion and Aircraft Engines: stability of linearised dynamics (pogo, combustion, rotor whirl). Structures: dense eigenproblems of reduced models after component mode synthesis. Every course: whenever a library returns eigenvalues of a dense matrix, Francis's algorithm computed them.📚Further reading
- Lloyd N. Trefethen and David Bau, Numerical Linear Algebra (SIAM, 1997), Lectures 25–29 — Hessenberg reduction and the QR algorithm without and with shifts.
- David Watkins, 'The QR algorithm revisited', SIAM Review 50(1), 133–145 (2008) — why it works, explained through subspace iteration.
- Gene Golub and Frank Uhlig, 'The QR algorithm: 50 years later — its genesis by John Francis and Vera Kublanovskaya and subsequent developments', IMA Journal of Numerical Analysis 29(3), 467–485 (2009) — the story of the cold open.
↓But there is a problem
We can now find every eigenvalue of any matrix. For a structure, though, the stiffness matrix is only half the story. A building does not vibrate according to alone — floors are heavy, columns are light, and the mass is distributed unevenly. The right equation is , with a mass matrix on the right-hand side.
On 10 June 2000, thousands of people walked across London's new Millennium Bridge on its opening day. Within minutes the deck was swaying sideways so much that people had to stop and hold the handrails. The bridge was closed two days later — for nearly two years.