Create matrices A 53 7 1 0 6 4 8 9 B 3 2 1 6 8 7 4 4 0 and
Create matrices A = [5-3 7 1 0 -6 -4 8 9] B = [3 2 -1 6 8 --7 4 4 0] and C = [-9 8 3 1 7 -5 3 3 6] Calculate A + B and B + A to show that addition of matrices is commutative. Calculate A * (B * C) and (A * B) * C to show that multiplication of matrices is associative. Calculate 5 (B + C) and 5B + 5C to show that, when matrices are multiplied by a scalar, the multiplication is distributive. Calculate (A + B) * C and A*C + B*C to show that matrix multiplication is distributive.
Solution
a = [5 3 -7;1 0 -6;-4 8 9];
b = [3 2 -1;6 8 -7;4 4 0];
c = [-9 8 3;1 7 -5;3 3 6];
d = a+b;
e = b+a;
if(d == e)
disp(\"Addition is commutative\");
end
d = a*(b*c);
e = (a*b)*c;
if(d == e)
disp(\"Multiplication is associative\");
end
d = 5*(b+c);
e = 5*b+5*c;
if(d == e)
disp(\"Multiplication by scalar is distributive\");
end
d = (a+b)*c;
e = a*c + b*c;
if(d == e)
disp(\"Multiplication is distributive\");
end
![Create matrices A = [5-3 7 1 0 -6 -4 8 9] B = [3 2 -1 6 8 --7 4 4 0] and C = [-9 8 3 1 7 -5 3 3 6] Calculate A + B and B + A to show that addition of matrices Create matrices A = [5-3 7 1 0 -6 -4 8 9] B = [3 2 -1 6 8 --7 4 4 0] and C = [-9 8 3 1 7 -5 3 3 6] Calculate A + B and B + A to show that addition of matrices](/WebImages/34/create-matrices-a-53-7-1-0-6-4-8-9-b-3-2-1-6-8-7-4-4-0-and-1101205-1761581876-0.webp)