MATLAB determine if matrices are invertible or not

134 ビュー (過去 30 日間)
ssmith
ssmith 2021 年 11 月 16 日
回答済み: James Tursa 2021 年 11 月 16 日
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

回答 (2 件)

David Goodmanson
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.

James Tursa
James Tursa 2021 年 11 月 16 日

カテゴリ

Help Center および File ExchangeElectrical Block Libraries についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by