LU Decomposition: Elimination You Can Reuse
GATE 2027 DA core: LU decomposition (also named in the CS/IT Engineering Mathematics syllabus)
“Gaussian elimination, written down once as A = LU, so every new right-hand side costs almost nothing.”
1.Elimination, remembered
§ 2.1.Prerequisites: row reduction from [Systems of linear equations and Gaussian elimination](/notes/linear-algebra/systems-of-linear-equations-and-gaussian-elimination).
Gaussian elimination turns A into an upper-triangular U by subtracting multiples of pivot rows. LU decomposition simply keeps a record of those multiples. Put each multiplier l_ij (the amount of row j subtracted from row i) into a lower-triangular matrix L with 1s on its diagonal. Then A = LU exactly.
Why bother? Solving Ax = b by elimination costs about (2/3)n³ operations. Once you have L and U, each new right-hand side needs only two triangular solves, about 2n² operations. In data work you often solve with the same matrix many times, so this saving matters.
Elimination subtracts l_ij × (row j) from row i. To rebuild A from U you add those multiples back, which is why the multipliers appear in L with a plus sign.
2. Worked example: factor, then solve
Pivot 2. Row 2 − 2·Row 1 and Row 3 − 4·Row 1.
Pivot 1. Row 3 − 3·Row 2.
Place each multiplier below the diagonal of the identity.
↳ Result: L = [[1,0,0],[2,1,0],[4,3,1]]det(L) = 1, so det(A) is the product of U's diagonal.
y1 = 4; y2 = 10 − 2·4 = 2; y3 = 24 − 4·4 − 3·2 = 2.
↳ Result: y = [4, 2, 2]x3 = 2/2 = 1; x2 = 2 − 1 = 1; x1 = (4 − 1 − 1)/2 = 1.
↳ Result: x = [1, 1, 1]3.When LU needs a row exchange
§ 2.3.Elimination fails when a pivot is zero. For A = [[0,1],[1,0]], the very first pivot is 0, so no LU without row exchanges exists, even though A is invertible.
The fix is to swap rows first. Collect the swaps in a permutation matrix P and factor PA = LU. Numerical libraries also swap rows to put the largest available entry in the pivot position (partial pivoting), because tiny pivots amplify rounding errors.
A clean test: LU with unit L exists and is unique when every leading principal submatrix A_1, A_2, …, A_n is invertible (each top-left k×k block has non-zero determinant).
Practice
During elimination on a 3×3 matrix you perform Row 2 − 5·Row 1. Which entry of L becomes 5?
If A = LU with U = [[3,1,2],[0,−2,4],[0,0,5]] and L unit lower-triangular, what is det(A)?
Which matrix has no LU factorization without row exchanges?
One-minute revision
“A = LU: U from elimination, L holds the multipliers (with 1s on the diagonal).”
- •Ly = b, then Ux = y
- •det(A) = product of U's diagonal
- •Zero pivot ⇒ PA = LU
- •Multipliers enter L with a plus sign
- •Invertible does not guarantee LU without pivoting
- •Reuse L, U for each new b
Primary Academic References & Exam Sources
Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.