Matrix Multiplication Quick Tip


Jump to: navigation, search
Matrix Multiplication Quick Tip
Green carrot left.gif
Quick Tips Linear Algebra
Green carrot.jpg
In order to prevent spam, users must register before they can edit or create articles.

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:

LaTeX: A=\begin{bmatrix} a_{1,1} & a_{1,2} & \cdots & a_{1,n} \\ \vdots & \ddots & \vdots \\ a_{m,1} & a_{m,2} & \cdots & a_{m,n} \end{bmatrix} A is (m x n)

LaTeX: B=\begin{bmatrix} b_{1,1} & b_{1,2} & \cdots & b_{1,q} \\ \vdots & \ddots & \vdots \\ b_{p,1} & a_{p,2} & \cdots & b_{p,q} \end{bmatrix} B is (p x q)



and we know that matrix multiplication works like this

LaTeX: c_{1,1}=(a_{1,1}*b_{1,1}+a_{1,2}*b_{2, 1}+\cdots+a_{1,n}*b_{n,1})

What we see from this is that B must have at least n rows. It also must have no more than n rows. So

LaTeX: n=p

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).