Challenge - 5 Problems
Matrix Arithmetic Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Matrix multiplication output
What is the output of this R code when multiplying two matrices?
R Programming
A <- matrix(c(1, 2, 3, 4), nrow=2) B <- matrix(c(2, 0, 1, 3), nrow=2) C <- A %*% B print(C)
Attempts:
2 left
💡 Hint
Remember matrix multiplication multiplies rows of the first by columns of the second.
✗ Incorrect
Matrix multiplication multiplies each row of A by each column of B. For example, element (1,1) is 1*2 + 3*1 = 4.
❓ Predict Output
intermediate2:00remaining
Element-wise multiplication result
What does this R code output when performing element-wise multiplication of two matrices?
R Programming
A <- matrix(c(1, 2, 3, 4), nrow=2) B <- matrix(c(2, 0, 1, 3), nrow=2) C <- A * B print(C)
Attempts:
2 left
💡 Hint
Element-wise multiplication multiplies corresponding elements directly.
✗ Incorrect
Each element in C is the product of corresponding elements in A and B, e.g., 1*2=2, 2*0=0, 3*1=3, 4*3=12.
❓ Predict Output
advanced2:00remaining
Matrix inversion and multiplication
What is the output of this R code that multiplies a matrix by its inverse?
R Programming
M <- matrix(c(4, 7, 2, 6), nrow=2) invM <- solve(M) result <- M %*% invM print(round(result, 2))
Attempts:
2 left
💡 Hint
Multiplying a matrix by its inverse should give the identity matrix.
✗ Incorrect
The product of a matrix and its inverse is the identity matrix, which has 1s on the diagonal and 0s elsewhere.
❓ Predict Output
advanced2:00remaining
Matrix transpose and multiplication
What is the output of this R code that multiplies a matrix by its transpose?
R Programming
X <- matrix(c(1, 2, 3, 4, 5, 6), nrow=2) Y <- X %*% t(X) print(Y)
Attempts:
2 left
💡 Hint
Multiply each row of X by each row of X again because of transpose.
✗ Incorrect
X is [[1,3,5],[2,4,6]]. Y = X %*% t(X). Y[1,1] = 1*1 + 3*3 + 5*5 = 35. Y[1,2] = 1*2 + 3*4 + 5*6 = 44. Symmetric matrix.
🧠 Conceptual
expert2:00remaining
Matrix rank and multiplication properties
Given two matrices A (3x2) and B (2x3), which statement about the rank of the product matrix C = A %*% B is always true?
Attempts:
2 left
💡 Hint
The rank of a product cannot exceed the ranks of the factors.
✗ Incorrect
The rank of the product matrix is at most the minimum of the ranks of the two matrices multiplied.