Matrix Multiplication Quick Tip
For Multiple-Input Multiple Output (MIMO) systems the individual blocks in the system model (controller, plant, sensors) all have multiple inputs and outputs. As a result the order of multiplication is crucial. For simple systems the order of multiplcation isn't too difficult to maintain. However, in derviations of things like Kalman Filters its easy to fall into old algebra habits where order is a matter of convenience.
The easiest and fastest way I know of to check your matrix multiplcation order is by checking the matrix dimensions.
Let's define 2 matrices:
|A is (m x n)|
|B is (p x q)|
and we know that matrix multiplication works like this
What we see from this is that B must have at least n rows. It also must have no more than n rows. So
When you multiply 2 matrices a row of values from the left martix (A) is multiplied by a column of values from the right martix (B). The number of rows in the right matrix must equal the number of columns in the left matrix.
So n = p and since C = AB the matrix C is of size (m x q).