When a fixed matrix is used with several forcing or measurement vectors, compute its Pivoted LU decomposition once. Collect right-hand sides into the columns of , and the corresponding solutions into . Then
Each column undergoes the same row permutation, forward substitution and back substitution. Neither , nor depends on . This is the useful separation between preparing a linear system and applying its solution procedure repeatedly. LAPACK implements it by taking previously computed factors, permuting all right-hand sides, and performing the two triangular solves.[ref]
For the unpivoted factors in Computed three-by-three LU decomposition, take
Direct matrix multiplication checks all three identities , and . The first column reproduces the previous solve; the other two use exactly the same factors. New right-hand sides can also arrive one at a time. If changes, these stored factors generally need to be recomputed.
Figure 1.
One row permutation fixes a zero pivot element; each new right-hand side reuses the same LU decomposition and two triangular solves
. Details.
Given Pivoted LU decomposition , the linear system is equivalent to . Introduce the intermediate vector : first use forward substitution to solve , then back substitution to solve . With unpivoted LU decomposition, is the identity matrix, so the first right-hand side is simply .[ref]
For the factors in Computed three-by-three LU decomposition and , forward substitution gives
Then back substitution gives
Direct matrix multiplication verifies . More generally, the back substitution recurrence is
The direction matters: the last row contains only , whereas the first row generally involves every unknown. No dense matrix inverse is needed for either triangular solve.