Contents · Linear Algebra
Part 0 · Orientation
Part 1 · Vectors & Spaces
Part 2 · Matrices as Maps
Part 3 · Solving Systems
- Solving Ax = b: Gaussian Elimination and LU
Part 4 · Orthogonality
Part 5 · Eigenvalues
Part 6 · Singular Value Decomposition
Part 7 · Spectral & Positive Definite
Part 8 · Numerical Linear Algebra
Part 3 · Solving Systems
Solving Ax = b: Gaussian Elimination and LU
Almost every linear-algebra question that starts with a matrix ends up solving . The method is Gaussian elimination: use row operations to turn into an upper-triangular matrix , then read off the unknowns by back-substitution. The multipliers you use along the way are not waste, they assemble into a lower-triangular , so the same work also produces the factorization .
Elimination reduces to
An elementary row operation adds a multiple of one row to another; it never changes the solution set. Work down the columns. At column the pivot is the diagonal entry , and for each row below it we subtract the pivot row scaled by the multiplier
That choice of is exactly what drives the entry under the pivot to zero. After clearing every entry below every pivot, has become upper triangular:
Applying the same operations to turns the system into , which a triangular matrix solves from the bottom up:
A worked
Take the system with
so the augmented matrix is
Column 1. The pivot is . For row the multiplier is , so . For row , , so :
Column 2. The new pivot is . For row the multiplier is , so , which reaches :
Back-substitution. From the bottom row up,
giving . Step through the same numbers below: each Step performs one row operation and shows the resulting matrix, then the Solve steps run back-substitution.
Elimination is factorization
Collect the multipliers used above into a unit lower-triangular matrix, placing in position . That matrix is , and together with it reconstructs :
The reason works out this way is that each elimination step is left multiplication by a matrix that differs from the identity in a single entry, and the inverse of such a matrix just flips the sign of that entry. Multiplying those inverses back together stacks the multipliers directly into .1
The factorization is where the payoff sits. Once is known, solving splits into two triangular solves:
For this system the forward solve gives , which is exactly the transformed right-hand side from the elimination above. A second right-hand side then costs only the two triangular solves, not another elimination.
Pivots, exchanges, and cost
The whole scheme rests on nonzero pivots. If a pivot comes out zero, you cannot divide by it, and you swap in a row below that has a nonzero entry in that column: an exchange, recorded by a permutation matrix , so the factorization becomes .2 In floating point the same idea, partial pivoting, chooses the largest available pivot to keep multipliers bounded and the solve stable. If no row supplies a nonzero pivot, that column is dependent and is singular, so has either no solution or infinitely many.
The cost is dominated by the forward elimination. Clearing column touches an block, and summing those blocks gives about floating-point operations.2 Each triangular solve is only , which is why factoring once and reusing and is the right move when several right-hand sides share the same .