0
$\begingroup$

The determinant of a triangular matrix is equal to the product of its diagonal entries. Use this fact to develop a routine for computing the determinant of an arbitrary nn matrix $A$ by using its $LU$ factorization. You may use a library routine for Gaussian elimination with partial pivoting to obtain the $LU$ factorization, or you may design your own routine. How can you determine the proper sign for the determinant? To avoid risk of overflow or underflow, you may wish to consider computing the logarithm of the determinant instead of the actual value of the determinant.

I'm not sure what I'm suppose to do here. I use matlab and do [L,U] = lu(A) to the get the $LU$ product, but how does the log come into play?

$\endgroup$
0
$\begingroup$

We have $A = LU$, and $$ \det(A) = \det(L)\det(U) $$ So it suffices to find the determinant of the (triangular!) matrices $L$ and $U$. Assuming that you've decided on the sign of the determinant, the idea with the logs is to note that $$ \log|\det(L)| = \log(|L_{11}L_{22} \cdots L_{nn}|) = \log|L_{11}| + \log|L_{22}| + \cdots + \log |L_{nn}| $$ A similar idea applies to $\det(U)$.

$\endgroup$
  • $\begingroup$ How would I write this in matlab if I don't have the sign of the determinant? I think I'm supposed to use the log to determine the sign $\endgroup$ – user7624476 Feb 26 '17 at 21:06
  • $\begingroup$ You are not supposed to use the log to determine the sign; it's a lot easier than that. Try to think through how you might decide what the sign would be if you were to do this computation by hand $\endgroup$ – Omnomnomnom Feb 26 '17 at 23:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.