Section 6.5 LU Decomposition
The LU decomposition of a matrix is a factorization of the matrix into a product of a lower triangular matrix \(L\) and an upper triangular matrix \(U\text{.}\) This decomposition is useful for solving systems of linear equations and computing the determinant of the matrix.
In Sage, the LU decomposition can be computed using the
LU()
method (note that Sage implementation of this method returns three matrices: the lower triangular matrix \(L\text{,}\) the upper triangular matrix \(U\text{,}\) and an extra permutation matrix \(P\)):The product of the matrices \(P\text{,}\) \(L\text{,}\) and \(U\) yields the original matrix \(A\text{.}\) The matrix \(P\) is called the Pivot (or the permutation) matrix, which always has a determinant of 1 (has exactly one \(1\) in every row and column). The matrix \(L\) is the Lower triangular matrix L. its determinant is equal to the product of the diagonal entries.
Similarly, the matrix \(U\) is the Upper triangular matrix U. its determinant is also equal to the product of the diagonal entries.
Note that the LU decomposition is not unique, and there are many different ways to perform it. For instance, we can choose to decomposition with a pivot that has a non-zero determinant (also equal to 1 in this case):
With partial pivoting, every entry of \(L\) will have absolute value of \(1\) or less.
Additionally, Sage offers different ways to format the display of the result of the LU decomposition.
And for a slightly compact format: