det
Determinant of a square matrix.
Category: Mathematics > Linear Algebra
Syntax
d = det(A)
Returns the determinant of A.
Description
det factors the matrix with lu and multiplies the diagonal of U by the sign of the permutation. The result is exact for small integer matrices only up to rounding, so a singular matrix can return a tiny nonzero value instead of 0.
The determinant is a poor test for singularity, because it scales with the entries: multiplying an n-by-n matrix by 10 multiplies the determinant by 10^n. Use rank or cond instead.
Input arguments
A- Square matrix.
Output arguments
d- Scalar determinant. The determinant of an empty matrix is 1.
Example
Small matrices
det([1 2; 3 4])
det(magic(3))
det(eye(3))
det([])
Output
ans = -2
ans = -360
ans = 1
ans = 1