MATLAB determine if matrices are invertible or not
94 次查看(过去 30 天)
显示 更早的评论
I have two matrices that I am looking to find the determinants of and see if they are invertible or not.
I entered in my matrices and used det() to get the determinant for each.
P = [8, 11, 2, 8; 0, -7, 2, -1; -3, -7, 2, 1; 1, 1, 2, 4]
Q = [1, -2, 0, 5; 0, 7, 1, 5; 0, 4, 4, 0; 0, 0, 0, 2]
det(P+Q)
det(P-Q)
det(P*Q)
det(P^(-1))
If anyone can tell me why MATLAB is not giving me the determinant of 0 for the non invertible matrix that would be very helpful. Thank you
0 个评论
回答(2 个)
David Goodmanson
2021-11-16
编辑:David Goodmanson
2021-11-16
Hi SS
P+Q
ans =
9 9 2 13
0 0 3 4
-3 -3 6 1
1 1 2 6
det(P+Q)
ans = 4.4964e-15
cond(P+Q)
ans = 5.4780e+17
P+Q is clearly noninvertable since the first and second columns are identical. But you can't expect to get 0 for the determinant since there are computational precision issues. Something like e-15 is pretty typical.
Incidentally, to see if a matrix is noninvertable, cond(M) is much better than det(M). In this case you know that all the matrix entries are on the order of 1, so the determinant does tell you something, but in general det is not a good indication. For one thing, there is scaling. if you multiply the matrix by 100, then det becomes 4.4964e--7, eight orders of magnitude larger. But P+Q is just as noninverable as before. Meanwhile cond does change a bit, which I found surprising, but in both cases it is up above 10^17, showing that P+Q is likely noninvertable.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!