I have the following code. I am trying to show a property with matrix inverses. Specifically:
inv(A*B) = inv(B)*inv(A)
I have written the following code:
disp("Verifying if inv(A*B) = inv(B)*inv(A)");
A = [1 2 ; 3 4]
B = [1 6 ; 5 7]
format short
E = A*B;
C = inv(E);
disp("inv(A*B) is :"), disp(rats(C));
D = inv(B)*inv(A);
disp("inv(B)*inv(A) is :"), disp(rats(D));
if (isequal(C,D))
disp("Yes they are equal");
else
disp("No they are not equal");
endif
This is the output I am receiving:
Verifying if inv(A*B) = inv(B)*inv(A)
A =
1 2
3 4
B =
1 6
5 7
inv(A*B) is
1 -10/23
-1/2 11/46
inv(B)*inv(A) is :
1 -10/23
-1/2 11/46
No they are not equal
How come the statement is not equal?