2.1 Matrix multiplication
A matrix, , is a rectangular array of numbers arranged in rows and columns. (Matrices is the plural of the word matrix.) You will concentrate on two-dimensional situations, and so consider matrices of the form:
In order to multiply two matrices, the number of columns of first matrix should be equal to the number of rows in the second matrix. Matrices of the right shape can be multiplied together as follows:
To calculate , where is the element in the i th row and j th column of , you go along the th row of and down the th column of , multiplying corresponding elements and adding the results. For two matrices, this pattern may be visualized as follows:
where the indicates a matrix element in the new matrix, , and the arrows show how matrix elements in the old matrices are processed to obtain this. In order to multiply two matrices, the number of columns of first matrix should be equal to the number of rows in the second matrix. In other words, each term is given by .
Exercise 3
a.What shape is the result of multiplying a row matrix by a square matrix?
b.What shape is the result of multiplying a square matrix by a row matrix?
c.What shape is the result of multiplying a square matrix by a column matrix?
d.What shape is the result of multiplying a row matrix by a column matrix?
Answer
a.The result is a row matrix.
- b.This operation cannot be performed because the number of columns of first matrix is not equal to the number of rows in the second matrix.
c.The result is a column matrix.
d.The result is a matrix (i.e. a scalar number).
Exercise 4
Evaluate the following combination of square matrices:
Answer
The product of two matrices is given by:
So, to find the matrix element in row and column of the product , we multiply the elements in row of with the corresponding elements in column of , and add the results together.
To find the product of three matrices, , we first evaluate and then form the product , taking care to preserve the order of the matrices.
So the solution is