Tool to calculate and understand LU decomposition, an efficient method for solving systems of linear equations by factoring via triangular matrices.
LU Decomposition - dCode
Tag(s) : Matrix
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
LU decomposition is a technique for factoring a square matrix M into two triangular matrices: a lower triangular matrix L and an upper triangular matrix U such that M=L.U.
The L matrix has 1s on its diagonal and non-zero elements below the diagonal, while the U matrix has non-zero elements above the diagonal and on the diagonal.
This method facilitates the resolution of systems of linear equations (algebra) and certain calculations such as the matrix determinant or matrix inversion.
One method to find the LU decomposition of a matrix is to solve linear equations.
Example: Factorize in L.U the matrix M=[1235]=L⋅U=[10l211]⋅[u11u120u22] The corresponding equations are: 1⋅u11+0⋅0=11⋅u12+0⋅u22=2l21⋅u11+1⋅0=3l21⋅u12+1⋅u22=5 The resolution gives: L=[1031]U=[120−1]
To use LU decomposition, the matrix must be a square matrix (same number of rows and columns).
The matrix (or one of its row permutations) must be invertible. Some matrices may require row permutations to enable factorization, giving rise to LU decomposition with pivoting.
Example: If M11=0 then as M11=l11⋅u11, either l11 or u11 must be zero, which implies that L or U is a singular (non-invertible) matrix. It is then necessary to permute the rows of M so that the first element of the permuted matrix is non-zero.
Pivoting in LU decomposition consists of permuting the rows of matrix A to avoid zeros on the main diagonal of matrix U.
If pivoting is required, dCode reports the permutation matrix P and the resulting modified matrix P.M. The matrices L and U found are such that L.U=P.M
dCode retains ownership of the "LU Decomposition" source code. Any algorithm for the "LU Decomposition" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "LU Decomposition" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "LU Decomposition" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "LU Decomposition" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: LU Decomposition on dCode.fr [online website], retrieved on 2025-04-19,