yields the LDL decomposition of the Hermitian matrix m as a pair {l,d}, where m==l.d.ConjugateTranspose[l].
LDLDecomposition
yields the LDL decomposition of the Hermitian matrix m as a pair {l,d}, where m==l.d.ConjugateTranspose[l].
Details and Options
- The LDL decomposition is used as a solver for linear systems involving Hermitian matrices. It is typically faster than the LU decomposition.
- The LDL decomposition is also known as the square-root-free Cholesky decomposition, the LDU decomposition and the LDLT decomposition.
- In the pair
returned by LDLDecomposition[m],
is lower triangular with
s on the diagonal, and
is diagonal and real valued. - The decomposition
can be visualized as follows: - LDLDecomposition takes the following option:
-
TargetStructure Automatic the structure of the returned matrices - Possible settings for TargetStructure include:
-
Automatic, "Structured" return l as a LowerTriangularMatrix object and d as a DiagonalMatrix object "Dense" return both matrices as lists of lists "Sparse" return both matrices as SparseArray objects - LDLDecomposition extends CholeskyDecomposition to Hermitian matrices that are not positive definite, at the cost of introducing the diagonal matrix
in additional to the triangular matrix. - For positive definite matrices, the LDL decomposition
and the Cholesky decomposition
are related by
. » - The LDL decomposition of an indefinite matrix is not guaranteed to exist. »
- A sufficient condition for the LDL decomposition to exist is that all of the leading principal minors of the input are nonzero. »
- BunchKaufmanDecomposition generalizes LDLDecomposition by allowing
blocks in the diagonal matrix and adding a permutation matrix to the decomposition. This generalization guarantees existence of the decomposition even for indefinite matrices. However, it is possible for both decompositions to exist and differ. » - If LUDecomposition[m] gives {l1,u,p,c} and LDLDecomposition[m] gives {l2,d}, then when p is the identity matrix, l1l2 and u and d have the same diagonal entries. »
Examples
open all close allBasic Examples (2)
Compute the LDL decomposition of a real symmetric matrix:
{l, d} = LDLDecomposition[(| | |
| - | - |
| 2 | 6 |
| 6 | 7 |)]{MatrixForm[l], MatrixForm[d]}Reconstruct the original matrix:
l.d.Transpose[l]//MatrixFormCompute the LDL decomposition of a complex Hermitian matrix:
{l, d} = LDLDecomposition@(| | | |
| ------- | ------- | ------ |
| 1 | 4 + 5 I | 6 + 7I |
| 4 - 5 I | 2 | 8 + 9I |
| 6 - 7I | 8 - 9I | 3 |)MatrixForm /@ %Reconstruct the original matrix:
l.d.ConjugateTranspose[l]//MatrixFormScope (8)
Basic Uses (5)
LDL decomposition for a machine-precision real symmetric matrix:
MatrixForm /@ LDLDecomposition[(| | | | |
| ----- | ----- | ----- | ----- |
| 1.46 | -1.01 | 0.49 | -2.62 |
| -1.01 | 2.19 | 0.34 | 0.21 |
| 0.49 | 0.34 | -0.71 | -0.01 |
| -2.62 | 0.21 | -0.01 | 0.71 |)]LDL decomposition for a machine-precision complex Hermitian matrix:
MatrixForm /@ LDLDecomposition[(| | | |
| -------------- | -------------- | -------------- |
| -0.42 | 0.93 - 0.59 I | 1.34 + 0.44 I |
| 0.93 + 0.59 I | 0.87 | -1.26 - 0.02 I |
| 1.34 - 0.44 I | -1.26 + 0.02 I | -0.88 |)]Use LDLDecomposition with an exact matrix:
MatrixForm /@ LDLDecomposition[(| | | |
| ----------- | ----------- | ----- |
| 1 | 2 + Sqrt[2] | 3 + π |
| 2 + Sqrt[2] | E | I |
| 3 + π | -I | 0 |)]LDL decomposition for an arbitrary-precision matrix:
MatrixForm /@ LDLDecomposition[RandomVariate[GaussianOrthogonalMatrixDistribution[3], WorkingPrecision -> 30]]The precision of the result is roughly equal to, but typically lower than, the precision of the input:
Precision[%]LDL decomposition for a symbolic matrix:
MatrixForm /@ LDLDecomposition[(| | |
| ------------ | - |
| 1 | a |
| Conjugate[a] | 5 |)]Special Matrices (3)
LDL decomposition of a sparse matrix:
SparseArray[{{2, 1} -> 5, {1, 1} -> π, {1, 2} -> 5, {3, 3} -> 2}, {3, 3}]MatrixForm /@ LDLDecomposition[%]LDL decomposition reduction of structured matrices:
SymmetrizedArray[{{1, 1} -> π, {2, 2} -> 5, {2, 3} -> 7, {3, 2} -> 13}, {3, 3}, Symmetric[All]]LDLDecomposition[%]MatrixForm /@ %For arrays with units, the units are carried in the diagonal matrix:
q = QuantityArray[{{1, 3, -5}, {3, 5, 7}, {-5, 7, -9}}, "Meters"]MatrixForm /@ LDLDecomposition[q]The LDL decomposition of an identity matrix is trivial:
LDLDecomposition[IdentityMatrix[3]]MatrixForm /@ %Options (2)
TargetStructure (2)
LDLDecomposition by default returns LowerTriangularMatrix and DiagonalMatrix object:
mat = Symmetrize[RandomComplex[{-1 - I, 1 + I}, {4, 4}], Hermitian[{1, 2}]];
{l, d} = LDLDecomposition[mat]Obtain the result as normal, dense matrices:
{ld, dd} = LDLDecomposition[mat, TargetStructure -> "Dense"]The two forms are equivalent representations:
{ld == l, dd == d}Obtain the decomposition as two sparse matrices:
LDLDecomposition[Symmetrize[RandomComplex[1, {4, 4}]], TargetStructure -> "Sparse"]Applications (1)
Not all Hermitian matrices have an LDL decomposition, but a sufficient condition for existence is that all of the principal minors are nonzero. That is, the determinants of all
submatrices starting from the top-left corner are nonzero. Define a function to compute the leading principal minors:
lpm[m_ ? SquareMatrixQ] := First /@ First /@ Table[Minors[m, k], {k, Length[m]}]The matrix m has a zero principal minor, so it may not have an LDL decomposition:
m = {{1, 3, 5}, {3, 5, 7}, {5, 7, 9}};
lpm[m]LDLDecomposition[m1]The following modification of m moves, but does not eliminate, the zero minor:
m2 = {{0, 3, 5}, {3, 5, 7}, {5, 7, 9}};
lpm[m2]This matrix also does not have an LDL decomposition:
LDLDecomposition[m2]However, this modification of m has all nonzero principal minors, so it should have a decomposition:
m3 = {{1, 3, 5}, {3, 5, 7}, {5, 7, 10}};
lpm[m3]LDLDecomposition[m3]Properties & Relations (4)
CholeskyDecomposition[m] can be computed from LDLDecomposition[m] as
:
m = DiagonalMatrix[Range[3]] + Symmetrize[RandomComplex[.1 + .1I, {3, 3}], Hermitian[{1, 2}]];
{l, d} = LDLDecomposition[m];
c = CholeskyDecomposition[m];
c == Sqrt[d].ConjugateTranspose[l]Conversely,
contains the square of the diagonal elements of
:
d == DiagonalMatrix[Diagonal[c]^2]And
is the adjoint of the (upper triangular) Cholesky matrix normalized by its diagonal:
l == ConjugateTranspose[c / Diagonal[c]]CholeskyDecomposition requires use of square roots:
mat = Symmetrize[{{a, b}, {c, d}}, Hermitian[{1, 2}]];
CholeskyDecomposition[mat]LDLDecomposition avoids this:
LDLDecomposition[mat, TargetStructure -> "Dense"]The LDL decomposition can be computed directly from LUDecomposition when the latter returns a trivial permutation:
mat = {{3, -4, 5}, {-4, 8, -2}, {5, -2, 11}};
{Subscript[l, 1], d} = LDLDecomposition[mat];
{Subscript[l, 2], u, perm, c} = LUDecomposition[mat];
perm == IdentityMatrix[3]The two lower diagonal matrices are the same, and the diagonal entries of
and
are the same:
Subscript[l, 1] == Subscript[l, 2] && Diagonal[d] == Diagonal[u]For the following matrix, BunchKaufmanDecomposition does not use pivoting and the block diagonal matrix has no
blocks:
noPivotDiagonal = SymmetrizedArray[StructuredArray`StructuredData[{4, 4},
{{{1, 1} -> 0.9522358578605561, {1, 2} -> 0.6623050421076754, {1, 3} -> 0.17625258657137377,
{1, 4} -> 0.4947848612877843, {2, 2} -> 0.28112053171866624, {2, 3} -> 0.14335614166718358,
{2, 4} -> 0.39283020246124734, {3, 3} -> 0.6313091437316813, {3, 4} -> 0.5768535073588343,
{4, 4} -> 0.9640275388436799}, Hermitian[{1, 2}]}]];
{l, b, p} = BunchKaufmanDecomposition[noPivotDiagonal];
{p == IdentityMatrix[Length[noPivotDiagonal]], DiagonalMatrixQ[b]}As a result, the Bunch–Kaufman decomposition coincides with the LDL decomposition:
{ℓ, d} = LDLDecomposition[noPivotDiagonal];
l == ℓ && d == bFor the following matrix, BunchKaufmanDecomposition does not use pivoting, but there are
blocks:
noPivotBlocks = SymmetrizedArray[StructuredArray`StructuredData[{4, 4},
{{{1, 1} -> 0.31409114975717345, {1, 2} -> 0.9296201158260893, {1, 3} -> 0.4380740997319761,
{1, 4} -> 0.3863400364059515, {2, 2} -> 0.4120399083786235, {2, 3} -> 0.7411387665471949,
{2, 4} -> 0.46915083394191914, {3, 3} -> 0.38601806205067835, {3, 4} -> 0.7551830977005005,
{4, 4} -> 0.23956653728429456}, Hermitian[{1, 2}]}]];
{l, b, p} = BunchKaufmanDecomposition[noPivotBlocks];
{p == IdentityMatrix[Length[noPivotBlocks]], DiagonalMatrixQ[b]}Consequently, the Bunch–Kaufman decomposition differs from the LDL decomposition:
{ℓ, d} = LDLDecomposition[noPivotBlocks];
l == ℓ || d == bFinally, for this matrix, BunchKaufmanDecomposition uses pivoting:
pivotDiagonal = SymmetrizedArray[StructuredArray`StructuredData[{4, 4},
{{{1, 1} -> 0.47619054005221373, {1, 2} -> 0.41489787499498676, {1, 3} -> 0.826113894123858,
{1, 4} -> 0.2787158070316167, {2, 2} -> 0.7485827836683288, {2, 3} -> 0.20876586927526475,
{2, 4} -> 0.37069120649409415, {3, 3} -> 0.5480360624388212, {3, 4} -> 0.5333605049010796,
{4, 4} -> 0.19683262635198728}, Hermitian[{1, 2}]}]];
{l, b, p} = BunchKaufmanDecomposition[pivotDiagonal];
{p == IdentityMatrix[Length[pivotDiagonal]], DiagonalMatrixQ[b]}Even though the matrix
is diagonal, it cannot be the same as the matrix
returned by LDLDecomposition:
{ℓ, d} = LDLDecomposition[pivotDiagonal];
l == ℓ || d == bPossible Issues (1)
The matrix m is a real symmetric, indefinite matrix:
m = {{0, 2, 1}, {2, 2, 3}, {1, 3, 4}};
SymmetricMatrixQ[m] && IndefiniteMatrixQ[m]LDLDecomposition fails for m:
LDLDecomposition[m]Consider using BunchKaufmanDecomposition, which uses permutation and block diagonal matrices to guarantee a solution:
BunchKaufmanDecomposition[m]In this particular case, the block diagonal matrix is actually diagonal:
MatrixForm /@ %Alternatively, a small perturbation of entries permuted by BunchKaufmanDecomposition will typically produce an LDL decomposition:
LDLDecomposition[m + DiagonalMatrix[{.01, 0, 0}]]MatrixForm /@ %Related Guides
History
Text
Wolfram Research (2026), LDLDecomposition, Wolfram Language function, https://reference.wolfram.com/language/ref/LDLDecomposition.html.
CMS
Wolfram Language. 2026. "LDLDecomposition." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/LDLDecomposition.html.
APA
Wolfram Language. (2026). LDLDecomposition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/LDLDecomposition.html
BibTeX
@misc{reference.wolfram_2026_ldldecomposition, author="Wolfram Research", title="{LDLDecomposition}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/LDLDecomposition.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_ldldecomposition, organization={Wolfram Research}, title={LDLDecomposition}, year={2026}, url={https://reference.wolfram.com/language/ref/LDLDecomposition.html}, note=[Accessed: 13-June-2026]}