Aej=aj is the j-th column, eiTA the i-th row, eiTAej=Aij. Column operations act from the right, e.g. A[e1+2e3e2e3e4e5] adds twice the third column to the first in place, and row operations act from the left. (AB)T=BTAT, (AB)−1=B−1A−1.
and back substitution for upper triangular Ux=b from the last row up. A triangular matrix is singular iff some diagonal entry is 0. Cost ∑i=1n(2i−1)∼n2 flops.
LU Factorization
Adding a times row j to row i is left multiplication by the unit lower triangular elementary matrix
Lij=I+aeiejT,Lij−1=I−aeiejT
Gaussian elimination (for 4×4) gives U=L43L42L32L41L31L21A, so A=LU with L=L21−1L31−1L41−1L32−1⋯ unit lower triangular, its entries the row multipliers. To solve Ax=b:
factor LU=A,
forward substitution Lz=b,
back substitution Ux=z.
Costf=O(g) if limn→∞f(n)/g(n)<∞, f∼g if the limit is 1. A flop is one of +,−,×,÷,⋅. Using ∑k=1nkp∼p+1np+1,
j=1∑n−1(n−j)[2(n−j)+3]=k=1∑n−1k(2k+3)∼32n3
for LU, against ∼n2 per triangular solve. If the run time is t=Cnp, then logt=plogn+logC, so p is the slope on a log-log plot.
Pivoting
Not every matrix has an LU factorization (a 0 pivot), and small pivots give large multipliers and subtractive cancellation. Partial pivoting swaps the row with the largest entry in absolute value into the pivot position at each step, giving
PA=LU,A=PTLU,Ax=b⟺LUx=Pb
with all entries of L bounded by 1 in absolute value. P=ei1e1T+⋯+einenT is a permutation matrix and P−1=PT. The pivot search is O(n−k) at step k, O(n2) in total.
Matrix Structure
Strictly diagonally dominant∣Aii∣>∑j=i∣Aij∣ for all i: nonsingular, and LU exists without pivoting.
Banded Upper bandwidth bu if Aij=0 for j−i>bu, lower bandwidth bl if Aij=0 for i−j>bl, total bandwidth bu+bl+1 (bu=bl=1 is tridiagonal). Without pivoting L and U keep the bandwidths, the zeros are predictable, and LU costs O(bubln).
SymmetricAT=A. L and U are not transposes, but A=LDLT with D diagonal, and using the symmetry it costs ∼31n3 flops. In general it still needs (symmetric) pivoting.
Symmetric positive definitexTAx=∑i∑jAijxixj>0 for all x=0, all eigenvalues positive.
For SPD A=LDLT, taking x=L−Tek gives 0<xTAx=ekTDek=Dkk, so D=(D1/2)2 with D1/2 the elementwise square root, and
A=LD1/2D1/2LT=RTR,R=D1/2LT upper triangular
(Cholesky). No pivoting is needed, ∼31n3 flops.
Conditioning of Linear Systems
For vector and matrix norms, with induced norms, ∥A∥∞ the max row sum and ∥A∥1 the max column sum. Perturb Ax=b to A(x+h)=b+d. Then ∥h∥≤∥A−1∥∥d∥ and
∥d∥/∥b∥∥h∥/∥x∥≤∥A−1∥⋅∥A∥=κ(A)
The same κ(A) bounds perturbations of A, and κ(A)≥∥AA−1∥=∥I∥=1. If κ(A)=10t, about t digits are lost. The residual r=b−Ax~ is a backward error, and