This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

LUDecomposition

LUDecomposition[m]
generates a representation of the LU decomposition of a square matrix m.
  • LUDecomposition returns a list of three elements. The first element is a combination of upper- and lower-triangular matrices, the second element is a vector specifying rows used for pivoting, and for approximate numerical matrices m the third element is an estimate of the condition number of m.
Compute the LU decomposition of a matrix:
l is in the strictly lower-triangular part of lu with ones assumed along the diagonal:
u is in the upper-triangular part of lu:
reconstructs the original matrix:
Compute the LU decomposition of a matrix:
In[1]:=
Click for copyable input
Out[1]=
l is in the strictly lower-triangular part of lu with ones assumed along the diagonal:
In[2]:=
Click for copyable input
Out[2]=
u is in the upper-triangular part of lu:
In[3]:=
Click for copyable input
Out[3]=
reconstructs the original matrix:
In[4]:=
Click for copyable input
Out[4]=
m is a 3×3 matrix:
Compute using exact arithmetic:
Compute using machine arithmetic:
Compute using 20-digit precision arithmetic:
LU decomposition for a complex matrix:
Compute a symbolic LU decomposition:
LU decompositions are mainly used to solve linear systems. Here is a 5×5 random matrix:
LinearSolve[m] sets up an LU decomposition in a functional form convenient for solving:
This solves the system for x:
Verify that x is indeed the solution:
This can be done manually with the output of LUDecomposition as well:
l is in the strictly lower-triangular part of lu with ones assumed along the diagonal:
u is in the upper-triangular part of lu:
Solve the system with two backsolves:
m is a random 100×100 matrix:
Compute the LU decomposition of m:
The determinant of m is given by the product of the diagonal elements of l:
m is a 6×6 random matrix:
Compute the LU decomposition of m:
l is in the strictly lower-triangular part of lu with ones assumed along the diagonal:
u is in the upper-triangular part of lu:
is equal to a permutation of the rows of m:
New in 3