Proofs: QZ algorithm
These are the human proofs of QZ algorithm, at full length.
The QZ algorithm keeps an exact unitary equivalence, preserves the Hessenberg-triangular structure, and terminates with a generalized Schur form full
This proof shows: correctness, termination.
Exact arithmetic, except that the entries set to zero by the tests of lines L4 and L6 are tracked as perturbations. Notation of the page: , , , are the working matrices, indices run from to , , and a rotation is with real and , acting on two rows (from the left) or two columns (from the right). The quadratic convergence of the shifted iteration is not proved here; see the remark at the end.
Lemma 1 (rotations). For any , givens(f, g) returns a unitary with . Consequently: (a) a row rotation of rows built from zeroes ; (b) a column rotation of columns with the matrix built from givens(y, x), where , maps that row pair to .
Proof. If , . If , , and . Otherwise, with and , and ; then , so , and the second component is , using . For (b), the new entry in column is , which is the second component of , hence zero.
Lemma 2 (the invariant). Let , , at the start. After any sequence of the operations of the algorithm, and are unitary and , , where and collect the entries of and of that lines L4 and L6 set to zero, with the values of at that moment. Hence and .
Proof. Induction on the operations. A row rotation replaces by ; then , and is unitary. A column rotation replaces by , and . The assignments to zero of entries that the rotation has just made zero (lines L1, L7, L9, L10) change nothing in exact arithmetic. Setting to zero replaces by , which extends by one term; likewise for . Each term is times a matrix of Frobenius norm times , and unitary factors preserve the Frobenius norm, so the triangle inequality gives the bounds.
Lemma 3 (Hessenberg-triangular reduction). After line L1, is upper triangular and is upper Hessenberg.
Proof. Phase 1 processes columns and, for , rotates rows to zero (Lemma 1a). Rows have zeros in every column already, so these zeros stay; entries with were zeroed before and are not touched. So at the end is upper triangular. Phase 2 processes columns and, for : (i) rotates rows to zero ; in columns both rows are zero (rows , and those columns are already Hessenberg), so they stay zero; in , row is zero before column and row before column , so the only new nonzero is . (ii) Rotates columns to zero (Lemma 1b); rows below of are zero in both columns, so is upper triangular again; in the columns are not yet processed and column is untouched, so and all earlier zeros of stay. At the end is upper Hessenberg.
Lemma 4 (the window). Suppose is Hessenberg, triangular, (or ) and (or ). Then any rotation of two rows or two columns with indices in leaves , and every entry of and in rows and columns unchanged and zero.
Proof. A row rotation in changes only rows in ; in columns these rows of and are zero (Hessenberg with , and triangular), and a rotation of two zeros gives zeros. A column rotation in changes only columns in ; in rows these columns are zero, by and the structure.
Lemma 5 (the QZ step keeps the structure). If before line L9 is Hessenberg, is triangular with nonzero diagonal on , and , (where they exist), then after line L10 the same holds, with the same zero subdiagonal entries outside .
Proof. By Lemma 4 the entries outside the window keep their zeros. Line L9 rotates rows . In both rows are zero before column (), so stays Hessenberg; in the only new nonzero is . We claim: before iteration of line L10, is Hessenberg and is triangular except for the entry . This holds for . In iteration , the column rotation of columns zeroes (Lemma 1b); the rows below of are zero in both columns, so is triangular. In , the rows below are zero in both columns, so the only possible new nonzero is , and only if (otherwise and stays zero). If , the row rotation of rows zeroes (Lemma 1a); in columns both rows of are zero, so is Hessenberg again; in , both rows are zero in columns (because was just zeroed), so the only new nonzero is . This is the claim for . After the last iteration , is triangular and Hessenberg.
Lemma 6 (deflation of an infinite eigenvalue). If at line L7 for some , then after the chase and the final rotation of rows , is Hessenberg, is triangular, and .
Proof. We show by downward induction on that is Hessenberg, triangular and . For this is the hypothesis. Going from to : the column rotation of columns maps to (Lemma 1b). Row of is zero in both columns ( and ), and so are all rows below; so stays triangular, stays , and now . In , the only possible new nonzero is , when . Then the row rotation of rows zeroes it (Lemma 1a); in columns both rows of are zero, so is Hessenberg; in , both rows are zero in columns (as ), so stays triangular. At , the rotation of rows zeroes (Lemma 1a). In , both rows are zero before column , so stays Hessenberg; in , both rows are zero in column (, ) and before it, so stays triangular and stays .
Theorem 7 (correctness and termination). The algorithm terminates. When it returns with converged true, and are upper triangular, and are unitary, and , with and , where are the intermediate matrices, so . The generalized eigenvalues of the pencil are the pairs .
Proof. Structure. Lemma 3 gives the structure after line L1. Lines L4 and L6 only set entries to zero, which keeps it. Lemma 6 keeps it at line L7, and Lemma 5 at lines L9 and L10, whose hypotheses hold because line L7 is reached only after all , , have been tested, and line L9 only when they are all nonzero.
Zero subdiagonal entries stay zero. All rotations act on indices inside a window bounded by zero subdiagonal entries or the ends, so by Lemma 4 a zero is never changed again. Inside the window all subdiagonal entries are nonzero by the choice of .
Termination. Let be the number of nonzero entries with , and consider . Line L4 does not increase . Line L5 decreases by one, and the entry it drops is zero, so drops by one. Line L7 makes the nonzero zero (it is nonzero by the choice of , and because ), so and drop by one. A QZ step leaves unchanged and increases the step counter, which is capped. So the number of passes through the loop is at most plus the cap, and each pass is finite.
Triangular result. If the loop ends with converged true, then , and was decreased from each value only when ; these zeros persist, so is upper triangular. is upper triangular by the structure argument.
Backward error. By Lemma 2, . Each subdiagonal position is set to zero at most once (it stays zero afterwards and the test only acts on nonzero entries), so there are at most terms, and each satisfies , or when both diagonal entries are zero. Each diagonal entry of set to zero satisfies , and the test of line L6 is applied to at most entries in each pass that leads to line L7; by the termination argument there are at most such passes, so at most terms. Finally by unitary invariance, which gives the first-order bound. The last statement holds because .
Remark (what is cited, not proved). That one QZ step equals one step of the shifted QR algorithm on and on (when is nonsingular) follows from the implicit Q theorem; see GVL Section 7.7 and Watkins and Elsner (1994). It gives the quadratic local convergence of for a simple eigenvalue with the shift of line L8; the tests measure it. There is no proof that every pencil converges within the cap, which is why the implementation reports converged. Backward stability in floating point, and including rounding, is due to Moler and Stewart (1973); the tests observe it.