How do you multiply 2 matrices which have 4 numbers each?It is perhaps just as easy to answer the much more general question of how two matrices should be multiplied together.
Suppose that A and B are two matrices and that A is an m x n matrix (m rows and n columns) and that B is a p x q matrix. In order for us to be able to multiply A and B together, A must have the same number of columns as B has rows (ie. n=p). The product will be a matrix with m rows and q columns. To find the entry in row r and column c of the new matrix we take the "dot product" of row r of matrix A and column c of matrix B (pair up the elements of row r with column c, multiply these pairs together individually, and then add their products).
For example suppose we have the matrices
- - - - | 9 10 | | 1 2 3 | | | A = | |, B = | 11 12 |. | 4 5 6 | | | - - | 13 14 | - -
Their product is
- - - - | 1x9 + 2x11 + 3x13 1x10 + 2x12 + 3x14 | | 70 76 | AB = | | = | | | 4x9 + 5x11 + 6x13 4x10 + 5x12 + 6x14 | | 169 184 | - - - -
For those of you who would like an explict formula, here it is:
n --- C(r,c) = \ A(r,i) B(i,c) / --- i=1
(where C(r,c) is the entry in row r and column c of the product matrix C = AB).
Why is multiplication of matrices defined in this complicated way? It is because matrices can be interpreted as ways of transforming one set of values into another set of values, and matrix multiplication corresponds to doing one transformation after another.
For example, matrix A, with its two rows and three columns, might describe a chemical reaction that starts with two types of input chemicals (let's call them X and Y) and produces three types of output chemicals (let's call them P, Q, and R). The numbers in the first row describe how much of each output chemical is produced from one unit of the first input chemical (X). The numbers in the second row describe how much of each output chemical is produced from one unit of the second input chemical (Y). That is, the numbers in
- - | 1 2 3 | A = | | | 4 5 6 | - -
mean that each unit of chemical X produces 1 unit of P, 2 units of Q, and 3 units of R, while each unit of chemical Y produces 4 units of P, 5 units of Q, and 6 units of R.
Matrix B, with its three rows and two columns, could describe another chemical reaction that transforms the three chemicals P, Q, and R into two other chemicals, U and V.
What is the result of performing both chemical reactions, A and then B? You start with chemicals X and Y, then eventually end up with chemicals U and V. The matrix product AB describes how much of each output chemical you end up with.
For example, if you start with one unit of chemical X, it will under reaction A turn into 1 of P, 2 of Q, 3 of R. Under reaction B each unit of P will turn into 9 of U plus 10 of V; each of the 2 units of Q will turn into 11 of U and 12 of V; and each of the 3 units of R will turn into 13 of U and 14 of V. The total number of units of U we will end up with is therefore (1)(9) + (2)(11) + (3)(13), and the total number of units of V is (1)(10) + (2)(12) + (3)(14). These are the two numbers in the top row of the matrix product AB. The bottom-row numbers tell how many units of U and V you end up with if you start with one unit of Y (instead of starting with 1 unit of X).
It is this interpretation of matrix multiplication as the combination of two transformations that leads to the way matrix multiplication is defined.