Matrix multiplied by inverse is not giving correct answer

6 views (last 30 days)
The inverse of a matrix multiplied by itsef should give an identity matrix but the result I get is this: [0 0 0; -4 0 0; -4 0 0]
  1 Comment
Vladimir Sovkov
Vladimir Sovkov on 26 Jul 2020
Try
det(sym(a))
It is strict zero. Hence, there is no inverse matrix indeed. Matlab is quite correct here.

Sign in to comment.

Answers (1)

David Goodmanson
David Goodmanson on 26 Jul 2020
Matlab is telling you the answer, that the matrix (call it M) is close to singular or badly scaled (singular in this case). M has a ridiculously small condition number of 2e-18. It doesn't have an inverse, and the one it comes up with is due to numerical precision issues.
If M had an inverse, it would be impossible to have a nonzero column vector u such that M*u = 0. However,
M = [1 2 3;4 5 6;7 8 9]
M*[1; -2; 1]
ans =
0
0
0

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!