These are the human proofs of GMRES, at full length.
Operation count of GMRES full
This proof shows: time.worst, time.restarted, space.extra, space.restarted, matvecs.worst, flops.worst.
Count flops (one addition or multiplication each) for k Arnoldi steps on an n×n matrix with z nonzeros, with the dense helpers replaced by CSR products as in the implementation.
Step j (L4 to L8). L4 is one matvec: z multiplications and at most z additions, so 2z flops. L5 performs j inner products (2n−1 flops each) and j updates w←w−hv (2n flops each): j(4n−1) flops. L6 is a norm and a scaling, 3n+O(1) flops and one square root. L7 applies j−1 rotations to a column and forms one, 6j+O(1) flops, independent of n. Total for step j: 2z+4jn+O(n+j).
Full GMRES, k steps. Summing, ∑j=1k(2z+4jn+O(n))=2kz+2k(k+1)n+O(kn)=2kz+2k2n+O(kn) flops. L9 adds k2 flops for the triangular solve and 2kn for Vky, and L1 a matvec and O(n). So the flop count is 2kz+2k2n+O(kn), the number of matvecs is k (plus one per restart for r0), and the time is O(kz+k2n).
Restarted, GMRES(m). Each cycle has at most m steps, and in step j≤m the Gram-Schmidt cost is 4jn≤4mn; so k steps in total cost at most 2kz+4kmn+O(kn) flops, which is O(kz+kmn), plus ⌈k/m⌉ extra matvecs for the restarts.
Space. The basis v1,…,vj+1 takes (j+1)n words, H and the rotations O(j2), and x, r, w another 3n. With j≤k this is Θ(kn) for k≤n (the basis is stored in full, so the bound is attained), and with j≤m it is Θ(mn). ■
GMRES minimizes the residual over the Krylov subspace and terminates full
This proof shows: correctness, termination.
Exact arithmetic throughout. Notation of the page: A nonsingular of order n, r0=b−Ax0=0, β=∥r0∥2, Kj=Kj(A,r0), Pj0 the polynomials of degree at most j with value 1 at 0. Let d be the grade of r0: the least d with Adr0∈Kd. Then dimKj=j for j≤d and d≤n.
Lemma 1 (Arnoldi). For j≤d, after step j of L4 to L6 the vectors v1,…,vj are orthonormal and span Kj, hj+1,j=0 if and only if j=d, and if j<d then vj+1 is a unit vector orthogonal to v1,…,vj with span{v1,…,vj+1}=Kj+1. In all cases Avj=∑i=1j+1hijvi (with hj+1,jvj+1 read as 0 when hj+1,j=0), that is AVj=Vj+1Hˉj.
Proof. Induction on j. For j=1, v1=r0/β spans K1. Assume the claim for v1,…,vj. Modified Gram-Schmidt in L5 subtracts from w=Avj its components along v1,…,vj one at a time; because the vi are orthonormal, the coefficient viTw computed from the partially reduced w equals viTAvj (the earlier subtractions are along vectors orthogonal to vi). So the final w=Avj−∑i≤jhijvi is orthogonal to v1,…,vj, and Avj=∑i≤jhijvi+w. Since vj∈Kj has a nonzero component along Aj−1r0 (the vi span a strictly increasing chain), Avj∈Kj+1∖Kj when dimKj+1=j+1, i.e. when j<d; then w=0, hj+1,j=∥w∥2>0 and vj+1=w/hj+1,j completes an orthonormal basis of Kj+1. When j=d, Avj∈AKd⊆Kd, so w=0. □
Lemma 2 (least squares form). For x=x0+Vjy, ∥b−Ax∥2=∥βe1−Hˉjy∥2.
Proof.b−Ax=r0−AVjy=βv1−Vj+1Hˉjy=Vj+1(βe1−Hˉjy), and Vj+1 has orthonormal columns, so it preserves the 2-norm. (If hj+1,j=0 the last row of Hˉj is zero and the same holds with Vj.) □
Lemma 3 (Givens). Let Qj=Gj⋯G1 be the product of the rotations formed in L7, each acting on two consecutive coordinates. Then QjHˉj=(Rj0) with Rj upper triangular, Qjβe1=g, and
ymin∥βe1−Hˉjy∥2=∣gj+1∣,
attained at y=Rj−1g1:j when Rj is nonsingular.
Proof. Induction on j. Assume Qj−1Hˉj−1=(Rj−10). The matrix Hˉj adds a row of zeros (except hj+1,j) and a column j with nonzeros only in rows 1,…,j+1. The rotations G1,…,Gj−1 act on rows 1,…,j, so they leave hj+1,j alone and turn the first j−1 columns into (Rj−10) padded with a zero row; this is exactly L7 applying the old rotations to column j. Then Gj, with c=hjj/ρ and s=hj+1,j/ρ, maps the pair (hjj,hj+1,j) to (ρ,0) and mixes only rows j and j+1, where the first j−1 columns are zero. So QjHˉj is upper triangular with a zero last row. Since Qj is orthogonal, ∥βe1−Hˉjy∥2=∥g−(Rj0)y∥2, whose square is ∥g1:j−Rjy∥22+gj+12. □
Lemma 4 (Rj is nonsingular). If A is nonsingular, then Hˉj has full column rank j for j≤d, so every ρ in L7 is nonzero.
Proof.AVj=Vj+1Hˉj (or VjHj when j=d); the left side has rank j because A is nonsingular and Vj has independent columns. Hence Hˉj has rank j, and so does Rj, whose diagonal entries are the values ρ. □
Theorem 1 (correctness). At the end of a cycle of j≤d steps, the x formed in L9 is the unique minimizer of ∥b−Ax∥2 over x0+Kj, and its residual norm is ∣gj+1∣. Equivalently ∥rj∥2=minp∈Pj0∥p(A)r0∥2.
Proof. Every x∈x0+Kj is x0+Vjy for a unique y (Lemma 1). By Lemmas 2 and 3 the residual is minimized exactly by y=Rj−1g1:j (Lemma 4), with value ∣gj+1∣. The polynomial form follows from {r0−Aq(A)r0:degq≤j−1}={p(A)r0:p∈Pj0}. □
Corollary (monotonicity).Kj⊆Kj+1, so within a cycle ∣gj+2∣≤∣gj+1∣; across a restart the new cycle starts from the last iterate, whose residual is the old minimum, so the residual norms never increase.
Theorem 2 (termination). If A is nonsingular, full GMRES (m=n) returns the exact solution after d≤n steps; every run returns after at most kmax Arnoldi steps.
Proof. At step d, hd+1,d=0 (Lemma 1), so L8 leaves the loop. Then Kd is A-invariant and A restricted to it is nonsingular, so A−1r0∈Kd and x0+A−1r0=A−1b lies in x0+Kd, with residual 0. By Theorem 1 the iterate formed in L9 attains the minimum, which is 0. For the step limit: each pass of L4 counts one step, the loop and the restart test in L1 stop when the count reaches kmax, and each cycle performs at least one step, so the number of cycles is at most kmax+1. ■
Remarks. (i) If A is singular, Lemma 4 fails and ρ=0 can occur; then A is singular on Kj, the code stops with BREAKDOWN, and the iterate of step j−1 is returned. (ii) The SPD bound of the page follows from Theorem 1 by choosing p as the scaled Chebyshev polynomial Tk((λmax+λmin−2λ)/(λmax−λmin))/Tk((λmax+λmin)/(λmax−λmin)), whose maximum on [λmin,λmax] is at most 2((κ−1)/(κ+1))k, and using ∥p(A)r0∥2≤maxλ∣p(λ)∣∥r0∥2 for symmetric A. (iii) The floating-point backward stability of MGS-GMRES is the theorem of Paige, Rozložník and Strakoš (2006); it is quoted, not proved, here.