Recall & Review
beginner
What is a matrix in R?
A matrix in R is a two-dimensional array that holds elements of the same type arranged in rows and columns.
Click to reveal answer
beginner
How do you create a 2x2 matrix with numbers 1 to 4 in R?
Use the matrix() function: <br>
matrix(1:4, nrow=2, ncol=2)Click to reveal answer
beginner
What operator is used for matrix multiplication in R?
The %*% operator is used for matrix multiplication in R.
Click to reveal answer
beginner
What happens when you add two matrices in R?
Adding two matrices adds their corresponding elements to create a new matrix of the same size.
Click to reveal answer
beginner
How do you multiply each element of a matrix by a number in R?
You multiply the matrix by the number using the * operator, which multiplies each element individually.
Click to reveal answer
Which function creates a matrix in R?
✗ Incorrect
The matrix() function creates a matrix in R.
What does the operator %*% do in R?
✗ Incorrect
The %*% operator performs matrix multiplication.
If A and B are matrices of the same size, what does A + B do?
✗ Incorrect
A + B adds corresponding elements of matrices A and B.
How do you multiply each element of a matrix by 3 in R?
✗ Incorrect
Using * with a number multiplies each element of the matrix by that number.
What is the result of matrix(1:4, nrow=2, ncol=2)?
✗ Incorrect
By default, matrix fills columns first, so the matrix is [[1,3],[2,4]].
Explain how to perform matrix multiplication in R and how it differs from element-wise multiplication.
Think about how you multiply rows by columns versus multiplying each element separately.
You got /4 concepts.
Describe how to create a matrix in R and how to add two matrices together.
Start with creating the matrix, then explain addition.
You got /4 concepts.