views:

438

answers:

2

can anyone tell me which is the best algorithm to find the value of determinant of a matrix of size nXn.

+5  A: 

Here is an extensive discussion.

There are a lot of algorithms.

One simple one is to take the LU decomposition. Then, since

 det M = det LU = det L * det U

and both L and U are triangular, the determinant is a product of the diagonal elements of L and U. That is O(n^3). There are more efficient algorithms.

dfrankow
+5  A: 

If you did an initial research, you've probably found that with N>=4, calculation of a matrix determinant becomes quite complex. Regarding algorithms, I would point you to Wikipedia article on Matrix determinants, specifically the "Algorithmic Implementation" section.

From my own experience, you can easily find a LU or QR decomposition algorithm in existing matrix libraries such as Alglib. The algorithm itself is not quite simple though.

Philibert Perusse