Page 200 - Discrete Mathematics and Its Applications
P. 200
2.6 Matrices 179
We now discuss matrix products.A product of two matrices is defined only when the number
of columns in the first matrix equals the number of rows of the second matrix.
DEFINITION 4 Let A be an m × k matrix and B be a k × n matrix. The product of A and B, denoted by AB,is
the m × n matrix with its (i, j)th entry equal to the sum of the products of the corresponding
elements from the ith row of A and the jth column of B. In other words, if AB =[c ij ], then
c ij = a i1 b 1j + a i2 b 2j + ··· + a ik b kj .
In Figure 1 the colored row of A and the colored column of B are used to compute the element
c ij of AB. The product of two matrices is not defined when the number of columns in the first
matrix and the number of rows in the second matrix are not the same.
We now give some examples of matrix products.
EXAMPLE 3 Let
1 0 4 ⎡ ⎤
⎡ ⎤
2 4
⎢2 1 1⎥
and B = ⎣ 1 1 ⎦ .
3 1 0 ⎦
A = ⎣
3 0
0 2 2
Find AB if it is defined.
Solution: Because A isa4 × 3 matrix and B isa3 × 2 matrix, the product AB is defined and is
a4 × 2 matrix. To find the elements of AB, the corresponding elements of the rows of A and the
columns of B are first multiplied and then these products are added. For instance, the element in
the (3, 1)th position of AB is the sum of the products of the corresponding elements of the third
row of A and the first column of B; namely, 3 · 2 + 1 · 1 + 0 · 3 = 7. When all the elements of
AB are computed, we see that
14 4
⎡ ⎤
⎢ 8 9⎥
⎦ .
7 13 ▲
AB = ⎣
8 2
Matrix multiplication is not commutative. That is, if A and B are two matrices, it is not
necessarily true that AB and BA are the same. In fact, it may be that only one of these two
products is defined. For instance, if A is 2 × 3 and B is 3 × 4, then AB is defined and is 2 × 4;
however, BA is not defined, because it is impossible to multiply a 3 × 4 matrix and a 2 × 3
matrix.
In general, suppose that A is an m × n matrix and B is an r × s matrix. Then AB is defined
only when n = r and BA is defined only when s = m. Moreover, even when AB and BA are
⎡ ⎤
a 11 a 12 ... a 1k
⎢ a 21 a 22 ... a 2k ⎥ ⎡ b 11 b 12 ... b 1j ... b 1n ⎤ ⎡ c 11 c 12 ... c 1n ⎤
⎢ ⎥
⎢ . .
⎢ . . . ⎥ ⎢ b 22 ... b 2j ... b 2n ⎥ ⎢ c 21 c 22 ... c 2n ⎥
. ⎥ b 21
. . . ⎢ ⎥ ⎢ ⎥
⎢ ⎥ ⎢ . . . . ⎥ = ⎢ . . . ⎥
a
⎥
⎢ i1 a i2 ... a ik ⎥ ⎣ . . . . . . . . ⎦ ⎣ . . . . c ij . . ⎦
⎢
⎢ . . . ⎥
⎣ . . . ⎦ b k1 b k2 ... b kj ... b kn c m1 c m2 ... c mn
. . .
a m1 a m2 ... a mk
FIGURE 1 The Product of A =[a ij ] and B =[b ij ].