Mathematics Previous page   Next Page

Multiplying Matrices

Multiplication of matrices is defined in a way that reflects composition of the underlying linear transformations and allows compact representation of systems of simultaneous linear equations. The matrix product C = AB is defined when the column dimension of A is equal to the row dimension of B, or when one of them is a scalar. If A is m-by-p and B is p-by-n, their product C is m-by-n. The product can actually be defined using MATLAB for loops, colon notation, and vector dot products.

MATLAB uses a single asterisk to denote matrix multiplication. The next two examples illustrate the fact that matrix multiplication is not commutative; AB is usually not equal to BA.

A matrix can be multiplied on the right by a column vector and on the left by a row vector.

Rectangular matrix multiplications must satisfy the dimension compatibility conditions.

Anything can be multiplied by a scalar.


Previous page  Vector Products and Transpose The Identity Matrix Next page

© 1994-2005 The MathWorks, Inc.