Get Math Help

GET TUTORING NEAR ME!

(800) 434-2582

By submitting the following form, you agree to Club Z!'s Terms of Use and Privacy Policy

    Home / Get Math Help

    LU Decomposition

    Usage

    LUDecomposition[m] generates a representation of the LU decomposition of a square matrix m.

    Basic examples

    Compute the LU decomposition of a matrix: In[1]:={lu, p, c}=LUDecomposition[(1 | 1 | 1 2 | 4 | 8 3 | 9 | 27)] Out[1]={{{1, 1, 1}, {2, 2, 6}, {3, 3, 6}}, {1, 2, 3}, 0} l is the strictly lower triangular part of lu with ones assumed along the diagonal: In[2]:=MatrixForm[l=LowerTriangularize[lu, -1] + IdentityMatrix[3]] Out[2]=(1 | 0 | 0 2 | 1 | 0 3 | 3 | 1) u is the upper triangular part of lu: In[3]:=MatrixForm[u=UpperTriangularize[lu]] Out[3]=(1 | 1 | 1 0 | 2 | 6 0 | 0 | 6) l.u reconstructs the original matrix: In[4]:=l.u//MatrixForm Out[4]=(1 | 1 | 1 2 | 4 | 8 3 | 9 | 27) Find the LU decomposition of a symbolic matrix: In[1]:=lu=First[LUDecomposition[(a | b | c d | e | f g | h | i)]]//Simplify Out[1]={{a, b, c}, {d/a, -(b d)/a + e, -(c d)/a + f}, {g/a, (b g - a h)/(b d - a e), (c e g - b f g - c d h + a f h + b d i - a e i)/(b d - a e)}} Extract the l and u matrices: In[2]:={l, u}={LowerTriangularize[lu, -1] + IdentityMatrix[3], UpperTriangularize[lu]}; {l//MatrixForm, u//MatrixForm} Out[2]={(1 | 0 | 0 d/a | 1 | 0 g/a | (b g - a h)/(b d - a e) | 1), (a | b | c 0 | -(b d)/a + e | -(c d)/a + f 0 | 0 | (c e g - b f g - c d h + a f h + b d i - a e i)/(b d - a e))} Verify that l.u equals the original matrix: In[3]:=l.u//Simplify//MatrixForm Out[3]=(a | b | c d | e | f g | h | i)

    Options

    Modulus | Pivoting

    Relationships with other entities

    LinearSolveFunction | CholeskyDecomposition | QRDecomposition | SchurDecomposition | LowerTriangularize | UpperTriangularize | UpperTriangularMatrixQ | LowerTriangularMatrixQ | LowerTriangularMatrix | PermutationMatrix | UpperTriangularMatrix

    History

    introduced in Version 3 (September 1996) last modified in Version 14.3 (July 2025)

    Back to List | POWERED BY THE WOLFRAM LANGUAGE