Sie sind auf Seite 1von 22

Matrix Multiplication

7.2

Introduction
When we wish to multiply matrices together we have to ensure that the operation is possible
and this is not always so. Also, unlike number arithmetic and algebra even when the product
exists the order of multiplication may have an eect on the result. In this block we pick our
way through the mineeld of matrix multiplication.

Prerequisites
Before starting this Block you should . . .

understand the concept of a matrix and


the terms associated with it.

Learning Outcomes

Learning Style

After completing this Block you should be able To achieve what is expected of you . . .
to . . .
know when the product AB exists

allocate sucient study time

recognise that AB = BA in most cases


carry out the multiplication AB

briey revise the prerequisite material

understand what is meant by the identity


matrix I

attempt every guided exercise and most


of the other exercises

1. Multiplying row matrices and column matrices together


Let A be a 1 2 row matrix and B be a 2 1 column matrix:
 


c
A= a b
B=
d
The product of these two matrices is written AB and is the 1 1 matrix dened by:
 


c
AB = a b
= [ac + bd]
d
so that corresponding elements are multiplied and the results are then added together. For
example
 


6
2 3
= [12 15] = [3]
5
This matrix product is easily generalised to other row and column matrices. For example if C
is a 1 4 row matrix and D is a 4 1 column matrix:

3
3



C = 2 4 3 2
B=
2
5
then we would naturally dene the product of C with D as

3

 3

CD = 2 4 3 2
2 = [6 12 6 + 10] = [2]
5
The only requirement that we make is the number of elements of the row matrix is the same as
the number of elements of the column matrix.

2. Multiplying two 22 matrices


If A and B are two matrices then the product AB is obtained by multiplying the rows of A
with the columns of B in the manner described above. This will only be possible if the number
of elements in the rows of A are the same as the number of elements in the columns of B. In
particular we dene the product of two 2 2 matrices A and B to be another 2 2 matrix C
whose elements are calculated according to the following pattern

 
 

a b
w x
aw + by ax + bz

=
c d
y z
cw + dy cx + dz
A

The rule for calculating the elements of C is described in the following keypoint:
Engineering Mathematics: Open Learning Unit Level 1
7.2: Matrices

Key Point
Matrix Product
AB = C
The element in the ith row and j th column of C is obtained
by multiplying the ith row of A with the j th column of B
We illustrate this construction for the abstract matrices A and B given above:


 


 w

 x
a b

 
 a b


y
z

a b
w x
aw + by ax + bz

=


  = cw + dy cx + dz
c d
y z

 w

 x
c d
c d
y
z
For example

2 1
3 2

2 4
6 1

2
6

4
1

2 1
2 1



2 7

=
 
  = 6 10

 2

 4
3 2
3 2
6
1

Now do this exercise




1 2
1 1
Find the product AB where A =
B=
.
3 4
2
1
Write down row 1 of A, column 2 of B and form the product as described above.
Answer
Now do this exercise
Now repeat the process for row 2 of A, column 1 of B.
Answer
Now do this exercise
Find the two other elements of C = AB and hence write down the matrix C.
Answer

3. Some surprising results


We have already calculated the product AB where




1 2
1 1
A=
and B =
.
3 4
2
1
Now complete the following guided exercise in which you are asked to determine the product
BA, i.e. with the matrices in reverse order.
3

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

Now do this exercise


Form the products of
row 1 of B and column 1 of A
row 2 of B and column 1 of A
Now write down the matrix BA

row 1 of B and column 2 of A


row 2 of B and column 2 of A
Answer

It is clear that AB and BA are not in general the same. In fact it is the exception that
AB = BA. (This is to be contrasted with multiplication of numbers in which ab always equals
ba).
In the special case in which AB = BA we say that the matrices A and B commute.
Now do this exercise
Carry out the multiplication AB and BA where




a b
0 0
A=
and B =
.
c d
0 0
Answer
We call B the 2 2 zero matrix written 0 so that A 0 = 0 A = 0 for any matrix A.
Now in the multiplication of numbers, the equation
ab = 0
implies that either a, or b, or both is zero. The following guided exercise shows that this is not
necessarily true for matrices.
Now do this exercise
Carry out the multiplication AB where




1 1
1 1
A=
, B=
.
1 1
1
1
Answer
Here we have a zero product yet neither A nor B is the zero matrix. Thus the statement AB = 0
does not allow us to conclude that either A = 0 or B = 0.
Now do this exercise
Find the product AB where A =


a b
c d


and B =

1 0
0 1


.
Answer

1 0
is called the identity matrix or unit matrix of order 22, and is usually
0 1
denoted by the symbol I. (Strictly we should write I2 , to indicate the size.)
I plays the same role in matrix multiplication as the number 1 does in number multiplication.
Hence
as a.1 = 1.a = a for any number a so AI = IA = A for any matrix A.

The matrix

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

4. Multiplying two 33 matrices


The denition of the product C = AB where A and B are two 3 3 matrices is as follows

ar + bu + cx as + bv + cy at + bw + cz
r s t
a b c
C = d e f u v w = dr + eu + f x ds + ev + f y dt + ew + f z
gr + hu + ix gs + hv + iy gt + hw + iz
x y z
g h i

This looks a rather daunting amount of algebra but in fact the construction of the matrix on
the right-hand side is straightforward if we follow the simple rule from the keypoint that the
element in the ith row and j th column of C is obtained by multiplying the ith row of A with the
j th column of B.
For example, to obtain the element in row 2, column 3 of C we take row 2 of A: [d, e, f ] and
multiply it with column 3 of B in the usual way to produce [dt + ew + f z].
By repeating this process we can quickly obtain every element of C.
Now do this exercise
Find the element in row 2 column 1 of the product

2 1
3
1 2 1
1
0 1 2
AB = 3 4
0
3 2
1 5 2

Answer
Now do this exercise
Now complete the multiplication to nd all the elements of the matrix AB
Answer
The 3 3 unit matrix is:

1 0 0
I= 0 1 0
0 0 1

and as in the 2 2 case this has the property that


AI = IA = A

0 0 0
The 3 3 zero matrix is 0 0 0 .
0 0 0

5. Multiplying non-square matrices together


So far, we have just looked at multiplying 2 2 matrices and 3 3 matrices. However, products
between non-square matrices may be possible.
5

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

Key Point
General Matrix Products
The general rule is that an n p matrix A can be multiplied
by a p m matrix B to form an n m matrix AB = C.
In words:
for the matrix product AB to be dened the number
of columns of A must equal the number of rows of B
The elements of C are found in the usual way:
The element in the ith row and j th column of C is obtained
by multiplying the ith row of A with the j th column of B

Example Find the product AB if A =

1 2 2
2 3 4

2 5
and B = 6 1
4 3

Solution
Since A is a 2 3 and B is a 3 2 matrix the product AB can be found
matrix.

2

 5


1 2 2 6
1
1
2
2



3
4
2 5

1 2 2

AB =
6 1 =


2 3 4

4 3


 5
 2
2 3 4 6
2 3 4 1
3
4

Now do this exercise


Obtain the product AB if A =

1 2
2 3


and B =

2 4 1
6 1 0

and results in a 2 2




22
13

= 38 25

Answer

6. The Rules of Matrix Multiplication


It is worth noting that the process of multiplication can be continued to form products of more
than two matrices.
Although two matrices may not commute (i.e. in general AB = BA) the associative law
always holds i.e. for matrices which can be multiplied,
A(BC) = (AB)C.
Engineering Mathematics: Open Learning Unit Level 1
7.2: Matrices

The general principle is keep the order left to right, but within that any two adjacent
matrices can be multiplied.
It is important to note
any two given matrices.
 that it is not always
 possible
 to multiply together


1 2
a b c
a + 2d b + 2e c + 2f
For example if A =
and B =
then AB =
.
3 4 
3a + 4d 3b + 4e 3c + 4f

 d e f
a b c
1 2
However BA =
is not dened since each row of B has three elements
d e f
3 4
whereas each column of A has two elements and we cannot multiply these elements in the
manner described.
Now do this exercise





1 4
1 3 5
1 2
Given A =
, B=
, C= 2 5
2 4 6
3 4
3 6
State which of the products AB, BA, AC, CA, BC, CB, (AB)C, A(CB) is dened and state
the size of the product when dened.
Answer
We now list together some properties of matrix multiplication and compare them with corresponding properties for multiplication of numbers.
Key Point
Matrix algebra
A(B + C) = AB + AC
AB = BA
A(BC) = (AB)C
AI = IA = A
A0 = 0A = 0

Number algebra
a(b + c) = ab + ac
ab = ba
a(bc) = (ab)c
1.a = a.1 = a
0.a = a.0 = 0

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

More exercises for you to try






1 2
5 6
1. If A =
B=
3 4
7 8


C=

0 1
2 3


nd

(e) 2A 3C


cos sin
2. If a rotation through an angle is represented by the matrix A =
sin cos
and
a
second
rotation
through
an
angle

is
represented
by
the
matrix B =


cos sin
show that a rotation through an angle + is represented either
sin cos
by AB or by BA.



2 4
1
2
3
2 1

nd AB and BC.
3. If A = 1 1 1 , B = 1 2 , C =
1 2
5 6
2
2
2



0
1 2
3
1 2 1
0
C = 1 verify A(BC) =
4. If A =
B= 5 0
0 1
2
2
1 2 1
(AB)C.
(a) AB,

(b) AC,

(c) (A + B)C,

(d) AC + BC

T
T
5. A square matrix
A is saidto be symmetric if A = A , where A
2 3 1

2 then show that AAT is symmetric.


of A. If A = 0 1
4 5
6





0
11 0
0 1 2
6. If A =
B=
verify that (AB)T = 11
2 1
1 1 3
22

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

is the transpose

1
3 = B T AT
7
Answer

7. Computer Exercise or Activity

For this exercise it will be necessary for you to


access the computer package DERIVE.

DERIVE can be used to carry out matrix multiplication. Let A and B be the matrices:




1 2
5 6 2
A=
B=
3 4
7 8 1
To obtain the product AB using DERIVE we would rst key in the matrices using Author:Matrix.
Then, choosing the correct number of rows and columns, for A and then for B imput the two
matrices. DERIVE will respond


1 2
#1 :
3 4


5 6 2
#2 :
7 8 1
In order to carry out matrix algebra it is advisable to give these matrices names. To do this,
simply go into the Author:Expression menu screen and type A := #1 and then B := #2.
DERIVE will respond:


1 2
#3 : A :=
3 4


5 6 2
#4 : B :=
7 8 1
Now to obtain the product simply key in Author:Expression AB =. DERIVE will respond;


19 22 4
#5 : A B =
43 50 10
which is the required product.
Of course DERIVE can be used to multiply algebraic matrices together. If you key in




x y
i j k
C=
D=
r t
l m n
and ask for the product CD, DERIVE will respond:


ix+ly jx+my kx+ny
#6 : C D =
ir+lt jr+mt kr+nt
It would be a useful exercise to check all the matrix products in this block by using DERIVE.
9

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

End of Block 7.2

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

10


[1, 2] and


1
; their product is 1 (1) + 2 1 = 1.
1

Back to the theory

11

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices


[3, 4] and


1
. Their product is 3 1 + 4 (2) = 5
2

Back to the theory

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

12

Row 1 column 1 is 1 1 + 2 (2) = 3. Row 2 column 2 is 3 (1) + 4 1 = 1




3 1
C=
.
5 1
Back to the theory

13

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

row 1, column 1 is 1 1 + (1) 3 = 2


row 2, column 1 is 2 1 + 1 3 = 1

row 1, column 2 is 1 2 + (1) 4 = 2


row 2, column 2 is 2 2 + 1 4 = 0


BA is

2 2
1
0

Back to the theory

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

14


AB = BA =

0 0
0 0

Back to the theory

15

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices


AB =

0 0
0 0

Back to the theory

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

16


AB =

a b
c d


=A

Back to the theory

17

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices


2
Row 2 of A is (3, 4, 0) column 1 of B is 1 .
0
The combination required is 3 2 + 4 1 + (0) (0) = 10

Back to the theory

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

18

In full detail, the elements of AB are:

1 2 + 2 1 + (1) 0 1 (1) + 2 (2) + (1) 3 1 3 + 2 1 + (1) (2)

32+41+00
3 (1) + 4 (2) + 0 3
3 3 + 4 1 + 0 (2)
1 2 + 5 1 + (2) 0 1 (1) + 5 (2) + (2) 3 1 3 + 5 1 + (2) 2)

4 8 7
i.e. AB = 10 11 13
7 17 12
Back to the theory

19

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

We expect AB to be a 2 3 matrix.


AB =

1 2
2 3

2 4 1
6 1 0

2
6

4
1

1
0

1 2
1 2
1 2

=
 
 
 

 2

 4

 1
2 3
2 3
2 3
6
1
0


10 2 1
=
14 5 2

Back to the theory

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

20

A B
23 22

not possible

B A
22 23

possible; result 2 3

A C
23 32

possible; result 2 2

C A
32 23

possible; result 3 3

BC

not possible

(AB)C

not possible, since AB not dened.

A
23

(C B)
32

CB

possible; result 3 2

possible; result 2 2

Back to the theory

21

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices






19 22
4 7
16 30
1. (a) AB =
(b) AC =
(c) (A + B)C =
43 50
8 15
24 46




16 30
2 7
(d) AC + BC =
(e)
24 46
0 17


cos cos sin sin
cos sin + sin cos
2. AB =
sin cos cos sin sin sin + cos cos


cos( + ) sin( + )
=
sin( + ) cos( + )
which clearly represents a rotation through angle + .

8 10
15
26
3. AB = 6 12 , BC = 0 3
16 17
12
24


8
4. A(BC) = (AB)C =
0
Back to the theory

Engineering Mathematics: Open Learning Unit Level 1


7.2: Matrices

22