Skip to Main Content Skip to Search
Product Documentation

det - Matrix determinant

Syntax

d = det(X)

Description

d = det(X) returns the determinant of the square matrix X.

Tips

Testing singularity using abs(det(X)) <= tolerance is not recommended as it is difficult to choose the correct tolerance. The function cond(X) can check for singular and nearly singular matrices.

Algorithms

The determinant is computed from the triangular factors obtained by Gaussian elimination

[L,U] = lu(A)
s =  det(L)        % This is always +1 or -1 
det(A) = s*prod(diag(U))

Examples

The statement A = [1 2 3; 4 5 6; 7 8 9]

produces

A =
     1       2       3
     4       5       6
     7       8       9

This happens to be a singular matrix, so det(A) produces a very small number. Changing A(3,3) with A(3,3) = 0 turns A into a nonsingular matrix. Now d = det(A) produces d = 27.

See Also

Arithmetic Operators \,/ | cond | condest | inv | lu | mldivide | rref

  


Free MATLAB Interactive Kit

Explore how to use MATLAB to make advancements in engineering and science.


Download free kit

Trials Available

Try the latest version of MATLAB and other MathWorks products.


Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS