LU Decomposition: A = LU

April 13, 2026

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 n×nn \times n matrix AA is LU decomposed if it can be written as A=LUA = L U

where LL is lower triangular with ones on the diagonal and UU is upper triangular. The decomposition encodes the Gaussian elimination steps: UU is the reduced (upper triangular) matrix, and LL records the multipliers used to create zeros.

Step-by-step

A=(2164)A = \begin{pmatrix} 2 & 1 \\ 6 & 4 \end{pmatrix}

Step 1 — Identify the first pivot. u11=2u_{11} = 2, so UU's first row is simply AA's first row: (2,1)(2, 1).

Step 2 — Compute the multiplier to zero out a21a_{21}. 21=a21u11=62=3\ell_{21} = \dfrac{a_{21}}{u_{11}} = \dfrac{6}{2} = 3

So row operation: R2R23R1R_2 \to R_2 - 3 R_1 gives (6,4)3(2,1)=(0,1)(6, 4) - 3(2, 1) = (0, 1). Therefore the second row of UU is (0,1)(0, 1).

Step 3 — Assemble LL and UU. L=(1031),U=(2101)L = \begin{pmatrix} 1 & 0 \\ 3 & 1 \end{pmatrix}, \quad U = \begin{pmatrix} 2 & 1 \\ 0 & 1 \end{pmatrix}

LL stores multipliers below the diagonal (in this 2×22 \times 2 case, just 21=3\ell_{21} = 3); UU is the row-reduced form.

Verification: LU=ALU = A?

LU=(1031)(2101)LU = \begin{pmatrix} 1 & 0 \\ 3 & 1 \end{pmatrix} \begin{pmatrix} 2 & 1 \\ 0 & 1 \end{pmatrix}

  • Entry (1,1): 12+00=21 \cdot 2 + 0 \cdot 0 = 2
  • Entry (1,2): 11+01=11 \cdot 1 + 0 \cdot 1 = 1
  • Entry (2,1): 32+10=63 \cdot 2 + 1 \cdot 0 = 6
  • Entry (2,2): 31+11=43 \cdot 1 + 1 \cdot 1 = 4

LU=ALU = A

Why LU is useful

Once you have A=LUA = LU:

  • Solving Ax=bA \mathbf{x} = \mathbf{b} becomes two triangular systems:
    1. Solve Ly=bL \mathbf{y} = \mathbf{b} by forward substitution.
    2. Solve Ux=yU \mathbf{x} = \mathbf{y} by back substitution. Each is O(n2)O(n^2) once you have LULU.
  • Reusable: for many different right-hand sides b1,b2,\mathbf{b}_1, \mathbf{b}_2, \ldots, you factor AA once (O(n3)O(n^3)) and solve each system in O(n2)O(n^2).
  • Determinant: detA=detLdetU=uii\det A = \det L \cdot \det U = \prod u_{ii} — just multiply diagonal entries of UU.

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 PP 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 LL's diagonal. They're part of the definition; they make LL unit lower triangular.
  • Signs on multipliers. 21\ell_{21} is positive if the row operation subtracts 21R1\ell_{21} R_1; 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 21\ell_{21} is pulled out into LL's (2,1) position. At the end, LL and UU are multiplied back together to confirm LU=ALU = A.

Interactive Visualization

Parameters

2.00
1.00
6.00
4.00
5.00
14.00
Your turn

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.

Sign Up Free to Try It30 free visualizations every day
LU Decomposition: A = LU | MathSpin