You have the multiplication right. But one major
comment. Checking that the matrixes look right is fairly
time intensive. You really don't want that effort to be
spent on every multiply. Likewise the dimensions. So this
is a place where OO fits well. I won't provide that
solution so
zdog can have the experience of writing it.