LT is an upper triangular matrix, so we can consider replacing U in A=LU with U:=DLT. As general conditions become stricter than for the LU decomposition, the amount of computation significantly decreases.
Theorem
For the invertible symmetric matrix A, there exist a lower triangular matrix L and a diagonal matrixD satisfying A=LDLT.
In the LU decomposition, L is obtained as a lower triangular matrix with all diagonal elements as 1, so detL=1, indicating that the inverse matrix L−1 exists. Since L−1 is a lower triangular matrix and
LU=UTLT
is rearranged for U,
U=L−1UTLT
multiplying both sides by (LT)−1 on the right,
U(LT)−1=L−1UT
is obtained. Since the left side of U(LT)−1=L−1UT is an upper triangular matrix and the right side is a lower triangular matrix,
D:=U(LT)−1=L−1UT
is a diagonal matrix. Rearranging this for U, it becomes U=DLT, and we obtain the following:
A=LU=LDLT
■
Calculation
Now, to specifically calculate L and D, let’s define as follows:
Suppose (aij)∈Rn×n is an invertible symmetric matrix.
**Step 1. k=1
Substitute d11=a11 and calculate li1=d111ai1.
**Step 2. k=2,3,⋯,n−1
Step 2-1. Calculate the following:
dkk=akk−ν=1∑k−1dννlkν2
Step 2-2. For i=k+1,k+2,⋯,n−1, calculate the following:
lik=dkk1{aik−ν=1∑k−1liνdννlkν}
Step 3. For k=n, calculate the following:
dnn=ann−ν=1∑n−1dννlnν2
Although calculations seemed complex when done manually, organizing them into an algorithm significantly reduces the computational workload. Always remember to first solve for the diagonal components of D and then compute the values of L column by column.
Code
Now, let’s take an example similar to the one used in LU decomposition and perform LDU decomposition.
The following code implements the above algorithm in R.