LUP Decomposition

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 reorders the rows of AA as in partial pivoting.
  • Exists for any nonsingular AA.
  • Not unique.
  • More robust than LU without pivoting, at about the same cost.

Comparison with LU Decomposition

The LU decomposition factors AA as A=LUA = LU, without row interchanges. LUP selects the pivot row by size.

  • Existence
    A zero pivot stops the elimination. LUP always factors a nonsingular AA.
  • Stability
    A small pivot gives large multipliers and amplifies rounding error. Partial pivoting keeps every multiplier at most 11 in size.
  • Cost
    Factorization costs O(n3)O(n^3) for both. Each solve costs O(n2)O(n^2). LUP adds the row swaps and the permutation of b⃗\vec{b}.

When to Use Which

LUP is the default for a general dense matrix. The pivot sizes are unknown in advance.

Use LU without pivoting when the pivots are safe by construction.

  • Diagonally dominant AA
    Every pivot is nonzero without a swap.
  • Symmetric positive definite AA
    Every leading principal minor is positive.
  • Banded or sparse AA
    Row interchanges would add fill-in.

Solving Ax⃗=b⃗A\vec{x} = \vec{b}

PAx⃗=Pb⃗PA\vec{x} = P\vec{b} becomes LUx⃗=Pb⃗LU\vec{x} = P\vec{b}.

  • Solve Ly⃗=Pb⃗L\vec{y} = P\vec{b} by forward substitution.
  • Solve Ux⃗=y⃗U\vec{x} = \vec{y} by back substitution.

Recursive Leading-Row-Column Algorithm

Set A(0)=AA^{(0)} = A. At recursion depth kk, factor the current (n−k)×(n−k)(n-k) \times (n-k) matrix A(k)A^{(k)}.

Let S(k)S^{(k)} swap the row with the largest entry in magnitude in the first column of A(k)A^{(k)} into the first row. Partition the swapped matrix B(k)=S(k)A(k)B^{(k)} = S^{(k)}A^{(k)} as

B(k)=(α(k)(r(k))Tc(k)C(k))B^{(k)} = \begin{pmatrix} \alpha^{(k)} & \left(r^{(k)}\right)^T \\ c^{(k)} & C^{(k)} \end{pmatrix}
Here:
A(k)A^{(k)}
matrix entering recursion depth kk
B(k)B^{(k)}
matrix after the row swap
α(k)\alpha^{(k)}
pivot
(r(k))T\left(r^{(k)}\right)^T
rest of the pivot row
c(k)c^{(k)}
rest of the pivot column
C(k)C^{(k)}
trailing block
ℓ(k)\ell^{(k)}
multiplier vector
S(k)S^{(k)}
row swap at recursion depth kk

Schur Complement

Define the multiplier vector and the next recursive matrix as

ℓ(k)=c(k)α(k)A(k+1)=C(k)−ℓ(k)(r(k))T\begin{aligned} \ell^{(k)} &= \frac{c^{(k)}}{\alpha^{(k)}} \\ A^{(k+1)} &= C^{(k)} - \ell^{(k)}\left(r^{(k)}\right)^T \end{aligned}

A(k+1)A^{(k+1)} is the Schur complement of α(k)α^{(k)} in B(k)B^{(k)}.

Base Case

When A(k)A^{(k)} is 1×11 \times 1, set

P(k)=L(k)=(1),U(k)=A(k)P^{(k)} = L^{(k)} = (1), \qquad U^{(k)} = A^{(k)}

Recursive Step

For a matrix larger than 1×11 \times 1:

  • Form B(k)=S(k)A(k)B^{(k)} = S^{(k)}A^{(k)} and partition it.
  • Compute ℓ(k)\ell^{(k)} and A(k+1)A^{(k+1)}.
  • Recurse on A(k+1)A^{(k+1)} to get P(k+1)A(k+1)=L(k+1)U(k+1)P^{(k+1)}A^{(k+1)} = L^{(k+1)}U^{(k+1)}.
  • Return
P(k)=(10⃗T0⃗P(k+1))S(k)L(k)=(10⃗TP(k+1)ℓ(k)L(k+1))U(k)=(α(k)(r(k))T0⃗U(k+1))\begin{aligned} P^{(k)} &= \begin{pmatrix} 1 & \vec{0}^T \\ \vec{0} & P^{(k+1)} \end{pmatrix}S^{(k)} \\ L^{(k)} &= \begin{pmatrix} 1 & \vec{0}^T \\ P^{(k+1)}\ell^{(k)} & L^{(k+1)} \end{pmatrix} \\ U^{(k)} &= \begin{pmatrix} \alpha^{(k)} & \left(r^{(k)}\right)^T \\ \vec{0} & U^{(k+1)} \end{pmatrix} \end{aligned}

The required decomposition is P=P(0)P = P^{(0)}, L=L(0)L = L^{(0)}, U=U(0)U = U^{(0)}.

Worked Examples

Example 1

Find LL, UU, PP for

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

Set A(0)=AA^{(0)} = A. At depth 00, column 11 is (0,2,6)T(0, 2, 6)^T. The pivot is 66 in row 33. Let S(0)S^{(0)} swap rows 11 and 33.

S(0)=(001010100)S^{(0)} = \begin{pmatrix} 0 & 0 & 1 \\ 0 & 1 & 0 \\ 1 & 0 & 0 \end{pmatrix}B(0)=S(0)A(0)=(688290055)B^{(0)} = S^{(0)}A^{(0)} = \begin{pmatrix} 6 & 8 & 8 \\ 2 & 9 & 0 \\ 0 & 5 & 5 \end{pmatrix}α(0)=6,(r(0))T=(88),c(0)=(20),C(0)=(9055)\alpha^{(0)} = 6, \quad \left(r^{(0)}\right)^T = (8 \enspace 8), \quad c^{(0)} = \begin{pmatrix} 2 \\ 0 \end{pmatrix}, \quad C^{(0)} = \begin{pmatrix} 9 & 0 \\ 5 & 5 \end{pmatrix}ℓ(0)=(1/30),A(1)=C(0)−ℓ(0)(r(0))T=(19/3−8/355)\ell^{(0)} = \begin{pmatrix} 1/3 \\ 0 \end{pmatrix}, \quad A^{(1)} = C^{(0)} - \ell^{(0)}\left(r^{(0)}\right)^T = \begin{pmatrix} 19/3 & -8/3 \\ 5 & 5 \end{pmatrix}

At depth 11, column 11 of A(1)A^{(1)} is (19/3,5)T(19/3, 5)^T. The pivot is already in row 11, so S(1)=I2S^{(1)} = I_2.

B(1)=A(1),α(1)=193,(r(1))T=(−83),c(1)=(5),C(1)=(5)B^{(1)} = A^{(1)}, \quad \alpha^{(1)} = \frac{19}{3}, \quad \left(r^{(1)}\right)^T = \left(-\frac{8}{3}\right), \quad c^{(1)} = (5), \quad C^{(1)} = (5)ℓ(1)=1519,A(2)=C(1)−ℓ(1)(r(1))T=13519\ell^{(1)} = \frac{15}{19}, \quad A^{(2)} = C^{(1)} - \ell^{(1)}\left(r^{(1)}\right)^T = \frac{135}{19}

At depth 22, A(2)A^{(2)} is 1×11 \times 1. Therefore P(2)=L(2)=(1)P^{(2)} = L^{(2)} = (1) and U(2)=(135/19)U^{(2)} = (135/19).

Returning from depth 11

P(1)=I2,L(1)=(1015/191),U(1)=(19/3−8/30135/19)P^{(1)} = I_2, \quad L^{(1)} = \begin{pmatrix} 1 & 0 \\ 15/19 & 1 \end{pmatrix}, \quad U^{(1)} = \begin{pmatrix} 19/3 & -8/3 \\ 0 & 135/19 \end{pmatrix}

Returning from depth 00

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

Check, row 3 of LULU

1519(0,193,−83)+(0,0,13519)=(0,5,5)\tfrac{15}{19}\left(0, \tfrac{19}{3}, -\tfrac{8}{3}\right) + \left(0, 0, \tfrac{135}{19}\right) = (0, 5, 5)

Example 2

Using PP, LL, UU from Example 1, solve Ax⃗=b⃗A\vec{x} = \vec{b} for b⃗=(10,11,22)T\vec{b} = (10, 11, 22)^T.

Solution Reveal Hide
Pb⃗=(22,11,10)TP\vec{b} = (22, 11, 10)^T

Forward substitution, Ly⃗=Pb⃗L\vec{y} = P\vec{b}

y1=22y_1 = 22y2=11−13(22)=113y_2 = 11 - \frac{1}{3}(22) = \frac{11}{3}y3=10−1519⋅113=13519y_3 = 10 - \frac{15}{19}\cdot\frac{11}{3} = \frac{135}{19}

Back substitution, Ux⃗=y⃗U\vec{x} = \vec{y}

x3=135/19135/19=1x_3 = \frac{135/19}{135/19} = 1x2=11/3+(8/3)(1)19/3=1x_2 = \frac{11/3 + (8/3)(1)}{19/3} = 1x1=22−8(1)−8(1)6=1x_1 = \frac{22 - 8(1) - 8(1)}{6} = 1x⃗=(1,1,1)T\vec{x} = (1, 1, 1)^T

Wolfram Mathematica notebooks

A companion notebook for this note. Open it in Mathematica and evaluate the cells to reproduce the worked example.

The summary notebook defines every function used in this module, with documentation and no examples, as a starting point for your own problems.

Written by November 5, 2026 3 min read
Was this helpful?