My book -Numerical Method- said, The Crout's method (LU Decomposition) formula is given by
$$ \begin{aligned} A&= \begin{bmatrix} a_{11} & a_{12}& a_{13} \\ a_{21} & a_{22}& a_{23} \\ a_{31} & a_{32}& a_{33} \\ \end{bmatrix} \\ L&= \begin{bmatrix} 1& 0& 0 \\ l_{21} & 1& 0 \\ l_{31} & l_{32}& 1 \\ \end{bmatrix} \\ U&= \begin{bmatrix} u_{11} & u_{12}& u_{13} \\ 0 & u_{22}& u_{23} \\ 0 & 0& u_{33} \\ \end{bmatrix} \\ A&=LU\\ \begin{bmatrix} a_{11} & a_{12}& a_{13} \\ a_{21} & a_{22}& a_{23} \\ a_{31} & a_{32}& a_{33} \\ \end{bmatrix} &= \begin{bmatrix} 1& 0& 0 \\ l_{21} & 1& 0 \\ l_{31} & l_{32}& 1 \\ \end{bmatrix} \, \begin{bmatrix} u_{11} & u_{12}& u_{13} \\ 0 & u_{22}& u_{23} \\ 0 & 0& u_{33} \\ \end{bmatrix} \end{aligned} $$
Then i checked on some sites, i got different formula, that is:
$$ \begin{aligned} A&=LU\\ \begin{bmatrix} a_{11} & a_{12}& a_{13} \\ a_{21} & a_{22}& a_{23} \\ a_{31} & a_{32}& a_{33} \\ \end{bmatrix} &= \begin{bmatrix} l_{11}& 0& 0 \\ l_{21} & l_{31}& 0 \\ l_{31} & l_{32}& l_{33} \\ \end{bmatrix} \, \begin{bmatrix} 1 & u_{12}& u_{13} \\ 0 & 1& u_{23} \\ 0 & 0& 1\\ \end{bmatrix} \end{aligned} $$
And, for the formula on my book, it generalized by :
$$u_{pj}=a_{pj}-\sum_{k=1}^{p-1}l_{pk}u_{kj}\quad \tag{ $\begin{align} p&=1,2,3,\ldots,n\\ j&=p,p+1,\ldots,n \end{align}$ }$$
And
$$l_{iq}=\dfrac{a_{iq}-\displaystyle\sum_{k=1}^{q-1}l_{ik}u_{kq}}{u_{qq}}\quad \tag{ $\begin{align} p&=1,2,3,\ldots,n\\ j&=p,p+1,\ldots,n\\ u_{qq}&\ne 0 \end{align}$ }$$
But it doesn't work to reduce
$$ A= \begin{bmatrix} 2 & 3& -1\\ 4 & 4& -3\\ -2 & 3& -1\\ \end{bmatrix} \quad b= \begin{bmatrix} 5\\ 3\\ 1\\ \end{bmatrix} $$
The result of Crout's Method for decomposition is
$$ L=\begin{bmatrix} 1& 0& 0 \\ 2 & 1& 0 \\ -1 & 3& 1 \\ \end{bmatrix} \quad U= \begin{bmatrix} 2& 3& -1 \\ 0 & -2& -1 \\ 0 & 0& 1 \\ \end{bmatrix} $$
And it's wrong, the result of this multiplication didn't match with $A$,
Look at $l_{32}$ (wrong cell result) and $l_{33}$, my book said it always $1$, but when i tried Gaussian LU Decomposition (Another Method of LU Decomposition) i got $l_{33}=-5$ which is the correct answer, that is :
$$L= \begin{bmatrix} 1 & 0& 0\\ 2 & 1& 0\\ -1& -3& -5\\ \end{bmatrix} \quad U= \begin{bmatrix} 2 & 3& -1\\ 0 & -2& -1\\ 0 & 0& 1\\ \end{bmatrix}$$
Is that mean, Crout's method have a limitation or it doesn't work in special case like this?
So, should i always using the Gaussian LU (Ordinary LU Decomposition) instead?
Please help me, i'm tired typing this. I hope someone helps me.
Thanks in advance!
First of all, when you are decomposing $A=LU$ and if
i) $L$ is lower triangular with all diagonal entries as 1, then it is Doolittle's decomposition.
ii) $U$ is upper triangular with diagonal entries as 1, then it is Crout's method.
In your case Doolittle method will give decomposition $A=LU$, where
$ L= \begin{bmatrix} 1 & 0 & 0\\ 2 & 1 & 0 \\ -1 & -3 & 1 \end{bmatrix} $
and $ U= \begin{bmatrix} 2 & 3 & -1\\ 0 & -2 & -1 \\ 0 & 0 & -5 \end{bmatrix} $