Matrix Operation Exercises
Exercises
- Suppose
Xis 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
aand 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
aandb? -
Multiply the 3rd row of
awith the 2nd column ofb, using the element-wise vector multiplication with*.What is the sum of the elements in the resulting vector?