Sie sind auf Seite 1von 7

Math 415 - Lecture 5

Matrices multiplication

Wednesday August 31st 2016


Textbook: Chapter 1.4
Suggested Practice Exercise: Chapter 1.4 Exercise 1, 2, 10, 12, 13, 21, 30, 34, 45,
Khan Academy Video: Matrix multiplication (part I), Matrix multiplication (part II), Defined
and undefined matrix operations

Multiplication of matrices
We know how to multiply a matrix and a vector (of the right size!). Now we want to define how to
multiply matrices by matrices.
Definition. Let A be an m n-matrix and let B be an n p-matrix. We define
AB := [Ab1 Ab2 Abp ]
Example 1. Compute AB where

4
A= 3
0


2
2
5 and B =
6
1

3
7

Solution.


4
2
8
12
4
Ab1 = 2 3 + 6 5 = 6 + 30 = 24
1
0
6
6
0



4
2
12
14
2
Ab2 = 3 3 7 5 = 9 + 35 = 26
0
1
0
7
7
Therefore

AB = [Ab1

4
Ab2 ] = 24
6

2
26
7

Remark. Note that Ab1 is a linear combination of the columns of A and Ab2 is a linear combination of the columns of A. Each column of AB is a linear combination of the columns of A
using weights from the corresponding columns of B.
1

Example 2. If A is 4 3 and B is 3 2, then what are the sizes of AB and BA?


Solution.
Lets look at the definition of matrix multiplication. The product AB is only defined if B has as many
rows as A has columns. If this is the case, then AB has as many rows as A and as many columns as
B. Thus AB is 4 2. BA is not defined.

Composition vs multiplication
During the last lecture, we learnt that we can think of matrices as machines.
Let B be n p: input x Rp , output c = Bx Rn .
Let A be m n: input y Rn , output b = Ay Rm .
We already saw that these machines can be composed.
x

Bx

A(Bx)
A

Question. How does that compare to the machine given by AB?


x

(AB)x
AB

Example 3. Consider

2
A=
1


0
,
1


1
B=
0


2
,
1

 
x
x= 1
x2

Compute (AB)x and A(B(x)). Are these the same?


Solution.
 
 
  

x1
1
2
x1 + 2x2
Bx = B
= x1
+ x2
=
x2
0
1
x2


 
  

x + 2x2
2
0
2x1 + 4x2
A(Bx) = A 1
= (x1 + 2x2 )
+ (x2 )
=
x2
1
1
x1 + 3x2
 
 
  


 x1
2
4
2x1 + 4x2
(AB)x = Ab1 Ab2
= x1 Ab1 + x2 Ab2 = x1
+ x2
=
x2
1
3
x1 + 3x2
Yes, these are the same.

Theorem 1. Let A be an m n matrix and B be an n p matrix. Then for every x Rp


A(Bx) = (AB)x.

Row-Column Rule for Computing AB


When A and B have small sizes, the following method is more efficient when working by hand.
Method. If AB is defined, let (AB)ij denote the entry in the ith row and jth column of AB. Then
(AB)ij = ai1 b1j + ai2 b2j + + ain bnj

ai1

ai2

ain

b1j
b2j
..
.
bnj

(AB)ij

If you know about dot products you see that every entry in the product AB is the dot product of a
row vector (of A) and a column vector (of B).



2 3
2 3 6
1 . Compute AB, if it is defined.
Example 4. A =
,B= 0
1 0 1
4 7
Solution.

AB =

22+30+64
1 2 + 0 0 + 1 4

 
2 (3) + 3 1 + 6 (7)
28
=
1 (3) + 0 1 + 1 (7)
2

45
4

Rules for matrix multiplication


Matrices often behave like usual numbers. Many (but not all) rules for addition and multiplication
for numbers also hold for addition and multiplication of matrices.
Theorem 2. Let A be an m n matrix and let B and C be matrices for which the indicated sums
and products are defined.
(a) A (BC) = (AB)C (associative law of multiplication)
(b) A (B + C) = AB + AC , (B + C) A = BA + CA (distributive laws)
(d) r(AB) = (rA)B = A(rB) for any scalar r
(e) Im A = A = AIn (identity for matrix multiplication)

1 0 ... 0
0 1 . . . 0

where In = . . .
is the identity matrix af size n.
. . ...
.. ..

...

Remark. WARNING! Properties above are analogous to properties of real numbers. But NOT
ALL properties of real number also hold for matrices.




1 1
1 0
Example 5. Let A =
, B =
. Determine AB and BA. Are these matrices the
0 1
1 1
same?
3

Solution.

2
AB =
1

1
BA =
1

1
1

1
2

No. These matrices are not the same: AB 6= BA. Matrix multiplication is not commutative.

Transpose
Definition. If A is m n, the transpose of A is the n m matrix, denoted by AT , whose columns
are formed from the corresponding rows of A. In terms of matrix elements: (AT )ij = Aji .

1 2 3 4 5
Example 6. Let A = 6 7 8 9 8 . What is AT ?
7 6 5 4 3
Solution.
The transpose of A is the matrix whose columns are the rows of A. Thus

1 6 7
2 7 6

AT =
3 8 5
4 9 4
5 8 3


Example 7. Let A =

1
3

2
0

0
1


,B=

1
0
2

2
1 . Compute AB, (AB)T , AT B T and B T AT .
4

Solution.


1
3

1
4

AB =

2
0

0
1


1
0
2


2
1

1
=
1
4

4
10

1
10


1 3 
7 3
1
0
2
AT B T = 2 0
= 2 0
2 1 4
0 1
2 1


 1 3

1 0 2
1 1
2 0 =
B T AT =
2 1 4
4 10
0 1
T

(AB) =

10
4
4


Theorem 3. The transpose of a product is the product of transposes in opposite order:


(AB)T = B T AT
Definition. We say a matrix A is symmetric if A = AT .
4

Example 8. Let A =


2
3



3
0
and B =
1
2


3
. Which of these matrices are symmetric?
0

Solution.

AT =


2
3

3
1

T

BT =


0
2

3
0

T


2
3


3
= A.
1


0
3


2
6 B.
=
0

So A is symmetric.

Thus B is not symmetric.

Theorem 4. Let A and B denote matrices whose sizes are appropriate for the following sums and
products.
(a) AT

T

= A,
T

(b) (A + B) = AT + B T
T

(c) For any scalar r, (rA) = rAT


T

(d) (AB) = B T AT
T

Example 9. Prove that (ABC) = C T B T AT .


Solution.
T

By part d of the Theorem,(ABC) = (A(BC))T = (BC)T AT = C T B T AT .

Powers of A
Definition. We write Ak for A A, k-times; that is Ak is obtained by multiplying A k-times with
itself.
Question. For which matrices A does Ak make sense? If A is m n what can m and n be?
Solution.
Let A be an m n-matrix. To be able to multiply A with itself, we need that m = n.

Example 10. Determine


1
3

3
0
.
2

Solution.

1
3

0
2

3

1
3

0
2



1
3

0
2



1
9

0
4



1
3

0
2

1 0
21 8

=
=
=

1
3

0
2

Remark. In general, calculating high powers of large matrix in this way is very hard. We will later
learn a clever way to do this efficiently.

An application
Example 11. The processors of a supercomputer are inspected weekly in order to determine their
condition. The condition of a processor can either be perfect, good or bad. A perfect processor is still
perfect after one week with probability 0.7, with probability 0.2 the state is good and with probability
0.1 it is bad. A processor in good condition is still good after one week with probability 0.6 and bad
with probability 0.4. A bad processor stays bad.
(a) What is the probability that a processor in perfect condition is in bad condition after two weeks?
(b) Let us see how this connects to matrix multiplication. Write down the matrix

Tp,p Tg,p Tb,p


T = Tp,g Tg,g Tb,g ,
Tp,b Tg,b Tb,b
where the entries of T correspond to the probability that the condition of a processor changes
from one week to the next. So for example, Tp,g is the probability that a processor in perfect
condition is in good condition after one week.
(c) Calculate T 2 ! The entry in the third row and the first column of T 2 should be equal to your
result in (a). Why is that?
(d) How can you use matrix multiplication to determine the probability that a processor in perfect
condition is in bad condition after n weeks?
Solution.

(a) There are three possible paths for the processor to go from good to bad in three weeks. Either
it goes perfectperfectbad, perfectgoodbad, or perfectbadbad. The probability of
the first is (.7)(.1) = .07, the probability of the second is (.2)(.4) = .08, and the probability of
the third is .1. Thus adding these up we see the total probability is .25.
(b) We get that

.7
T = .2
.1

0
.6
.4

0
0
1

(c) Then

.49 0
T = .26 .36
.25 .64
2

0
0
1

If we use the row column rule for multiplying matrices, we see that the bottom left entry comes
from using the bottom row and left column of T . Thus the bottom left entry is Tp,p Tp,b +
Tp,g Tg,b + Tp,b Tb,b . Each of these corresponds to one of the three paths from [(a)].
(d) This will be the bottom left entry of T n .

Das könnte Ihnen auch gefallen