Multiplying matrices - examples
by M. Bourne
On this page you can see many examples of matrix multiplication.
You can re-load this page as many times as you like and get a new set of numbers and matrices each time. You can also choose different size matrices (at the bottom of the page).
(If you need some background information on matrices first, go back to the Introduction to Matrices and 4. Multiplication of Matrices).
Example
Multiply matrices A and B.
A = |
|
-1 |
-2 |
-4 |
|
4 |
-3 |
0 |
1 |
2 |
3 |
5 |
6 |
7 |
|
, B = |
|
8 |
9 |
10 |
11 |
|
-2 |
4 |
12 |
-4 |
13 |
14 |
1 |
-3 |
|
Answer
To save work, we check first to see if it is possible to multiply them.
We have (4×3) × (3×4) and since the number of columns in A is the same as the number of rows in B
(the middle two numbers are both 3 in this case), we can go ahead and multiply these matrices. Our result will be a (4×4) matrix.
The first step is to write the 2 matrices side by side, as follows:
AB = |
|
-1 |
-2 |
-4 |
|
4 |
-3 |
0 |
1 |
2 |
3 |
5 |
6 |
7 |
|
|
8 |
9 |
10 |
11 |
|
-2 |
4 |
12 |
-4 |
13 |
14 |
1 |
-3 |
|
We multiply the individual elements along the first row of matrix A with the corresponding elements down the first column of matrix B, and add the results.
This gives us the number we need to put in the first row, first column position in the answer matrix.
|
-1 |
-2 |
-4 |
|
4 |
-3 |
0 |
1 |
2 |
3 |
5 |
6 |
7 |
|
|
8 |
9 |
10 |
11 |
|
-2 |
4 |
12 |
-4 |
13 |
14 |
1 |
-3 |
|
-1×8 + -2×-2 + -4×13 = -56
Following that, we multiply the elements along the first row of matrix A with the corresponding elements down the second column of matrix B then add the results.
This gives us the answer we'll need to put in the first row, second column of the answer matrix.
|
-1 |
-2 |
-4 |
|
4 |
-3 |
0 |
1 |
2 |
3 |
5 |
6 |
7 |
|
|
8 |
9 |
10 |
11 |
|
-2 |
4 |
12 |
-4 |
13 |
14 |
1 |
-3 |
|
-1×9 + -2×4 + -4×14 = -73
We continue on along the rows and columns as follows:
|
-1 |
-2 |
-4 |
|
4 |
-3 |
0 |
1 |
2 |
3 |
5 |
6 |
7 |
|
|
8 |
9 |
10 |
11 |
|
-2 |
4 |
12 |
-4 |
13 |
14 |
1 |
-3 |
|
= |
|
-1×8 + -2×-2 + -4×13 |
-1×9 + -2×4 + -4×14 |
-1×10 + -2×12 + -4×1 |
-1×11 + -2×-4 + -4×-3 |
|
4×8 + -3×-2 + 0×13 |
4×9 + -3×4 + 0×14 |
4×10 + -3×12 + 0×1 |
4×11 + -3×-4 + 0×-3 |
1×8 + 2×-2 + 3×13 |
1×9 + 2×4 + 3×14 |
1×10 + 2×12 + 3×1 |
1×11 + 2×-4 + 3×-3 |
5×8 + 6×-2 + 7×13 |
5×9 + 6×4 + 7×14 |
5×10 + 6×12 + 7×1 |
5×11 + 6×-4 + 7×-3 |
= |
|
-56 |
-73 |
-38 |
9 |
|
38 |
24 |
4 |
56 |
43 |
59 |
37 |
-6 |
119 |
167 |
129 |
10 |
See another example?
You can refresh this page to see another example with different size matrices and different numbers; OR
Choose the matrix sizes you are interested in and then click the button.