Multiplying matrices

So far, we have only multiplied a matrix by a column vector. But now, we will multiply a matrix A with another matrix B.

There are four simple rules that will help us in multiplying matrices, listed here:

  • Firstly, we can only multiply two matrices when the number of columns in matrix A is equal to the number of rows in matrix B.
  • Secondly, the first row of matrix A multiplied by the first column of matrix B gives us the first element in the matrix AB, and so on.
  • Thirdly, when multiplying, order matters—specifically, ABBA.
  • Lastly, the element at row i, column j is the product of the ith row of matrix A and the jth column of matrix B.

Let's multiply an arbitrary 4x5 matrix with an arbitrary 5x6 matrix, as follows: ...

Get Hands-On Mathematics for Deep Learning now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.