[Math] Stuck with LDU-factorization of a matrix where D should contain zeros

linear algebramatricesmatrix decomposition

I thought that L-D-U- factorization of a square matrix (L=lower triangular factor, D=diagonal factors, U=upper triangular factor) was always possible and meaningful even if I encounter zeros on the diagonal factor D. But my algorithm is not correct in that cases in that the resulting factors do not reproduce the source.
Let $$ M = \begin{bmatrix}
1& 2& 3& 4& 5\\
2& 4& 6& 8& 0\\
3& 6& 9& 2& 5\\
4& 8& 2& 6& 0\\
5& 0& 5& 0& 5
\end{bmatrix}$$
which is just the top-left of the basic $10 \times 10$ multiplication-table (modulo $10$). It has full rank; but in the naive LDU-algorithm one would assign zeros to some entries of D because zeros occur in the top-left element of the intermediate matrices of the iteration. If I do that, I get LDU-components
$$\small L=\begin{bmatrix}
1 & 0 & 0 & 0 & 0 \\
2 & 1 & 0 & 0 & 0 \\
3 & 0 & 1 & 0 & 0 \\
4 & 0 & 0 & 1 & 0 \\
5 & 0 & 0 & 2 & 1 \\
\end{bmatrix}
D= \begin{bmatrix}
1 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0 & 0 \\
0 & 0 & 0 & -10 & 0 \\
0 & 0 & 0 & 0 & 20 \end{bmatrix}
U=\begin{bmatrix}
1 & 2 & 3 & 4 & 5 \\
0 & 1 & 0 & 0 & 0 \\
0 & 0 & 1 & 0 & 0 \\
0 & 0 & 0 & 1 & 2 \\
0 & 0 & 0 & 0 & 1 \\
\end{bmatrix}$$
and if I put them together they don't reproduce the source M:
$$ \text{chk}=L \cdot D \cdot U = \small \begin{bmatrix}
1 & 2 & 3 & 4 & 5 \\
2 & 4 & 6 & 8 & 10 \\
3 & 6 & 9 & 12 & 15 \\
4 & 8 & 12 & 6 & 0 \\
5 & 10 & 15 & 0 & 5
\end{bmatrix}$$
The problem is not, that the matrix-rank of M were not sufficient – Pari/GP gives the inverse and even the diagonalization.

Q: Can this be repaired? Can a meaningful L-D-U-decomposition be given?

Of course, if a general argument exists why and when invertible/diagonalizable matrices cannot be LU or LDU-decomposed I'd like to learn that, too.

Best Answer

If you look at my comments, you can see a permuted solution and the details of an $A = LDU$ factorization for your matrix.

This nice write-up includes the Necessary And Sufficient Conditions For Existence of the LU Factorization of an Arbitrary Matrix and includes the answers to your question.

Lastly, here is a nice Corollary in the Matrix Analysis book by Horn and Johnson. Worth perusing all of Section $3.5$ in addition to the corollary on the $LDU$ factorization.

Related Question