LU Decomposition: A = LU
Problem
Decompose A = [[2,1],[6,4]] as A = LU with L lower triangular (1s on diagonal) and U upper triangular. Verify the product.
Explanation
What is LU decomposition?
An matrix is LU decomposed if it can be written as
where is lower triangular with ones on the diagonal and is upper triangular. The decomposition encodes the Gaussian elimination steps: is the reduced (upper triangular) matrix, and records the multipliers used to create zeros.
Step-by-step
Step 1 — Identify the first pivot. , so 's first row is simply 's first row: .
Step 2 — Compute the multiplier to zero out .
So row operation: gives . Therefore the second row of is .
Step 3 — Assemble and .
stores multipliers below the diagonal (in this case, just ); is the row-reduced form.
Verification: ?
- Entry (1,1): ✓
- Entry (1,2): ✓
- Entry (2,1): ✓
- Entry (2,2): ✓
✓
Why LU is useful
Once you have :
- Solving becomes two triangular systems:
- Solve by forward substitution.
- Solve by back substitution. Each is once you have .
- Reusable: for many different right-hand sides , you factor once () and solve each system in .
- Determinant: — just multiply diagonal entries of .
When LU doesn't exist
If a pivot turns out to be zero mid-elimination, pure LU breaks down. The fix: PA = LU — pivoted LU, where is a permutation matrix that reorders rows to avoid zero pivots. Most software uses this form (e.g. NumPy's scipy.linalg.lu).
Common mistakes
- Forgetting the 1s on 's diagonal. They're part of the definition; they make unit lower triangular.
- Signs on multipliers. is positive if the row operation subtracts ; many texts use the opposite sign convention.
- Skipping pivoting when needed. If a zero pivot appears, plain LU fails — use partial pivoting.
Try it in the visualization
The elimination animates: the first row stays fixed, the second row is updated, and the multiplier is pulled out into 's (2,1) position. At the end, and are multiplied back together to confirm .
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.