4. Multiplication of Matrices
Important: We can only multiply matrices if the number of columns in the first matrix is the same as the number of rows in the second matrix.
a) Multiplying a 2 × 3 matrix by a 3 × 4 matrix is possible and it gives a 2 × 4 matrix as the answer.
b) Multiplying a 7 × 1 matrix by a 1 × 2 matrix is okay; it gives a 7 × 2 matrix
c) A 4 × 3 matrix times a 2 × 3 matrix is NOT possible.
How to Multiply 2 Matrices
We use letters first to see what is going on. We'll see a numbers example after.
As an example, let's take a general 2 × 3 matrix multiplied by a 3 × 2 matrix.
The answer will be a 2 × 2 matrix.
We multiply and add the elements as follows. We work across the 1st row of the first matrix, multiplying down the 1st column of the second matrix, element by element. We add the resulting products. Our answer goes in position a11 (top left) of the answer matrix.
We do a similar process for the 1st row of the first matrix and the 2nd column of the second matrix. The result is placed in position a12.
Now for the 2nd row of the first matrix and the 1st column of the second matrix. The result is placed in position a21.
Finally, we do the 2nd row of the first matrix and the 2nd column of the second matrix. The result is placed in position a22.
So the result of multiplying our 2 matrices is as follows:
Now let's see a number example.
Multiplying 2 × 2 Matrices
The process is the same for any size matrix. We multiply across rows of the first matrix and down columns of the second matrix, element by element. We then add the products:
In this case, we multiply a 2 × 2 matrix by a 2 × 2 matrix and we get a 2 × 2 matrix as the result.
Matrices and Systems of Simultaneous Linear Equations
We now see how to write a system of linear equations using matrix multiplication.
The system of equations
−3x + y = 1
6x − 3y = −4
can be written as:
Matrices are ideal for computer-driven solutions of problems because computers easily form arrays. We can leave out the algebraic symbols. A computer only requires the first and last matrices to solve the system, as we will see in Matrices and Linear Equations.
Note 1 - Notation
Care with writing matrix multiplication.
The following expressions have different meanings:
AB is matrix multiplication
A×B is cross product, which returns a vector
A*B used in computer notation, but not on paper
A•B dot product, which returns a scalar.
[See the Vector chapter for more information on vector and scalar quantities.]
Note 2 - Commutativity of Matrix Multiplication
Does `AB = BA`?
Let's see if it is true using an example.
find AB and BA.
In general, when multiplying matrices, the commutative law doesn't hold, i.e. AB ≠ BA. There are two common exceptions to this:
- The identity matrix: IA = AI = A.
- The inverse of a matrix: A-1A = AA-1 = I.
In the next section we learn how to find the inverse of a matrix.
Example 6 - Multiplying by the Identity Matrix
1. If possible, find BA and AB.
`B=(4\ \ -1\ \ \ 5)`
2. Determine if B = A-1, given:
3. In studying the motion of electrons, one of the Pauli spin matrices is
Show that s2 = I.
[If you have never seen j before, go to the section on complex numbers].
4. Evaluate the following matrix multiplication which is used in directing the motion of a robotic mechanism.
`( (cos\ 60° ,-sin\ 60° ,0),(sin\ 60°, cos\ 60°,0),(0,0,1))((2),(4),(0))`