Proofs: QR algorithm
These are the human proofs of QR algorithm, at full length.
The Hessenberg QR algorithm terminates and returns a Schur form of a nearby matrix full
This proof shows: correctness, termination.
Notation of the page. Indices are 1-based. The steps of lines L8 and L9 are analysed in exact arithmetic; the rounding errors of a computed rotation are of order relative to the rows and columns it touches, and their accumulation into a backward error is the classical analysis of Wilkinson (1965, Chapter 3 and Chapter 8) and GVL Section 5.1 and Section 7.5, which we do not repeat. What we prove is that the structure is kept, that the deflations perturb by a bounded amount, that the loop terminates, that a CONVERGED result is a Schur form, and why the shifts give fast local convergence.
Lemma 1 (one step keeps Hessenberg form). Let be an unreduced upper Hessenberg matrix and a scalar. Let be the rotations of line L8, where acts in the plane and is chosen so that is upper triangular. Then is upper Hessenberg, and it equals with unitary.
Proof. Induction on the left rotations: before is applied, rows are already triangular and the only nonzero entry below the diagonal in column is the original (rows and have zeros in columns , by the previous rotation and by the Hessenberg form). So can zero it, which is how it is chosen, and it does not touch columns . After all left rotations, is upper triangular. For the right rotations, multiplying a matrix whose column has nonzeros only in rows by on the right mixes columns and , so it creates a nonzero only in position . Applying in order fills exactly the first subdiagonal, so is Hessenberg. Finally .
Lemma 1 also shows that restricting the left rotations to columns and the right rotations to rows (line L9 uses , which only adds zeros) computes the full products exactly.
Lemma 2 (the invariant). At every execution of line L3, is unitary, is upper Hessenberg, for every row at which an entry was set to zero, for all , and
where are the values that line L4 replaced by zero.
Proof. After line L1, with (Hessenberg reduction is a unitary similarity). Line L4 replaces by , which changes by , a matrix of 2-norm ; this adds a term to and keeps the Hessenberg form. A step of lines L8 and L9 acts on rows and columns only, by the unitary . Because and , is block upper triangular with the window as its middle diagonal block, so is block upper triangular with the same outer diagonal blocks, its middle block is , which is Hessenberg by Lemma 1, and the zero blocks below the diagonal stay zero. Replacing by keeps and the unitarity of . The zero entries outside the current window lie in a row or a column the step does not touch.
Lemma 3 (the size of the deflation perturbation). Each zeroed value satisfies , at most values are nonzero, and so , which gives when is small. If both diagonal entries are zero, the implementation uses the threshold , where is the Hessenberg matrix of line L1, and the same bound holds.
Proof. The first inequality is the test of line L4, and . By Lemma 2, an entry that has been set to zero is never changed again, so each of the subdiagonal positions contributes at most once a nonzero . Since is unitarily similar to , .
Theorem 4 (termination). For every input, the loop of line L3 ends after at most passes.
Proof. Each pass through the loop body either executes line L5, which lowers by one and resets to 0, or reaches line L6, which raises by one and returns once . So the pair decreases in the lexicographic order at each pass, takes at most values, and for each value of at most passes raise .
Theorem 5 (a CONVERGED result is a Schur form). If line L10 returns, then is upper triangular, is unitary, and with as in Lemmas 2 and 3. In particular the diagonal entries of are the eigenvalues of .
Proof. Line L10 is reached with . The value of only decreases at line L5, when , and that happens only when line L4 has found , that is, set . So every subdiagonal entry for has been set to zero, and by Lemma 2 it has stayed zero. A Hessenberg matrix with zero subdiagonal is upper triangular.
Proposition 6 (unshifted QR is subspace iteration). With at every step and no deflation, let , and . Put and . Then and . With shifts , the same argument gives .
Proof. , which gives the first claim by induction. For the second, , using the first claim in the form . The shifted case is the same computation with in place of at step .
So the first columns of are an orthonormal basis of applied to , which is subspace iteration. If and the start subspace is not deficient, the subspace converges to the invariant subspace of the largest eigenvalues at the rate (GVL Section 7.3), and the block , which is the single entry for a Hessenberg matrix, goes to zero at that rate.
Proposition 7 (shifted QR is inverse iteration on the last column). If is nonsingular, then .
Proof. , and is lower triangular with last diagonal entry , so .
The new last row of is , and its diagonal entry is the Rayleigh quotient of . With the Rayleigh shift the step is therefore one step of Rayleigh quotient iteration for from , which explains the quadratic and, for Hermitian , cubic local rates.
Proposition 8 (the exact step). Let with and . Then one step gives .
Proof. Let and . The rotation of line L8 has and with (for , and ). Its second row applied to the columns of gives the second row of as . Applying the right rotation of line L9, the new entry is , of modulus . Adding back changes only the diagonal.
So if the next subdiagonal entry is , and if , as for a Hermitian , it is . For a larger Hessenberg matrix, GVL Section 7.5.3 derives the same quadratic behaviour of with the Rayleigh shift, under the assumption that the trailing entries have settled.
Remark (no global theorem). Propositions 6 to 8 are local statements. The cyclic permutation matrix is a fixed point of the step with , the Rayleigh shift and the Wilkinson shift, so no global convergence theorem holds for these shifts on general matrices; exceptional shifts break this example but are not known to give a provable bound. For symmetric tridiagonal matrices with the Wilkinson shift, Wilkinson (1968) proved convergence for every input.