LUP-SOLVE solves A x = b, and its result has a componentwise backward error of at most γ_3n P^T |L||U| full
This proof shows: correctness, termination.
A is a nonsingular n×n matrix with PA=LU, L unit lower triangular, U upper triangular with nonzero diagonal, and row i of PA equal to row πi of A, so (Pb)i=bπi. The algorithm stops, because each loop has a fixed length.
Exact arithmetic
Claim 1. After the loop of line L1, Ly=Pb.
Proof. By induction on i we show: after iteration i, the first i equations of Ly=Pb hold, that is ∑j≤klkjyj=bπk for k≤i, and y1,…,yi do not change later. The case i=0 is empty. In iteration i, line L2 sets yi=bπi−∑j<ilijyj, which is equation i because lii=1, and it writes no other entry. □
Claim 2. After the loop of line L3, Ux=y.
Proof. By induction on the number n−i+1 of passes: after the pass for i, equations k=i,…,n of Ux=y hold, that is ∑j≥kukjxj=yk. In the pass for i, the values xi+1,…,xn are fixed, and line L4 sets xi=(yi−∑j>iuijxj)/uii, which is defined because uii=0 and is exactly equation i. □
Theorem. LUP-SOLVE returns the solution of Ax=b.
Proof. By the claims, PAx=LUx=Ly=Pb. P is a permutation matrix, so it is invertible, and Ax=b. Since A is nonsingular, this x is the unique solution. ■
Floating point
Assume the standard model, ∣δ∣≤u for each operation, and 3nu<1. Let L^, U^ be the factors computed by the LUP decomposition, with the permutation P that it chose, so that
L^U^=PA+ΔA1,∣ΔA1∣≤γn∣L^∣∣U^∣(1) (Higham, Theorem 9.3; the proof is on the page of LUP decomposition).
Step 1: the substitutions. Line L2 evaluates yi=c−∑j<iajbj with c=bπi; line L4 evaluates the same kind of expression and divides it by uii. By Higham, Lemma 8.4, the computed value of (c−∑j=1k−1ajbj)/bk satisfies bky^(1+θk)=c−∑j=1k−1ajbj(1+θj) with each ∣θj∣≤γk, in any order of the sum. Moving each factor 1+θ onto the matrix entry gives, for the whole forward and back substitution,
(L^+ΔL)y^=Pb,∣ΔL∣≤γn∣L^∣,(U^+ΔU)x^=y^,∣ΔU∣≤γn∣U^∣.(2) This is Higham, Theorem 8.5. The permutation of b is exact.
Step 2: combine. From (2),
Pb=(L^+ΔL)(U^+ΔU)x^=(L^U^+ΔLU^+L^ΔU+ΔLΔU)x^. Insert (1): Pb=(PA+E)x^ with E=ΔA1+ΔLU^+L^ΔU+ΔLΔU. Each term is bounded entry by entry:
∣E∣≤γn∣L^∣∣U^∣+γn∣L^∣∣U^∣+γn∣L^∣∣U^∣+γn2∣L^∣∣U^∣=(3γn+γn2)∣L^∣∣U^∣. Step 3: the constant. For j,k≥1 with (j+k)u<1, γj+γk+γjγk≤γj+k (Higham, Lemma 3.3). With j=k=n it gives 2γn+γn2≤γ2n, and with j=2n, k=n it gives γ2n+γn≤γ3n. So 3γn+γn2=(2γn+γn2)+γn≤γ2n+γn≤γ3n.
Step 4: undo the permutation. Multiply Pb=(PA+E)x^ by PT=P−1: b=(A+ΔA)x^ with ΔA=PTE, and ∣ΔA∣=PT∣E∣≤γ3nPT∣L^∣∣U^∣, because a permutation only moves entries. ■
Residual form. The theorem says r=b−Ax^=ΔAx^, so ∣Pr∣≤γ3n∣L^∣∣U^∣∣x^∣ entry by entry. The tests of the implementation check this inequality in exact rational arithmetic for each computed solution.