LUDecomposition
✖
LUDecomposition

Details and Options

- 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 L∞ condition number of m.
Examples
open allclose allBasic Examples (2)Summary of the most common use cases
Compute the LU decomposition of a matrix:

https://wolfram.com/xid/0e7qnceq-300ke

l is the strictly lower triangular part of lu with ones assumed along the diagonal:

https://wolfram.com/xid/0e7qnceq-hkef0

u is the upper triangular part of lu:

https://wolfram.com/xid/0e7qnceq-cph48

l.u reconstructs the original matrix:

https://wolfram.com/xid/0e7qnceq-ewxiz5

Find the LU decomposition of a symbolic matrix:

https://wolfram.com/xid/0e7qnceq-yvwfa0


https://wolfram.com/xid/0e7qnceq-0cmtyc

Verify that equals the original matrix:

https://wolfram.com/xid/0e7qnceq-9rky6r

Scope (13)Survey of the scope of standard use cases
Basic Uses (9)
Find the LU decomposition of a machine-precision matrix:

https://wolfram.com/xid/0e7qnceq-8qx79o

Since is not an identity permutation,
is the permuted matrix
rather than
:

https://wolfram.com/xid/0e7qnceq-9byogf

LU decomposition for a complex matrix:

https://wolfram.com/xid/0e7qnceq-tgr7h3


https://wolfram.com/xid/0e7qnceq-ft8dp4

Use LUDecomposition with an exact matrix:

https://wolfram.com/xid/0e7qnceq-id7895

LU decomposition for an arbitrary-precision matrix:

https://wolfram.com/xid/0e7qnceq-jdo4f1

Use LUDecomposition with a symbolic matrix:

https://wolfram.com/xid/0e7qnceq-puzef1

The LU decomposition for a large numerical matrix is computed efficiently:

https://wolfram.com/xid/0e7qnceq-bjhh1d

https://wolfram.com/xid/0e7qnceq-n2hz99

LU decomposition for a matrix with finite field elements:

https://wolfram.com/xid/0e7qnceq-bfwvef


https://wolfram.com/xid/0e7qnceq-9affn


https://wolfram.com/xid/0e7qnceq-e6zkbj


https://wolfram.com/xid/0e7qnceq-5hn77

LU decomposition for a CenteredInterval matrix:

https://wolfram.com/xid/0e7qnceq-kzui0z


https://wolfram.com/xid/0e7qnceq-kad5g


https://wolfram.com/xid/0e7qnceq-g6j8vi


https://wolfram.com/xid/0e7qnceq-fk5jan


https://wolfram.com/xid/0e7qnceq-kud4f7

LU decomposition of a non-square matrix:

https://wolfram.com/xid/0e7qnceq-f1mxzj

The and
matrices have the same shape as
:

https://wolfram.com/xid/0e7qnceq-yychhx

The matrix is square, with the same number of rows as

https://wolfram.com/xid/0e7qnceq-slo31u


https://wolfram.com/xid/0e7qnceq-g5up7r

Special Matrices (4)
Find the LU decomposition for sparse matrices:

https://wolfram.com/xid/0e7qnceq-kfksuk


https://wolfram.com/xid/0e7qnceq-qvlhy


https://wolfram.com/xid/0e7qnceq-tr53kr


https://wolfram.com/xid/0e7qnceq-gyqjms

LU decompositions of structured matrices:

https://wolfram.com/xid/0e7qnceq-fyaetx


https://wolfram.com/xid/0e7qnceq-c0k3bb

Use with a QuantityArray structured matrix:

https://wolfram.com/xid/0e7qnceq-d2yyup


https://wolfram.com/xid/0e7qnceq-ntiy7m

The units go in the matrix; the
matrix is dimensionless:

https://wolfram.com/xid/0e7qnceq-x0r3mi

LU decomposition of an identity matrix gives the input as both and
:

https://wolfram.com/xid/0e7qnceq-hkjl2l

LU decomposition of HilbertMatrix:

https://wolfram.com/xid/0e7qnceq-plddfx

https://wolfram.com/xid/0e7qnceq-df3260

Applications (4)Sample problems that can be solved with this function
The LU decomposition of a matrix decomposes a matrix into lower triangular (
) and upper triangular (
) parts that satisfy
, where
is a column permutation of
:

https://wolfram.com/xid/0e7qnceq-c4nbn8
Extract the lower and upper parts of the decomposition:

https://wolfram.com/xid/0e7qnceq-gz3xy9
Verify the decomposition l.ua〚p〛:

https://wolfram.com/xid/0e7qnceq-m31ba

Illustrate the structure by using MatrixPlot:

https://wolfram.com/xid/0e7qnceq-jfdvej

A triangular linear system is a system of linear equations in which the first equation has one variable and each subsequent equation introduces exactly one additional variable. Rewrite the following system in four variables as two triangular linear systems in eight variables:

https://wolfram.com/xid/0e7qnceq-utykfo
Rewrite the system in matrix form and compute the LU decomposition of
:

https://wolfram.com/xid/0e7qnceq-ha93bo

Extract the and
matrices; as
, the original system can be reordered into
:

https://wolfram.com/xid/0e7qnceq-p162j6

Introduce new variables and set
; the result is a triangular system in
:

https://wolfram.com/xid/0e7qnceq-rbvj77

Substituting into
gives
, a triangular system in
:

https://wolfram.com/xid/0e7qnceq-5550d1

The eight triangular equations together give the same result for as the original system of equations:

https://wolfram.com/xid/0e7qnceq-79mpv3


https://wolfram.com/xid/0e7qnceq-mjwlij

LU decompositions are mainly used to solve linear systems. Here is a 5×5 random matrix:

https://wolfram.com/xid/0e7qnceq-fibngp
LinearSolve[m] sets up an LU decomposition in a functional form convenient for solving:

https://wolfram.com/xid/0e7qnceq-mn9j4p

This solves the system m.x=b for x:

https://wolfram.com/xid/0e7qnceq-buaxd8

Verify that x is indeed the solution:

https://wolfram.com/xid/0e7qnceq-hfiot4

This can be done manually with the output of LUDecomposition as well:

https://wolfram.com/xid/0e7qnceq-p8yto
Extract the lower and upper parts of the decomposition:

https://wolfram.com/xid/0e7qnceq-bwqopo
Solve the system with two backsolves:

https://wolfram.com/xid/0e7qnceq-o0r88d


https://wolfram.com/xid/0e7qnceq-f6id02
Compute the LU decomposition of m:

https://wolfram.com/xid/0e7qnceq-fsrpbp
Up to sign, the determinant of m is given by the product of the diagonal elements of lu:

https://wolfram.com/xid/0e7qnceq-nkgh2f


https://wolfram.com/xid/0e7qnceq-b27cu1

The sign can be fixed using Signature[p]:

https://wolfram.com/xid/0e7qnceq-y6gawz

Properties & Relations (9)Properties of the function, and connections to other functions

https://wolfram.com/xid/0e7qnceq-cwxkjh
Compute the LU decomposition of m:

https://wolfram.com/xid/0e7qnceq-eylbxe
l is the strictly lower‐triangular part of lu with ones assumed along the diagonal:

https://wolfram.com/xid/0e7qnceq-c5utpv

u is the upper‐triangular part of lu:

https://wolfram.com/xid/0e7qnceq-bai9iz

l.u is equal to to the permutation of the rows of m given by p:

https://wolfram.com/xid/0e7qnceq-blg90j

If is a rectangular matrix, the
matrix is square with the same number of rows as
:

https://wolfram.com/xid/0e7qnceq-l5q4gb

https://wolfram.com/xid/0e7qnceq-m9jcql

https://wolfram.com/xid/0e7qnceq-px74na

https://wolfram.com/xid/0e7qnceq-uf2gj5

The matrix has the same shape as
:

https://wolfram.com/xid/0e7qnceq-tfoj9j

The basic identity still holds:

https://wolfram.com/xid/0e7qnceq-h2g3b8

The permutation list returned by LUDecomposition can be converted to a matrix
using PermutationMatrix. The identity
then holds:

https://wolfram.com/xid/0e7qnceq-jcde38

If m decomposes to {lu,p,c}, then Det[m] is the product of the diagonal entries of lu and Signature[p]:

https://wolfram.com/xid/0e7qnceq-wgtz5

If a matrix is singular, the matrix will have a zero along the diagonal:

https://wolfram.com/xid/0e7qnceq-xhpwsp


The CholeskyDecomposition of a positive-definite, Hermitian matrix h:

https://wolfram.com/xid/0e7qnceq-ueo56r


https://wolfram.com/xid/0e7qnceq-i5hit1

This gives a kind of LU decomposition via ConjugateTranspose:

https://wolfram.com/xid/0e7qnceq-uo71ph


https://wolfram.com/xid/0e7qnceq-3x9594

This is generally a different decomposition from the one given by LUDecomposition:

https://wolfram.com/xid/0e7qnceq-7avfg3

The condition number of an invertible numerical matrix is :

https://wolfram.com/xid/0e7qnceq-2zqdkk

https://wolfram.com/xid/0e7qnceq-2cvp38

The value returned by LUDecomposition is only an estimate:

https://wolfram.com/xid/0e7qnceq-sru1t1

https://wolfram.com/xid/0e7qnceq-k6qjny

The condition number of an exact or symbolic matrix is reported as 0:

https://wolfram.com/xid/0e7qnceq-0b6am


https://wolfram.com/xid/0e7qnceq-sgp67l

The condition number is the same condition number reported by LinearSolve[m]

https://wolfram.com/xid/0e7qnceq-70ni6m

https://wolfram.com/xid/0e7qnceq-b5mk67


https://wolfram.com/xid/0e7qnceq-4cup11

Wolfram Research (1996), LUDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/LUDecomposition.html (updated 2024).
Text
Wolfram Research (1996), LUDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/LUDecomposition.html (updated 2024).
Wolfram Research (1996), LUDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/LUDecomposition.html (updated 2024).
CMS
Wolfram Language. 1996. "LUDecomposition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/LUDecomposition.html.
Wolfram Language. 1996. "LUDecomposition." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2024. https://reference.wolfram.com/language/ref/LUDecomposition.html.
APA
Wolfram Language. (1996). LUDecomposition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LUDecomposition.html
Wolfram Language. (1996). LUDecomposition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LUDecomposition.html
BibTeX
@misc{reference.wolfram_2025_ludecomposition, author="Wolfram Research", title="{LUDecomposition}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/LUDecomposition.html}", note=[Accessed: 23-May-2025
]}
BibLaTeX
@online{reference.wolfram_2025_ludecomposition, organization={Wolfram Research}, title={LUDecomposition}, year={2024}, url={https://reference.wolfram.com/language/ref/LUDecomposition.html}, note=[Accessed: 23-May-2025
]}