On this page
Computing eigenvalues by solving det(A − λI) = 0 works for a 2×2 in an exam, but not for a 500×500 matrix. The method computers actually use is the QR algorithm. It is on the "Top Ten Algorithms of the Century" list that Jack Dongarra and Francis Sullivan compiled for Computing in Science & Engineering in 2000. SIAM News's report on that list credits J.G.F. Francis of Ferranti Ltd., London (1959–61), and says that by the mid-1960s the QR algorithm "had turned once-formidable eigenvalue problems into routine calculations". Francis published it in The Computer Journal in 1961; Vera Kublanovskaya developed it independently in the same years.
It is still the idea behind standard software. NumPy's eig function is implemented using the LAPACK _geev routines, and the LAPACK Users' Guide describes how LAPACK handles a general matrix: reduce it to Hessenberg form, then to Schur form, the triangular form the QR iterations converge to.
What is the QR algorithm?
The whole method fits in four lines:
Start with A₀ = A.
Factor Aₖ = QₖRₖ, where Q is orthogonal (QᵀQ = I) and R is upper triangular.
Multiply the factors in the other order: Aₖ₊₁ = RₖQₖ.
Repeat until the entries below the diagonal are negligible, then read the eigenvalues off the diagonal.
Step 2 is the QR decomposition you may already know. You can build Q column by column with Gram–Schmidt orthogonalisation, or more stably with Householder reflections, worked by hand here.
Why does RQ have the same eigenvalues as A?
From A = QR you get R = QᵀA. Substitute into RQ:
RQ = QᵀAQ = Q⁻¹AQ.
So each new matrix is a similarity transform of the old one, and all the Aₖ are similar and therefore share the same eigenvalues. Because the transforms are orthogonal, the method is numerically stable on a computer. Only the matrix changes, getting closer to triangular, where the eigenvalues sit on the diagonal.
A worked 2×2 example
Take A = [2 1; 1 2] (rows split by the semicolon). Its eigenvalues are 3 and 1; if you want to check that by hand first, see eigenvalues of a 2×2 matrix and what they mean.
Step 1. The first column is (2, 1), with length √5, so q₁ = (2, 1)/√5. Then r₁₂ = q₁ · (1, 2) = 4/√5. Subtract: (1, 2) − (4/5)(2, 1) = (−3/5, 6/5), with length 3/√5, so q₂ = (−1, 2)/√5. That gives
Q = (1/√5)[2 −1; 1 2]
R = [√5 4/√5; 0 3/√5]
A₁ = RQ = [2.8 0.6; 0.6 1.2]
Trace 4 and determinant 3.36 − 0.36 = 3: unchanged, as the callout promised.
Further steps. Repeating the same arithmetic:
A₂ = [2.9756 0.2195; 0.2195 1.0244]
A₃ = [2.9973 0.0740; 0.0740 1.0027]
A₄ = [2.9997 0.0247; 0.0247 1.0003]
The diagonal walks towards 3 and 1, and the off-diagonal entry goes 0.6, 0.22, 0.074, 0.025: in this example it shrinks by about a third each step, which is the ratio of the two eigenvalues, 1/3. With eigenvalues closer together, say 3 and 2.9, the shrinking would be far slower.
How do shifts make the QR algorithm faster?
The rate of convergence depends on the separation between eigenvalues, so a practical algorithm uses shifts. Pick a number μ close to an eigenvalue, factor Aₖ − μI = QR, then set Aₖ₊₁ = RQ + μI. This is still QᵀAₖQ, so the eigenvalues are still safe.
The simple choice μ = the bottom-right entry gives quadratic convergence, according to the same page; for a symmetric matrix like this one it is faster still. Try it from A₁ with μ = 1.2. The off-diagonal entry drops from 0.6 to 0.074 in one step, then to about 0.0001, then to about 2.6 × 10⁻¹³. Plain steps, shrinking by a third each time, would need about 26 steps to get that small. The hero chart above plots both runs.
One warning from the same example: on the original A, μ = 2 gives A − 2I = [0 1; 1 0], and one QR step hands back A unchanged. Practical codes use better shifts, such as Wilkinson's shift, partly to avoid stalls like this.
Why is it the standard method in practice?
Three ideas turn the four-line loop into the routine inside numerical libraries:
Hessenberg form first. A plain QR step on a full n×n matrix costs O(n³) operations. After a one-time reduction to Hessenberg form, each step costs only O(n²), and QR steps keep that form.
Shifts. With the bottom-right shift, the same page notes that O(1) iterations per eigenvalue are enough.
Deflation. Once the bottom off-diagonal entry is negligible, the bottom diagonal entry is an eigenvalue. Drop that row and column and carry on with a smaller matrix.
If similarity transforms or orthogonal matrices still feel shaky, the Fermi Concept Library has a lesson for each mathematics concept and shows its place in the map. For more practice, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



