0
0
MATLABdata~20 mins

Matrix multiplication (*) in MATLAB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Matrix Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this matrix multiplication?
Consider the following MATLAB code multiplying two matrices. What is the resulting matrix?
MATLAB
A = [1 2; 3 4];
B = [5 6; 7 8];
C = A * B;
disp(C);
A[12 16; 28 40]
B[19 22; 43 50]
C[5 12; 21 32]
D[17 20; 39 46]
Attempts:
2 left
💡 Hint
Remember matrix multiplication sums the products of rows of the first matrix with columns of the second.
Predict Output
intermediate
2:00remaining
What error does this matrix multiplication code produce?
What error will this MATLAB code produce when run?
MATLAB
A = [1 2 3; 4 5 6];
B = [7 8; 9 10];
C = A * B;
AError: Undefined function or variable 'B'.
BNo error, output is a 2x2 matrix.
CError: Matrix dimensions must be square.
DError: Inner matrix dimensions must agree.
Attempts:
2 left
💡 Hint
Check the number of columns in A and rows in B for multiplication compatibility.
Predict Output
advanced
2:00remaining
What is the output of multiplying a matrix by identity matrix?
Given the code below, what is the output matrix C?
MATLAB
A = [3 4; 1 2];
I = eye(2);
C = A * I;
disp(C);
A[3 4; 1 2]
B[1 0; 0 1]
C[4 3; 2 1]
D[0 0; 0 0]
Attempts:
2 left
💡 Hint
Multiplying by the identity matrix should not change the original matrix.
Predict Output
advanced
2:00remaining
What is the output of this matrix multiplication with a transpose?
What is the output of the following MATLAB code?
MATLAB
A = [1 2 3];
B = [4; 5; 6];
C = A * B;
disp(C);
A32
B[4 5 6; 8 10 12]
C[1 2 3; 4 5 6]
DError: Inner matrix dimensions must agree.
Attempts:
2 left
💡 Hint
Check the dimensions of A and B before multiplication.
🧠 Conceptual
expert
2:00remaining
How many elements does the resulting matrix have after multiplication?
If matrix A is 4x3 and matrix B is 3x5, how many elements will the matrix C = A * B have?
A15
B12
C20
D7
Attempts:
2 left
💡 Hint
The resulting matrix size is rows of A by columns of B.