Here's a small tutorial on how to perform matrix multiplication.
Before we begin let's first review how we can perform a dot product.
Given 2 vectors , and , we can find the dot product with the following:
Notice that the dot product is a scalar value.
We can use this technique to perform matrix multiplication.
Given two matrices , and , they can be multiplied to a matrix, if the first matrix's number of columns is the same as the second matrix's number of rows.
This means that if we have a matrix dimensions of , it can be mulitplied by a second matrix if it has dimensions of .
For example given a matrix with dimensions of , and matrix of dimensions , it satisfies the conditions that the dimensions of the matrices are valid for matrix multiplication.
We can then visualize the matrix multiplication of as taking every row in , as a vector , and finding the dot product of every column in , as a column vector .
This will be the single element in the matrix located at position . Then, to find , it will just be:
We can then repeat the process until we have completed matrix .
- Matrix multiplication is anti-commutative. So, the order matters here in evaluation. Multiplying matrices , and as is not the same as .