Why we use LDU factorization rather than LU factorization? Why people make and use LDU factorization?
I think LU factorization and PA = LU are enough to solve equation.
Anyone know why?
 A: An important thing to keep in mind when discussing numerical linear algebra is that algorithms/factorizations/etc. that may be equivalent in exact arithmetic may have very important accuracy differences when implemented in floating point arithmetic. As you suggest, an $LU$ factorization, with partial pivoting, can easily by converted to an $LDU$ decomposition. Simply take $D$ to be the diagonal of $U$ and then we have $PA = LD(D^{-1}U)$, which is an $LDU$ factorization with a new triangular factor $D^{-1}U$. For a general nonsymmetric $A$, I see no reason to use $LDU$ over $LU$ for solving $Ax = b$. But are other circumstances where $LDU$ is appropriate. Let me present two reasons why one might prefer an $LDU$ decomposition.
The first is the $LDL^T$ factorization, as mentioned by other answers. For a symmetric positive definite matrix, then $LDL^T$ decomposition allows us to compute a factorization without computing any square roots. But this is more-or-less small potatoes: evaluating $n$ square roots isn't really a big deal when you're doing roughly $n^3$ operations to compute the factorization. However, for indefinite matrices (not necessarily positive definite), the $LDL^T$ factorization may be a much bigger deal. For an indefinite matrix, the entries of $D$ are allowed to be positive, negative, or zero and $L$ is, as usual, unit lower triangular. Unfortunately, even with symmetric pivoting (replacing $A$ with $PAP^T$), the $LDL^T$ factorization is not guaranteed to exist.${}^*$ However, if we relax the condition that $D$ be diagonal to merely being block diagonal with $1\times 1$ or $2\times 2$ blocks, then the $LDL^T$ fatorization is guaranteed to exist.
The $LDL^T$ factorization provides two benefits over a vanilla $LU$ factorization for a symmetric indefinite matrix.


*

*It can be computed and stored using only $\approx n^2/2$ (rather than $n^2$) entries, if we take advantage of the symmetry of $A$.

*The $LDL^T$ factorization allows for easy determination of the inertia of $A$, as $D$ and $A$ have the same inertia.


Here's another example. Often, we have an $n\times n$ matrix $A$ which is of low-rank $r \ll n$. Such a matrix is guaranteed to have a factorization of the form $A = BRV^T$, where $B$ and $V$ are $n\times r$ matrices and $R$ is $r\times r$ and nonsingular. Such a factorization is called a rank-revealing factorization of $A$. The matrices $B$ and $V$ are bases of the column and row space of $A$, respectively. For reasons of numerical accuracy, we are interested in choosing bases $B$ and $V$ which are well-conditioned, which loosely means that the columns of $B$ and $V$ aren't even close to being linearly dependent.
Such a rank-revealing factorization can be computed using an $LU$ factorization. However, if one does this, the $U$ and $V$ matrix can be terribly conditioned. However, if one computes an $LDU$ factorization and uses complete pivoting, one ends up with a factorization of the form $PAQ^T = LDU$, where $L$ and $U$ are unit lower triangular. Moreover, $L$ and $U$ are guaranteed to be well-conditioned${}^\dagger$. If the matrix $A$ has rank $r$, all but $r$ entries of the diagonal matrix $D$ will be tiny and the $LDU$ factorization can be truncated to give a rank-revealing factorization of $A$. This shows how $LDU$ can be more generally useful in numerical linear algebra: the ill-conditioning of the matrix $A$ has been effectively quarantined inside the diagonal matrix $D$, which can sometimes be cleverly exploited to perform accurate computations.

${}^*$ The exchange matrix $\begin{bmatrix} 0 & 1 \\ 1 & 0 \end{bmatrix}$ is an example.
${}^\dagger$ In the worst case, the $\infty$-norm condition number of $L$ and $U$ may be as high as $n2^{n-1}$. This upper bound is often dramatically pessimistic, and in practice $L$ and $U$ are often very well-conditioned. See pg. 182 of Higham's Accuracy and Stability of Numerical Algorithms for a further discussion.
A: Expanding on what J W linked, let the matrix be positive definite be such that it can be represented as a Cholesky decomposition, $A = LL^{-1}$, we can determine that $L_{11} = \sqrt{A_{11}}$
If we instead let $A = LDL^{-1}$, we can instead set the diagonal of $L$ to unity and let $D_{11} = A_{11}$
This produces the same result but allows us to avoid having to compute $\sqrt{A_{11}}$
