Why the Right-Hand Side Must Be Permuted
When elimination uses row exchanges, the factorization records those exchanges in a permutation matrix. The resulting identity is \( \mathbf{P}\mathbf{A}=\mathbf{L}\mathbf{U}\), not simply \(\mathbf{A}=\mathbf{L}\mathbf{U}\). Consequently, solving \(\mathbf{A}\mathbf{x}=\mathbf{b}\) requires applying the same row permutation to \(\mathbf{b}\) before using the triangular factors. Forgetting this step, or applying the permutation in the wrong direction, can produce a vector that solves a different system.
Here \(\mathbf{A}\in\mathbb{R}^{n\times n}\), \(\mathbf{b},\mathbf{x}\in\mathbb{R}^n\), and \(\mathbf{P}\) is an \(n\times n\) permutation matrix: it is obtained by reordering the rows of the identity matrix. Multiplying a vector by \(\mathbf{P}\) reorders its entries in that same row order. The factors in a standard pivoted LU factorization are a unit lower-triangular matrix \(\mathbf{L}\), with diagonal entries all equal to \(1\), and an upper-triangular matrix \(\mathbf{U}\).
To see why the permutation acts on the right-hand side, multiply the original equation on the left by \(\mathbf{P}\). The result is \(\mathbf{P}\mathbf{A}\mathbf{x}=\mathbf{P}\mathbf{b}\). Replacing \(\mathbf{P}\mathbf{A}\) by \(\mathbf{L}\mathbf{U}\) gives \(\mathbf{L}\mathbf{U}\mathbf{x}=\mathbf{P}\mathbf{b}\). Set \(\mathbf{y}=\mathbf{U}\mathbf{x}\). Then the equation separates into \(\mathbf{L}\mathbf{y}=\mathbf{P}\mathbf{b}\) and \(\mathbf{U}\mathbf{x}=\mathbf{y}\).
The Solve Procedure and Why It Works
For a lower-triangular matrix, forward substitution determines entries from top to bottom. If \(\mathbf{L}\) is unit lower-triangular, the equations in \(\mathbf{L}\mathbf{y}=\mathbf{P}\mathbf{b}\) give
For an upper-triangular matrix with nonzero diagonal entries, back substitution determines entries from bottom to top:
Proof. Assume the stated factorization and let \(\mathbf{b}\) be any vector in \(\mathbb{R}^n\). A permutation matrix reorders rows, so its rows are the standard basis vectors in some order. Their dot products are \(1\) with themselves and \(0\) with one another; therefore \(\mathbf{P}\mathbf{P}^{\top}=\mathbf{I}_n\), and \(\mathbf{P}^{-1}=\mathbf{P}^{\top}\). Thus multiplying an equation by \(\mathbf{P}\) preserves equivalence: \(\mathbf{A}\mathbf{x}=\mathbf{b}\) holds exactly when \(\mathbf{P}\mathbf{A}\mathbf{x}=\mathbf{P}\mathbf{b}\) holds. Using the factorization, this last equation is \(\mathbf{L}\mathbf{U}\mathbf{x}=\mathbf{P}\mathbf{b}\).
Because \(\mathbf{L}\) is unit lower-triangular, its \(i\)th equation has coefficient \(1\) on \(y_i\), involves only \(y_1,\dots,y_i\), and determines \(y_i\) once \(y_1,\dots,y_{i-1}\) are known. Starting at \(i=1\), the forward-substitution formula therefore determines a unique \(\mathbf{y}\) satisfying \(\mathbf{L}\mathbf{y}=\mathbf{P}\mathbf{b}\). Because each \(u_{ii}\ne0\), the \(i\)th equation of \(\mathbf{U}\mathbf{x}=\mathbf{y}\) determines \(x_i\) from \(x_{i+1},\dots,x_n\). Starting at \(i=n\), back substitution determines a unique \(\mathbf{x}\). For that vector, \(\mathbf{L}\mathbf{U}\mathbf{x}=\mathbf{L}\mathbf{y}=\mathbf{P}\mathbf{b}\), so \(\mathbf{P}\mathbf{A}\mathbf{x}=\mathbf{P}\mathbf{b}\). Multiplying by \(\mathbf{P}^{\top}\) gives \(\mathbf{A}\mathbf{x}=\mathbf{b}\). Any solution of the original system would also give a solution of both triangular systems, whose solutions are unique; hence the original solution is unique as well. \(\square\)
The nonzero diagonal condition on \(\mathbf{U}\) matters: it ensures that every back-substitution step can divide by \(u_{ii}\). If a diagonal entry is zero, this procedure does not guarantee a unique solution; the system may be inconsistent or may have more than one solution. In the examples below, all diagonal entries of \(\mathbf{U}\) are nonzero.
Worked Solves
Worked Example: One Row Exchange in a Three-Variable System
Suppose
and the factors are
First verify the factorization. Multiplying \(\mathbf{L}\mathbf{U}\) gives rows \((1,1,0)\), \((0,2,1)\), and \(2(1,1,0)-(0,2,1)+(0,0,2)=(2,0,1)\). These are the rows of \(\mathbf{P}\mathbf{A}\), so \(\mathbf{P}\mathbf{A}=\mathbf{L}\mathbf{U}\). Solve for \(\mathbf{b}=(3,2,5)^{\top}\). The row exchange gives
Forward substitution in \(\mathbf{L}\mathbf{y}=\mathbf{P}\mathbf{b}\) gives \(y_1=2\), \(y_2=3\), and \(2y_1-y_2+y_3=5\), so \(y_3=5-4+3=4\). Thus \(\mathbf{y}=(2,3,4)^{\top}\). Back substitution gives \(2x_3=4\), so \(x_3=2\); then \(2x_2+x_3=3\), so \(x_2=(3-2)/2=1/2\); and \(x_1+x_2=2\), so \(x_1=2-1/2=3/2\).
Check in the original system:
The computed vector solves the original system, not merely the permuted one.
Worked Example: A Three-Cycle of Rows
Consider the factors
Multiplication gives
The rows of \(\mathbf{P}\mathbf{A}\) are rows 2, 3, 1 of \(\mathbf{A}\). Therefore the original matrix is
Take \(\mathbf{b}=(-14,3,1)^{\top}\). The permutation reorders its entries to \(\mathbf{P}\mathbf{b}=(3,1,-14)^{\top}\). The forward equations give \(y_1=3\), \(2y_1+y_2=1\), hence \(y_2=-5\), and \(-y_1+3y_2+y_3=-14\), hence \(y_3=-14+3+15=4\). So \(\mathbf{y}=(3,-5,4)^{\top}\).
For back substitution, \(2x_3=4\) gives \(x_3=2\). Next, \(3x_2-x_3=-5\) gives \(3x_2=-3\), so \(x_2=-1\). Finally, \(2x_1+x_2+x_3=3\) gives \(2x_1-1+2=3\), so \(x_1=1\).
Check: the rows of \(\mathbf{A}\mathbf{x}\) are \(-2(1)+8(-1)-2(2)=-14\), \(2(1)+(-1)+2=3\), and \(4(1)+5(-1)+2=1\). Therefore \(\mathbf{A}\mathbf{x}=\mathbf{b}\).
Worked Example: Building the Factors After a Swap
Let \(\mathbf{A}=\begin{bmatrix}1&2\\3&4\end{bmatrix}\), \(\mathbf{b}=(5,11)^{\top}\), and exchange the two rows. Then
Eliminating the \(1\) below the first pivot uses multiplier \(1/3\), giving the upper-triangular matrix \(\mathbf{U}=\begin{bmatrix}3&4\\0&2/3\end{bmatrix}\). The multiplier is stored below the pivot in \(\mathbf{L}=\begin{bmatrix}1&0\\1/3&1\end{bmatrix}\). Indeed,
Now \(\mathbf{P}\mathbf{b}=(11,5)^{\top}\). Forward substitution gives \(y_1=11\) and \(y_1/3+y_2=5\), so \(y_2=5-11/3=4/3\). Back substitution gives \((2/3)x_2=4/3\), so \(x_2=2\); then \(3x_1+4x_2=11\), so \(x_1=(11-8)/3=1\). Thus \(\mathbf{x}=(1,2)^{\top}\).
Check: \(\mathbf{A}\mathbf{x}=(1+4,3+8)^{\top}=(5,11)^{\top}=\mathbf{b}\).
Common Mistake: Using the Unpermuted Right-Hand Side
In the first worked example, applying forward substitution to \(\mathbf{L}\mathbf{y}=\mathbf{b}\) instead of \(\mathbf{L}\mathbf{y}=\mathbf{P}\mathbf{b}\) would give \(y_1=3\), \(y_2=2\), and \(2(3)-2+y_3=5\), so \(y_3=1\). Back substitution would then give \(x_3=1/2\), \(x_2=3/4\), and \(x_1=9/4\). This is a concrete but incorrect answer: the first entry of \(\mathbf{A}\mathbf{x}\) would be \(2(3/4)+1/2=2\), not the required \(3\).
The correction is to apply \(\mathbf{P}\) to the right-hand side before either triangular solve. The matrix \(\mathbf{P}\) in that example swaps the first two entries, so \(\mathbf{P}\mathbf{b}=(2,3,5)^{\top}\); using this vector gives the checked solution \((3/2,1/2,2)^{\top}\). A second common error is to apply \(\mathbf{P}^{\top}\) instead of \(\mathbf{P}\). For a single swap these matrices happen to be equal, but a longer permutation need not equal its transpose. The safe rule follows directly from the displayed identity: \(\mathbf{P}\mathbf{A}\mathbf{x}=\mathbf{P}\mathbf{b}\), so the right-hand side is \(\mathbf{P}\mathbf{b}\).
In practice, the factorization is reusable: for each new right-hand side, form its permuted vector, solve the two triangular systems, and check the resulting \(\mathbf{x}\) in the original equation when a direct verification is appropriate. The permutation changes the order of equations; it does not change the unknown vector or the meaning of the original system.
Check Your Understanding
For each question, keep the order of operations explicit and use the original equation to check any computed solution.
- If \(\mathbf{P}\mathbf{A}=\mathbf{L}\mathbf{U}\), what triangular system must be solved first for a right-hand side \(\mathbf{b}\), and why does its right-hand side involve \(\mathbf{P}\)?
- For \(\mathbf{P}=\begin{bmatrix}0&1\\1&0\end{bmatrix}\) and \(\mathbf{b}=(4,-2)^{\top}\), compute \(\mathbf{P}\mathbf{b}\).
- Using \(\mathbf{L}=\begin{bmatrix}1&0\\2&1\end{bmatrix}\), solve \(\mathbf{L}\mathbf{y}=(3,1)^{\top}\) by forward substitution.
- Why does a nonzero diagonal in \(\mathbf{U}\) ensure that back substitution determines a unique vector \(\mathbf{x}\)?
- Describe a direct check that distinguishes a solution of the original system from an incorrect result caused by omitting the permutation.