Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create the following three matrices: A = [1 -3 5 2 2 4 -2 0 6] B = [0 -2 1 5 1 -

ID: 3924984 • Letter: C

Question

Create the following three matrices: A = [1 -3 5 2 2 4 -2 0 6] B = [0 -2 1 5 1 -6 2 7 -1] C = [-3 4 1 0 8 2 -3 5 3] (a) Calculate A + B and B + A to show that addition of matrices is commutative. (b) Calculate A + (B + C) and (A + B) + C to show that addition of matrices is associative. (c) Calculate 3 (A + C) and 3A +3C to show that, when matrices are multiplied by a scalar, the multiplication is distributive. (d) Calculate A*(B + C) and A*B + A*C to show that matrix multiplication is distributive. Use the matrices A, B, and C from the previous problem to answer the following: (a) Does A*B = B*A ? (b) Does A*(B*C) = (A*B)*C? (c) Does (A*B)^t = A^t*B^t (^t means transpose) (d) Does (A + B)^t = A^t + B^t?

Explanation / Answer

(a)
%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking A+B = B+A')
disp('A+B')
A+B
disp('B+A')
B+A

Result fro matlab console:
Checking A+B = B+A
A+B
ans =
1 -5 6
7 3 -2
-4 0 12
B+A
ans =
1 -5 6
7 3 -2
-4 0 12

A+B and B+A is commutative

(b)

%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking A+(B+C) = (A+B)+C)')
disp('A+(B+C)')
(A+B)+C
disp('(A+B)+C')
A+(B+C)

Result:
Checking A+(B+C) = (A+B)+C)
A+(B+C)
ans =
-2 -1 5
7 11 0
-7 5 15
(A+B)+C
ans =
-2 -1 5
7 11 0
-7 5 15

(c)
%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking 3*(A+C) = 3*A+3*C')
disp('3*(A+B)')
3*(A+B)
disp('3*A+3*B')
3*A+3*B

Result:
Checking 3*(A+C) = 3*A+3*C
3*(A+B)
ans =
   3 -15 18
21   9 -6
-12   0 36
3*A+3*B
ans =
   3 -15 18
21   9 -6
-12   0 36

(d)

%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking A*(B+C) = A*B+A*C')
disp('A*(B+C)')
A*(B+C)
disp('A*B+A*C')
A*B+A*C

Result:
Checking A*(B+C) = A*B+A*C
A*(B+C)
ans =
-43   0 57
-16 42 28
-24 26 54
A*B+A*C
ans =
-43   0 57
-16 42 28
-24 26 54

(30)
(a)
%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking A*B = B*A')
disp('A*B')
A*B
disp('B*A')
B*A

Result:
Checking A*B = B*A
A*B
ans =
-25 -5 49
   2 -2 14
-12   4 34
B*A
ans =
-6 -4 -2
19 -13 -7
-14   6 26

AB is not equal to BC
(b)
%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking A*(B*C) = (A*B)*C)')
disp('A*(B*C)')
A*(B*C)
disp('(A*B)*C')
(A*B)*C

Result:
Checking A*(B*C) = (A*B)*C)
A*(B*C)
ans =
-72 105 162
-48 62 36
-66 154 122
(A*B)*C
ans =
-72 105 162
-48 62 36
-66 154 122

(c)
%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking transpose of (A*B*) = transpose of A*tranpose of B')

%% tranpose of a matrix is .' for A*B
(A*B).'
%% tranpose of a matrix is .' for B*A
(B*A).'

Result:
Checking transpose of (A*B*) = transpose of A*tranpose of B
ans =
-25   2 -12
-5 -2   4
49 14 34
ans =
-6 19 -14
-4 -13   6
-2 -7 26

(d)
%Matrix A of size 3 x3 %
A=[1 -3 5; 2 2 4; -2 0 6];
%Matrix B of size 3 x3 %
B=[0 -2 1; 5 1 -6; -2 0 6];
%Matrix C of size 3 x3 %
C=[-3 4 -1; 0 8 2; -3 5 3];

disp('Checking transpose of (A+B) = transpose of A* transpose pf B')
(A+B).'
%% tranpose of a matrix is .' for B*A
(B+A).'

Result :
Checking transpose of (A+B) = transpose of A* transpose pf B
ans =
1 7 -4
-5 3 0
6 -2 12
ans =
1 7 -4
-5 3 0
6 -2 12

Both are equal so transpose of (A+B)= transpose of A + tranpose of B

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote