Matrix Operation Exercises
Exercises
- Suppose
X
is a matrix in R. Which of the following is not equivalent toX
?- A)
t( t(X) )
- B)
X %*% matrix(1,ncol(X) )
- C)
X*1
- D)
X%*%diag(ncol(X))
- A)
-
Solve the following system of equations using R:
What is the solution for $$c$?
-
Load the following two matrices into R:
a <- matrix(1:12, nrow=4) b <- matrix(1:15, nrow=3)
Note the dimension of
a
and the dimension ofb
.In the question below, we will use the matrix multiplication operator in R,
%*%
, to multiply these two matrices.What is the value in the 3rd row and the 2nd column of the matrix product of
a
andb
? -
Multiply the 3rd row of
a
with the 2nd column ofb
, using the element-wise vector multiplication with*
.What is the sum of the elements in the resulting vector?