d = det(X)
d = det(X)
is the determinant of the square matrix X
. If X
contains only integer entries, the result d
is also an integer.
Using det(X) == 0
as a test for matrix singularity is appropriate only for matrices of modest order with small integer entries. Testing singularity using abs(det(X)) <= tolerance
is rarely a good idea because it is difficult to choose the correct tolerance. The function rcond(X)
is intended to check for singular and nearly singular matrices. See rcond
for details.
[L,U] = lu(A)
s = +1 or -1 = det(L)
det(A) = s*prod(diag(U))
A = [1 2 3; 4 5 6; 7 8 9]
produces
This happens to be a singular matrix, soA =
1 2 3
4 5 6
7 8 9
d = det(A)
produces
Changingd =
0
A(3,3)
with
A(3,3) = 0;
turns A
into a nonsingular matrix, so now
d = det(A)
produces
d =
27
\
,/
,inv
,lu
,rcond
,rref
(c) Copyright 1994 by The MathWorks, Inc.