Matrix: determinant & Diagonal

There is a question that comes up in my mind after I watched Prof. Gilbert Strang's lectures. He was saying:

For any matrix $A$, Since $A = LU$, $\det(A) = \det(LU)$ and $\det(L) = 1$, hence $\det(A) = \det(U)$, furthermore, $\det(U) = \det(D)$ when $U$ is the upper triangular and $D$ is the diagonal.

Then do I get the conclusion that $\det(A) = \det(D)$???

However, I don't think this is the case, to the least, not true in 2-D, as we all know what is the formula of determinant of a 2-D matrix.

Am I missing something here? Thanks!

• It sounds like you're showing that $\det A=\det U$ and then $\det U=\det D$. With this it is immediate that $\det A=\det D$, correct? – Brian Fitzpatrick Sep 1 '14 at 4:10

One remark first, the determinant is defined for square matrices, not for vectors. Maybe the problem here is you view $D$ as a vector, whereas what is meant is "the square matrix with the same diagonal as $U$ and zeros everywhere else".

The LU decomposition yields a lower triangular matrix $L$ and an upper triangular matrix $U$ with

$$A=LU$$

The the determinant of a product is always the product of the determinants, it's perfectly safe to write

$$\det A=\det L \det U$$

Now, the determinant of a triangular matrix is the product of it's diagonal elements, and $L$ has only ones in its diagonal, whereas the diagonal of $U$ may be called $D$, and

$$\det A=\det D$$

For example, with $A=\left(\begin{matrix} 1 & 0 & 1 \\ 2 & 1 & 0 \\ 1 & 2 & 2 \\ \end{matrix}\right)$, you get the factorization

$$A=\left(\begin{matrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 1 & 2 & 1 \\ \end{matrix}\right)\cdot\left(\begin{matrix} 1 & 0 & 1 \\ 0 & 1 & -2 \\ 0 & 0 & 5 \\ \end{matrix}\right)$$

And of course

$$\det \left(\begin{matrix} 1 & 0 & 0 \\ 2 & 1 & 0 \\ 1 & 2 & 1 \\ \end{matrix}\right)=\det \left(\begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{matrix}\right)=1$$

$$\det \left(\begin{matrix} 1 & 0 & 1 \\ 0 & 1 & -2 \\ 0 & 0 & 5 \\ \end{matrix}\right)=\det \left(\begin{matrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 5 \\ \end{matrix}\right)=5$$

Hence $\det A=5$.

There is another $LU$ factorization, with ones in the diagonal of $U$ instead of $L$, but of course that does not change the answer, if $D$ is the diagonal of $L$.

There may be another concern: often, the $LU$ decomposition is written

$$PA=LU$$

Where $P$ is a permutation matrix. If happens when pivoting is used in de $LU$ decomposition.

Then $\det P \det A=\det L\det U$, but $\det P=\pm1$, since a permutation matrix is always orthogonal. Thus you must be careful with the sign of $\det A$. And $\det P$ is simply the sign of the permutation on which $P$ is based.

• Thanks very much for the explanation Jean. Now I think where I got confused are the following points: 1. Somehow, I thought during the LU process, A's diagonal entries do not have to change, but I guess this is not true. 2. det(D) = product of diagonals, however det(A) is not equal to its diagonal entries. – Yue Harriet Huang Sep 1 '14 at 4:31
• A determinant is equal to the product of diagonal entries usually only when the matrix is diagonal or triangular (it may happen in other cases, but it's not guaranteed). – Jean-Claude Arbaut Sep 1 '14 at 4:34
• @YueHarrietHuang Your guess is right, the diagonal elements of $U$ are not necessarily the same as those of $A$. There is also the "PA=LU" decomposition, see my edit above. – Jean-Claude Arbaut Sep 1 '14 at 5:29