Here is an original example of Gaussian elimination that can be checked entirely with integers. Start with
The first pivot element is . The elimination multipliers are and . Apply the elementary row operations and to obtain
Now the second pivot element is , and . The elementary row operation gives
Importantly, comes from the current reduced matrix, not the original entry . To reconstruct from , its second row is twice the first row of plus the second; its third row is minus the first row of plus three times the second plus the third. These are exactly the coefficients in the lower triangular matrix .
The unpivoted calculation here illustrates the structure of LU decomposition; applying partial pivoting to this particular would choose a different first row and different factors. Both procedures can represent the same linear system when their permutation matrices are handled consistently.
Elimination multiplier 2026-10-14
For , an elimination multiplier is the scalar used in the elementary row operation . This creates a zero below the pivot element. The remaining entries change by for . Storing these elimination multipliers gives the subdiagonal entries of in LU decomposition; later row interchanges must also reorder the already stored coefficients.
LU decomposition Created 2026-09-29 Updated 2026-10-14
An LU decomposition writes a square matrix as , with a lower triangular matrix and an upper triangular matrix. We use a unit triangular matrix , meaning . The factors record Gaussian elimination: contains the reduced equations, while stores the elimination multipliers needed to reconstruct the original equations. This makes Reusing LU factors for multiple right-hand sides inexpensive.[ref]
For an invertible matrix, unpivoted LU decomposition requires nonzero pivot elements at every elimination step; invertibility alone does not guarantee this. In general use Pivoted LU decomposition, with the explicit convention and a permutation matrix . Once the factors exist, solving a linear system needs forward substitution followed by back substitution, rather than forming a matrix inverse.
For classical dense Gaussian elimination over the real numbers, count each scalar addition, subtraction, multiplication or division as one arithmetic operation. At step , there are elimination multipliers to divide out and remaining entries, each requiring one multiplication and one subtraction. Thus this implementation's unpivoted factorization count is
Here uses Big O notation. Partial pivoting adds comparisons and row movement, leaving the leading arithmetic count unchanged. The leading count agrees with the standard dense LU decomposition analysis.[ref]
With unit , forward substitution uses arithmetic operations. Back substitution uses another plus diagonal divisions. Together these cost per right-hand side; applying a stored row permutation moves entries and requires no scalar arithmetic. In Big O notation, Reusing LU factors for multiple right-hand sides therefore costs
whereas refactorizing for each of the right-hand sides costs . For and , the leading counts are about versus arithmetic operations, nearly a tenfold saving. These are operation counts, not measured runtimes: memory access and optimized matrix multiplication also affect speed.[ref]
Pivoted LU decomposition 2026-10-14
We fix the convention : the permutation matrix acts on the rows of , and the same row ordering must be applied to before the Triangular solves for LU decomposition. Equivalently, , since . LAPACK documents its factors as instead, so check the defining equation rather than just the letter .[ref] Partial pivoting selects the largest absolute candidate in the current column, among rows , before forming elimination multipliers.[ref]
A zero first pivot element does not imply a singular matrix. For example,
Unpivoted Gaussian elimination would divide by zero. Indeed, no with a unit lower triangular matrix exists: would force , contradicting . One row interchange resolves the obstruction. For , use ; back substitution then gives . Using the original with these factors would solve a different linear system.
Partial pivoting bounds each elimination multiplier by one in absolute value in exact arithmetic. This helps control roundoff error, but intermediate entries can still grow; it is not an unconditional guarantee of numerical stability for every matrix.[ref] It also does not remove the original problem's condition number. For the diagonal matrix with , the condition number in the Euclidean norm is . Row permutations preserve this condition number, because they preserve Euclidean norms. Even an exact solve changes from to when the right-hand side changes from to . This sensitivity is a property of the linear system, not a zero-pivot element failure.[ref]
Pivot element 2026-10-14
A pivot element is the current diagonal entry used to eliminate entries below it in Gaussian elimination, after any row interchange. At step it is , where is the current reduced matrix. Computing elimination multipliers requires this entry to be nonzero. A zero pivot element can reflect an unsuitable row order even for an invertible matrix, as Pivoted LU decomposition illustrates.
Let . Store the tridiagonal matrix by its diagonal , lower diagonal , and upper diagonal . The linear system is
with the nonexistent endpoint terms omitted. Initialize and . For , compute the elimination multiplier, modified pivot element, and modified right-hand side:
These recurrence relations apply the elementary row operation after the preceding row has already been reduced. The transformed linear system is an upper bidiagonal matrix:
Thus back substitution is especially short:
For , only remains. Check each pivot element before its first division, including before back substitution.
Figure 1.
Tridiagonal elimination preserves the narrow band: only one row and one diagonal coefficient change per step
. Details.
Equivalently, this constructs an LU decomposition with unit lower bidiagonal matrix , whose lower diagonal is , and upper bidiagonal matrix , whose diagonal is and upper diagonal is . The sweep is forward substitution in . There is no fill-in outside these bands when no rows are interchanged. LAPACK's DGTSV source uses these same coefficient and right-hand-side updates in its branch without row interchange.[ref]