Matrix Multiplication Compatibility
The two matrices generated by the R code below are (small) examples of what are used in neural network models to weigh datasets for prediction:
A = matrix(c(1, 3, 2, -1, 0, 1), nrow = 2, ncol = 3)
B = matrix(c(-1, 1, 2, -3), nrow = 2, ncol = 2)
Often times these collections of weights are applied iteratively using successive applications of matrix multiplication.
Are \(A\) and \(B\) compatible in any way in terms of matrix multiplication? Use A%*%B
and B%*%A
in the console to check. What are the dimensions of the resulting matrix?
This exercise is part of the course
Linear Algebra for Data Science in R
Hands-on interactive exercise
Turn theory into action with one of our interactive exercises
