LUP Decomposition

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

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

The LUP decomposition of an n×nn \times n matrix AA is the triple (L,U,P)(L, U, P) satisfying

PA=LUPA = LU

Here:

  • LL: unit lower triangular, n×nn \times n with all diagonal entries 11
  • UU: upper triangular, n×nn \times n
  • PP: permutation matrix, n×nn \times n

Properties

  • PP permutes the rows of AA, placing large entries in the pivot position to avoid dividing by a small or zero element. Same reordering as partial pivoting.
  • LUP decomposition exists for any nonsingular matrix AA.
  • LUP decomposition of AA is not unique.
  • LUP decomposition solves Ax=bA\vec{x} = \vec{b} more robustly than LU decomposition without pivoting, at approximately the same cost.

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

Multiplying Ax=bA\vec{x} = \vec{b} by PP and substituting PA=LUPA = LU gives

PAx=Pb    LUx=PbPA\vec{x} = P\vec{b} \implies LU\vec{x} = P\vec{b}
  • Solve Ly=PbL\vec{y} = P\vec{b} for y\vec{y} by forward substitution.
  • Solve Ux=yU\vec{x} = \vec{y} for x\vec{x} by back substitution.

Recursive Leading-Row-Column Algorithm

Recursively constructs LL, UU, PP so that PA=LUPA = LU.

Block Matrix Notation

An n×nn \times n matrix can be partitioned into a 2×22 \times 2 grid of smaller matrices, called blocks. Each block is itself a matrix, vector, or scalar, sized so the blocks line up into an n×nn \times n whole.

(aˉ11aˉ12Taˉ21Aˉ22)\begin{pmatrix} \bar{a}_{11} & \bar{a}_{12}^T \\ \bar{a}_{21} & \bar{A}_{22} \end{pmatrix}

Here:

  • aˉ11\bar{a}_{11}: 1×11 \times 1, a scalar
  • aˉ12T\bar{a}_{12}^T: 1×(n1)1 \times (n-1), a row vector
  • aˉ21\bar{a}_{21}: (n1)×1(n-1) \times 1, a column vector
  • Aˉ22\bar{A}_{22}: (n1)×(n1)(n-1) \times (n-1), a matrix

Block matrices multiply like ordinary matrices, treating each block as if it were a single entry, provided block dimensions are compatible for each product and sum.

The Schur complement of aˉ11\bar{a}_{11} in the block matrix above is

Aˉ22aˉ21aˉ12Taˉ11\bar{A}_{22} - \frac{\bar{a}_{21}\bar{a}_{12}^T}{\bar{a}_{11}}

The block Aˉ22\bar{A}_{22} with the effect of aˉ11\bar{a}_{11}‘s row and column subtracted out.

Base Case

n=1n = 1: A=(a)A = (a), so L=(1)L = (1), U=(a)U = (a), P=(1)P = (1).

Recursive Step

  • Choose row ii so that ai1aj1|a_{i1}| \geq |a_{j1}| for all j=1,2,,nj = 1, 2, \ldots, n.
  • Let P1P_1 be the permutation matrix that moves row ii to row 11, leaving the other rows in order.
  • Let Aˉ=P1A\bar{A} = P_1 A, partitioned in block form
Aˉ=(aˉ11aˉ12Taˉ21Aˉ22)\bar{A} = \begin{pmatrix} \bar{a}_{11} & \bar{a}_{12}^T \\ \bar{a}_{21} & \bar{A}_{22} \end{pmatrix}
  • Eliminate the first column below aˉ11\bar{a}_{11}
Aˉ=(10Taˉ21/aˉ11In1)(aˉ11aˉ12T0A)\bar{A} = \begin{pmatrix} 1 & \vec{0}^T \\ \bar{a}_{21}/\bar{a}_{11} & I_{n-1} \end{pmatrix} \begin{pmatrix} \bar{a}_{11} & \bar{a}_{12}^T \\ \vec{0} & A' \end{pmatrix}

AA' is the Schur complement of aˉ11\bar{a}_{11} in Aˉ\bar{A}, as defined above.

  • Recurse on AA' to find P2,L2,U2P_2, L_2, U_2 with P2A=L2U2P_2 A' = L_2 U_2.
  • Combine
P=(10T0P2)P1,L=(10TP2aˉ21/aˉ11L2),U=(aˉ11aˉ12T0U2)P = \begin{pmatrix} 1 & \vec{0}^T \\ \vec{0} & P_2 \end{pmatrix} P_1, \quad L = \begin{pmatrix} 1 & \vec{0}^T \\ P_2\bar{a}_{21}/\bar{a}_{11} & L_2 \end{pmatrix}, \quad U = \begin{pmatrix} \bar{a}_{11} & \bar{a}_{12}^T \\ \vec{0} & U_2 \end{pmatrix}

Meaning of Each Part

  • aˉ11\bar{a}_{11}
    Scalar. The pivot, already the largest entry of column 11 after the swap.
  • aˉ12T\bar{a}_{12}^T
    1×(n1)1 \times (n-1) row vector. The rest of pivot row 11, to the right of aˉ11\bar{a}_{11}.
  • aˉ21\bar{a}_{21}
    (n1)×1(n-1) \times 1 column vector. The rest of column 11, below aˉ11\bar{a}_{11}. This is what elimination must zero out.
  • Aˉ22\bar{A}_{22}
    (n1)×(n1)(n-1) \times (n-1) block. Everything else, untouched by the swap.
  • aˉ21/aˉ11\bar{a}_{21}/\bar{a}_{11}
    Column of multipliers, 1 per row below the pivot. Same role as mjim_{ji} in ordinary LU: the amount of the pivot row subtracted from each row below to clear column 11.
  • AA'
    (n1)×(n1)(n-1) \times (n-1) block left over after elimination. Algebraically identical to what remains of Aˉ22\bar{A}_{22} once each row has had a multiple of aˉ12T\bar{a}_{12}^T subtracted from it.

The recursion is elimination applied to 1 column at a time, exactly as in Gaussian elimination, but written so each step reduces the problem to a strictly smaller matrix AA' instead of looping over rows.

  • AA' depends on aˉ21\bar{a}_{21}, aˉ12T\bar{a}_{12}^T, aˉ11\bar{a}_{11}, all fixed only after P1P_1 is chosen and the first elimination is done.
  • The pivot row for AA' is therefore chosen from AA'‘s own first column, not from AA‘s. This is why PP cannot be computed in 1 pass: P2P_2 requires AA', and AA' requires P1P_1.
  • The recursion bottoms out at n=1n = 1, where there is nothing left to pivot or eliminate.

Building LL, UU, PP From the Base Case

The recursion computes AA' going down, then builds LL, UU, PP going back up, 1 level at a time, using the combine formulas.

At each level, the level below has already returned a smaller L2L_2, U2U_2, P2P_2 solving P2A=L2U2P_2 A' = L_2 U_2. That triple is embedded whole into the bottom-right (n1)×(n1)(n-1) \times (n-1) block of the current level’s LL, UU, PP. The current level contributes only its own pivot row and pivot column, in the first row and column.

  • UU
    Top row is aˉ11\bar{a}_{11} and aˉ12T\bar{a}_{12}^T, unchanged from this level. Bottom-right block is U2U_2, unchanged from below. No mixing between levels, since elimination already zeroed out the rest of column 11.
  • LL
    Top row is 11 then zeros, since row 11 of Aˉ\bar{A} was never used to eliminate anything. First column below the diagonal is the multiplier column aˉ21/aˉ11\bar{a}_{21}/\bar{a}_{11}, but permuted by P2P_2 first, so its entries land in the same row order as L2L_2. Bottom-right block is L2L_2, unchanged from below.
  • PP
    P2P_2 is embedded into the bottom-right block of an n×nn \times n identity, giving a matrix that reorders rows 2,,n2, \ldots, n and leaves row 11 fixed. This is multiplied by P1P_1, so P1P_1‘s swap is applied first, then P2P_2‘s reordering.

Unwinding starts at the base case, L=(1)L = (1), U=(a)U = (a), P=(1)P = (1), and combines 1 level at a time until level 11 returns the full n×nn \times n LL, UU, PP.

Worked Example

A=(055290688)A = \begin{pmatrix} 0 & 5 & 5 \\ 2 & 9 & 0 \\ 6 & 8 & 8 \end{pmatrix}

Level 1, n=3n = 3:

  • Column 11 is (026)T(0 \enspace 2 \enspace 6)^T. Largest magnitude is 66, row 33. i=3i = 3.
  • P1P_1 swaps row 11 and row 33.
Aˉ=P1A=(688290055)\bar{A} = P_1 A = \begin{pmatrix} 6 & 8 & 8 \\ 2 & 9 & 0 \\ 0 & 5 & 5 \end{pmatrix}
  • aˉ11=6\bar{a}_{11} = 6, aˉ12T=(88)\bar{a}_{12}^T = (8 \enspace 8), aˉ21=(20)T\bar{a}_{21} = (2 \enspace 0)^T, Aˉ22=(9055)\bar{A}_{22} = \begin{pmatrix} 9 & 0 \\ 5 & 5 \end{pmatrix}.
  • Multipliers: aˉ21/aˉ11=(1/30)T\bar{a}_{21}/\bar{a}_{11} = (1/3 \enspace 0)^T.
  • Schur complement:
A=(9055)16(20)(88)=(19/38/355)A' = \begin{pmatrix} 9 & 0 \\ 5 & 5 \end{pmatrix} - \frac{1}{6}\begin{pmatrix} 2 \\ 0 \end{pmatrix}(8 \enspace 8) = \begin{pmatrix} 19/3 & -8/3 \\ 5 & 5 \end{pmatrix}

Level 2, recurse on AA', n=2n = 2:

  • Column 11 is (19/35)T(6.335)T(19/3 \enspace 5)^T \approx (6.33 \enspace 5)^T. Largest is row 11. i=1i = 1, so P2=I2P_2 = I_2, no swap.
  • aˉ11=19/3\bar{a}_{11} = 19/3, aˉ12T=(8/3)\bar{a}_{12}^T = (-8/3), aˉ21=(5)\bar{a}_{21} = (5), Aˉ22=(5)\bar{A}_{22} = (5).
  • Multiplier: 5/(19/3)=15/195 / (19/3) = 15/19.
  • Schur complement:
A=55(8/3)19/3=13519A'' = 5 - \frac{5 \cdot (-8/3)}{19/3} = \frac{135}{19}

Level 3, base case, n=1n = 1: L=(1)L = (1), U=(135/19)U = (135/19), P=(1)P = (1).

Combine level 2 with the base case: P2=I2P_2 = I_2, so

L2=(1015/191),U2=(19/38/30135/19)L_2 = \begin{pmatrix} 1 & 0 \\ 15/19 & 1 \end{pmatrix}, \quad U_2 = \begin{pmatrix} 19/3 & -8/3 \\ 0 & 135/19 \end{pmatrix}

Combine level 1 with level 2: P2=I2P_2 = I_2, so PP reduces to P1P_1

P=(001010100),L=(1001/310015/191),U=(688019/38/300135/19)P = \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{pmatrix}, \quad L = \begin{pmatrix} 1 & 0 & 0 \\ 1/3 & 1 & 0 \\ 0 & 15/19 & 1 \end{pmatrix}, \quad U = \begin{pmatrix} 6 & 8 & 8 \\ 0 & 19/3 & -8/3 \\ 0 & 0 & 135/19 \end{pmatrix}

PAPA places row 33 of AA first, row 22 second, row 11 last, matching the row swap chosen at level 11. LL and UU multiply back to this reordered matrix.

Was this helpful?