LU Decomposition

Work in progress. This note is still being written and incomplete.

3 min read Last updated Mon Aug 10 2026 06:34:55 GMT+0000 (Coordinated Universal Time)

The process of factorizing a square matrix into 2 triangular matrices: a lower triangular matrix (LL) and an upper triangular matrix (UU). Introduced by Alan Turing in 1948.

A=LUA = LU

Finding LL and UU Without Pivoting

Using Gaussian Elimination

Can be used when Gaussian elimination can be performed on Ax=bA\vec{x} = \vec{b} without row interchanges, AA factors as A=LUA = LU, where

mji=aji(i)aii(i)m_{ji} = \frac{a_{ji}^{(i)}}{a_{ii}^{(i)}}

is the multiplier used to eliminate entry (j,i)(j, i) at step ii, UU is the row-echelon form produced by elimination, and LL collects the multipliers:

U=(a11(1)a12(1)a1n(1)0a22(2)a2n(2)0ann(n))  and  L=(100m2110mn1mn,n11)U = \begin{pmatrix} a_{11}^{(1)} & a_{12}^{(1)} & \cdots & a_{1n}^{(1)} \\ 0 & a_{22}^{(2)} & \cdots & a_{2n}^{(2)} \\ \vdots & \vdots & \ddots & \vdots \\ 0 & \cdots & \cdots & a_{nn}^{(n)} \end{pmatrix} \; \text{and} \; L = \begin{pmatrix} 1 & 0 & \cdots & 0 \\ m_{21} & 1 & \cdots & \vdots \\ \vdots & \vdots & \ddots & 0 \\ m_{n1} & \cdots & m_{n,n-1} & 1 \end{pmatrix}

LL and UU are produced together in 1 pass of elimination.

  • For i=1,,n1i = 1, \ldots, n-1, use row ii as the pivot row.
  • For each row j>ij > i, compute mji=aji(i)/aii(i)m_{ji} = a_{ji}^{(i)} / a_{ii}^{(i)}.
  • Eliminate ajia_{ji} with rowjrowjmjirowi\text{row}_j \leftarrow \text{row}_j - m_{ji} \cdot \text{row}_i.
  • Place mjim_{ji} at position (j,i)(j, i) of LL.

UU is the result of elimination. LL is the record of multipliers used to produce it.

Direct Computation Method

LL and UU can also be computed directly by equating entries of AA with entries of the product LULU.

  • For i=1,,ni = 1, \ldots, n, set lii=1l_{ii} = 1 or uii=1u_{ii} = 1.
  • Compute l11u11=a11l_{11} u_{11} = a_{11}.
  • For j=2,,nj = 2, \ldots, n, compute
u1j=a1jl11,lj1=aj1u11u_{1j} = \frac{a_{1j}}{l_{11}}, \quad l_{j1} = \frac{a_{j1}}{u_{11}}
  • For i=2,,n1i = 2, \ldots, n-1:
    • Compute liiuii=aiik=1i1likukil_{ii} u_{ii} = a_{ii} - \sum_{k=1}^{i-1} l_{ik} u_{ki}.
      • aiia_{ii}
        Diagonal entry of AA at row ii.
      • k=1i1likuki\sum_{k=1}^{i-1} l_{ik} u_{ki}
        Contribution already accounted for by the first i1i-1 rows and columns of LL and UU.
      • liiuiil_{ii} u_{ii}
        Remainder left for the diagonal entries of LL and UU at step ii, split by the fixed value from step 1.
    • For j=i+1,,nj = i+1, \ldots, n, compute
uij=1lii[aijk=1i1likukj],lji=1uii[ajik=1i1ljkuki]u_{ij} = \frac{1}{l_{ii}} \left[ a_{ij} - \sum_{k=1}^{i-1} l_{ik} u_{kj} \right], \quad l_{ji} = \frac{1}{u_{ii}} \left[ a_{ji} - \sum_{k=1}^{i-1} l_{jk} u_{ki} \right]

Pivoting

LU decomposition can fail when the top-left entry of AA is 00 or small compared to other entries.

Pivoting rearranges the rows and/or columns of AA to place a larger element in the top-left position, mitigating this. Multiple pivoting algorithms exist.

Applications

  • Solving Ax=bA\vec{x} = \vec{b}, used for finding current in a circuit and solving discrete dynamical systems.
  • Finding the inverse of a matrix.
  • Finding the determinant of a matrix.

Applicable whenever a problem can be modeled in matrix form, since triangular matrices are easy to compute with.

Solving Ax=bA\vec{x} = \vec{b}

Suppose A=LUA = LU and Ax=LUx=bA\vec{x} = LU\vec{x} = \vec{b} must be solved.

  • Set w=Ux\vec{w} = U\vec{x}.
  • Solve Lw=bL\vec{w} = \vec{b} for w\vec{w} by forward substitution, since LL is lower triangular.
  • Solve Ux=wU\vec{x} = \vec{w} for x\vec{x} by back substitution, since UU is upper triangular. This x\vec{x} solves the original system.

This uses LL to perform row operations on UU to solve the system.

Was this helpful?