Multiplication of a Matrix by a Matrix To multiply two matrices, the first matrix must have the same number of rows (m) as the second matrix has columns (n). In other words, m of the first matrix must equal n of the second matrix. For example, a 2 x 1 matrix can be multiplied by a 1 x 2 matrix, ⎤⎥⎥⎦ ⎡⎢⎢⎣ x ⎤⎥⎥⎦ ab y or a 2 x 2 matrix can be multiplied by a 2 x 2. If an m x n matrix is multiplied by an n x p matrix, then the resulting matrix is an m x p matrix. For example, if a 2 x 1 and a 1 x 2 are multiplied, the result will be a 2 x 2. If a 2 x 2 and a 2 x 2 are multiplied, the result will be a 2 x 2. To multiply two matrices, the following pattern is used: wx ab cd yz ⎤⎥⎥⎦ ⎤⎥⎥⎦ ⎡⎢⎢⎣ B ⎡⎢⎢⎣ A 12 35 ⎤⎥⎥⎦ ⎤⎥⎥⎦ 06 34 ⎡⎢⎢⎣ B ⎡⎢⎢⎣ A | CAB | ⎡⎢⎢⎣ cw dy cx dz aw by ax bz | ⎤⎥⎥⎦ | In general terms, a matrix C which is a product of two matrices, A and B, will have elements given by the following. cij = ai1b1j + aj2b2 j + + +. . . + ainbnj where i = ith row j = jth column Example Multiply the matrices A x B. | (1x3) ⎡⎢⎢⎢⎢⎣ (3x3) | (2x0) (4x0) | (1x5) (3x5) | (2x6) ⎤⎥⎥⎥⎥⎦ (4x6) | | 3 0 | 5 12 | | | | ⎡⎢⎢⎢⎢⎣ 9 0 | 15 24 | ⎤⎥⎥⎥⎥⎦ | | | 3 17 | | | | | ⎡⎢⎢⎢⎢⎣ 9 39 | ⎤⎥⎥⎥⎥⎦ | | | Solution: AB It should be noted that the multiplication of matrices is not usually commutative. |