Technical Solutions
Why is the result of multiplying a matrix by its inverse different from the identity matrix returned by the EYE function in MATLAB?
Date Last Modified: Friday, June 26, 2009
| Solution ID: | 1-536MBF | |
| Product: | MATLAB | |
| Reported in Release: | No Release | |
| Platform: | All Platforms | |
| Operating System: | All OS |
Subject:
Why is the result of multiplying a matrix by its inverse different from the identity matrix returned by the EYE function in MATLAB?
Problem Description:
I created a matrix and computed its inverse using the INV command. However, when I multiply them together, and compare the result to the identity matrix using the ISEQUAL function, the result is 'false' or 0. For example:
a = rand(5);
b = inv(a);
isequal(a*b,eye(5))
ans =
0
Solution:This behavior is related to floating-point arithmetic and the way numbers are represented in a computer. For more information on this subject, see the related Solution below. |
Related Solutions:
|
|
Store

