Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / New in Version 3.0 / Lists and Matrices  /
LUDecomposition

  • LUDecomposition[ m ] generates a representation of the LU decomposition of a 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 the third element is an estimate of the condition number of .
  • The data generated by LUDecomposition is intended for use in LUBackSubstitution.
  • See the Mathematica book: Section 3.7.8Section 3.7.10.
  • See also Implementation NotesA.9.44.27MainBookLinkOldButtonDataA.9.44.27.
  • See also: LUBackSubstitution, QRDecomposition, SchurDecomposition.
  • Related packages: LinearAlgebra`Cholesky`, LinearAlgebra`Orthogonalization`.

    Further Examples

    We start with the decomposition of a simple matrix.

    In[1]:=

    Out[1]=

    We solve the system m.v = {5,8}.

    In[2]:=

    Out[2]=

    This checks the result.

    In[3]:=

    Out[3]=

    In[4]:=

    Recovering the lower and upper triangular matrices from the LUDecomposition
    LUDecomposition satisfies the following relation: Given a matrix M, determine a unit lower triangular matrix L, an upper triangular matrix U and a permutation vector P such that Part[M, P] == L. U . Part[M, P] rearranges the rows of M.
    The permutation ensures numerical stability during the decomposition phase; after that, L and U are determined using Gaussian elimination. Solving the system M.x == b is equivalent to solving the system L.U.x == b but it is easier because it amounts to solving two triangular systems in a row.

    For reasons of efficiency, the matrices L and U are returned as a single matrix, where the ones on the main diagonal of L are left out. The functions Lower and Upper recover the matrices by multiplying pairwise (not dot multiplying!) with appropriate matrices of zeros and ones.

    In[5]:=

    In[6]:=

    Consider this inexact matrix.

    In[7]:=

    This decomposes the matrix into lower and upper diagonal matrices, gives a permutation vector and an estimate of the condition number.

    In[8]:=

    Out[8]=

    This is the lower triangular matrix L.

    In[9]:=

    Out[9]//MatrixForm=

    This is the upper triangular matrix U.

    In[10]:=

    Out[10]//MatrixForm=

    This checks the result.

    In[11]:=

    Out[11]//MatrixForm=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.