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, AB ≠ BA.
- 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:
This results in a 4x6 matrix, like this:
From that, we can deduce that in general, the following applies:
Let's take the following two matrices and multiply them, like this:
This will give us the following matrix:
.
The identity matrix has two unique properties in matrix multiplication. When multiplied by any matrix, it returns the original matrix unchanged, and the order of multiplication does not matter—so, AI = IA = A.
For example, let's use the same matrix A from earlier, and multiply it by another matrix B, as follows:
Another very special matrix is the inverse matrix, which is written as A-1. And when we multiply A with A-1, we receive I, the identity matrix.
As mentioned before, the order in which we multiply matters. We must keep the matrices in order, but we do have some flexibility. As we can see in the following equation, the parentheses can be moved:
This is the first law of matrix operations, known as associativity.
The following are three important laws that cannot be broken:
- commutativity:
- distributivity: or
- associativity:
As proof that AB ≠ BA, let's take a look at the following example:
This conclusively shows that the two results are not the same.
We know that we can raise numbers to powers, but we can also raise matrices to powers.
If we raise the matrix A to power p, we get the following:
(multiplying the matrix by itself p times)
There are two additional power laws for matrices— and .