0

What is the best way in general to numerically calculate the determinant of a product of two matrices?

Calculate the matrix product first and then calculate the determinant of the result or calculate the determinants of the two matrices and subsequently multiply them?

The determinant calculation is done using tested routines (python-numpy i.e. LAPACK).

TheCat
  • 13
  • "calculate the determinants of the two matrices and subsequently multiply them" - this is the more stable route. Generally, if you can avoid multiplying matrices before computing anything else (determinants, eigenvalues, etc.), do so. – J. M. ain't a mathematician Apr 21 '17 at 10:13
  • It's probably more stable, but determinants in general are rather expensive to calculate. – mathreadler Apr 21 '17 at 10:29

1 Answers1

2

Certainly, compute the two determinants of the factors individually. The matrix product can contain catastrophic roundoff error, destroying any evidence of the actual determinant. For example, consider the product $$ \begin{pmatrix} 1&0\\10^9&1\end{pmatrix}\begin{pmatrix} 1&10^9\\0&1\end{pmatrix} = \begin{pmatrix} 1&10^9\\10^9&10^{18}+1\end{pmatrix}.$$ In IEEE double precision, that's \begin{pmatrix} 1&10^9\\10^9&10^{18}\end{pmatrix} whose determinant is $0$. Taking the product of the determinants of the original two matrics yields the correct answer $1$.

Don Hatch
  • 1,047