SOR is a splitting iteration whose limit solves A x = b, and it converges for symmetric positive definite A exactly when 0 < omega < 2 full
This proof shows: correctness, termination.
Write A=D−E−F with D the diagonal of A, −E its strictly lower part and −F its strictly upper part, and assume aii=0 for all i and ω=0. Let xk be the vector after k sweeps and ek=xk−x with Ax=b.
Termination. The outer loop runs at most maxiter times and each sweep is a fixed number of operations, so the algorithm stops. It returns converged = true only when the test at line L6 holds.
Lemma 1 (the sweep is a splitting). One sweep, lines L3 to L5, maps xk to
xk+1=xk+Mω−1(b−Axk),Mω=ω1D−E. Proof. When line L5 runs for row i, the entries xj with j<i are already new and those with j>i are old, so it states
aiixk+1,i=(1−ω)aiixk,i+ω(bi−j<i∑aijxk+1,j−j>i∑aijxk,j). In matrix form this is Dxk+1=(1−ω)Dxk+ω(b+Exk+1+Fxk), that is (D−ωE)xk+1=((1−ω)D+ωF)xk+ωb. Dividing by ω gives Mωxk+1=(Mω−A)xk+b, since Mω−A=ω1−ωD+F. Mω is lower triangular with nonzero diagonal, so it is invertible. □
Lemma 2 (fixed point). x is a fixed point of the sweep, and ek+1=Gωek with Gω=I−Mω−1A=(D−ωE)−1((1−ω)D+ωF). If the iterates converge to some y, then Ay=b.
Proof. b−Ax=0, so Lemma 1 maps x to itself; subtracting the two relations gives ek+1=(I−Mω−1A)ek. If xk→y, passing to the limit in Lemma 1 gives Mω−1(b−Ay)=0, and Mω is invertible. □
So ek=Gωke0, and by the facts on the spectral radius page the iteration converges for every x0 if and only if ρ(Gω)<1. The residual test at line L6 is then met after finitely many sweeps for every tol above the rounding level.
Lemma 3 (Kahan's bound). ρ(Gω)≥∣ω−1∣. Hence SOR fails to converge for some x0 when ω≤0 or ω≥2.
Proof. D−ωE is lower triangular with diagonal D, and (1−ω)D+ωF is upper triangular with diagonal (1−ω)D. So detGω=det((1−ω)D)/detD=(1−ω)n. The determinant is the product of the n eigenvalues, so at least one has modulus at least ∣1−ω∣. □
Lemma 4 (Ostrowski-Reich). If A is symmetric positive definite and 0<ω<2, then ρ(Gω)<1.
Proof. Here F=ET and D has positive diagonal. Let Gωv=λv with v=0 in Cn. Then (Mω−A)v=λMωv, so Av=(1−λ)Mωv. Since A is nonsingular, λ=1. Put α=v∗Av>0 and δ=v∗Dv>0. From v∗Mωv=α/(1−λ) and its conjugate v∗MωTv=α/(1−λˉ),
α(1−λ1+1−λˉ1)=v∗(Mω+MωT)v=v∗(ω2D−E−ET)v=α+(ω2−1)δ. The left side is α⋅2Re1−λ1, and 2Re1−λ1−1=∣1−λ∣21−∣λ∣2. So
∣1−λ∣21−∣λ∣2=(ω2−1)αδ>0 for 0<ω<2, which gives ∣λ∣<1. □
Conclusion. The algorithm always stops. If it reports convergence, the returned xk satisfies ∥b−Axk∥2≤tol∥b∥2, and therefore ∥xk−x∥/∥x∥≤κ(A)tol in the 2-norm. For symmetric positive definite A and 0<ω<2 the iterates converge to x in exact arithmetic for every x0 (Lemmas 2 and 4), and for ω outside (0,2) they do not converge for every x0 (Lemma 3). ■
About floating point. These statements are about exact arithmetic. In floating point the iterates do not converge but settle at a level set by rounding; the computed residual cannot be pushed below a modest multiple of u∥A∥∥x∥. The tests observe this level for the model problem; Higham, Chapter 17, gives forward and backward error bounds for stationary iterations that depend on Gω and on ∣Mω−1∣(∣Mω∣+∣Mω−A∣).