Download Multiplication of Matrices

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Determinant wikipedia , lookup

Singular-value decomposition wikipedia , lookup

Matrix (mathematics) wikipedia , lookup

Perron–Frobenius theorem wikipedia , lookup

Non-negative matrix factorization wikipedia , lookup

Orthogonal matrix wikipedia , lookup

Four-vector wikipedia , lookup

Cayley–Hamilton theorem wikipedia , lookup

Matrix calculus wikipedia , lookup

Gaussian elimination wikipedia , lookup

Matrix multiplication wikipedia , lookup

Transcript
2.3 Multiplication of matrices
In the previous section we discussed how to multiply a matrix by a vector. In this section
we consider multiplying two matrices A and B to form the matrix AB. There are three
equivalent ways that one may do this.
Method 1. One multiplies the rows of A by the columns of B to get the entries of AB.
More precisely the element in in row i and column k of AB is row i of A
n
multiplied by column k of B, i.e (AB)ik = Ai,●B●,k =  AijBjk where n is the
j=1
number of columns of A. In order for the product to be defined, B must have
as many rows as A has columns. If A is an mn matrix then B must be a np
matrix for some p. The product AB is an mp matrix, i.e. it has as many rows
as A and as many columns as B. Let’s look at an example.
 (5, 7)( 8 ) (5, 7)( 5 ) 
 (2, 3)( 5 ) (2, 3)( 10 ) 
8
5


5
10
 (3, 5)( 8 ) (3, 5)( 5 ) 
5
 5 7  5 10


AB =  2 3   8 5  =
3 5
 81
=  34
 55
10
 25+56
=  10+24
 15+40
50+35

20+15 
30+25 
85

35 
55 
Method 2. One multiplies A by the columns of B to get the columns of AB. More
precisely column k of AB is A multiplied by column k of B, i.e
(AB)●,k = A(B●,k). Here is the same example done this way.
 5 7  5 10
5 7


AB =  2 3   8 5  =   2 3 
3 5
3 5
( )
( 105 ) 
5
10
  (5, 7)( 8 )   (5, 7)( 5 )  
  25+56   50+35  
5
10
=   (2, 3)( 8 )  ,  (2, 3)( 5 )   =   10+24  ,  20+15  


    15+40   30+25  
5
10
  (3, 5)( 8 )   (3, 5)( 5 )  
 81  85    81
=  34 ,  35   =  34
 55  55    55
5
8
,
 52 73 
 
3 5
85

35 
55 
As a variation of this method, column k of AB is a linear combination of the
columns of A using the entries of column k of B as coefficients, i.e.
n
(AB)k = B1,kA●,1 + B2,kA●,2 +  + Bn,kA●,n =  Bj,kA●,j
j=1
Here is the same example done this way.
2.3 - 1
 5 7  5 10
 5
7
5
 7 


AB =  2 3   8 5  =  5 2  + 8 3  , 10 2  + 5 3  
 3
5
3
 5
3 5
25
56
50
35
81
85
       
       81
=   10  +  24  ,  20  +  15   =  34 ,  35   =  34
 55  55    55
  15   40   30   25  
85

35 
55 
Method 3. One multiplies the rows of A by B to get the rows of AB. More precisely row
i of AB is row i of A multiplied by B, i.e (AB)i,● = (Ai,●)B. Here is the same
example done this way.
 (5, 7)( 8 5 ) 
 (2, 3)( 5 10 ) 
8 5


5 10
 (3, 5)( 8 5 ) 
5 10
 5 7  5 10


AB =  2 3   8 5  =
3 5
 ( 25+56,
=  ( 10+24,
 ( 15+40,
50+35 )

20+15 ) 
30+25 ) 
 ( 81,
=  ( 34,
 ( 55,
85 )

35 ) 
55 ) 
 81
=  34
 55
 ( (5, 7)( 8 ),
 ( (2, 3)( 5 ),
8

5
 ( (3, 5)( 8 ),
5
=
( 105 ) ) 
10

(2, 3)( 5 ) )

10
(3, 5)( 5 ) ) 
(5, 7)
85

35 
55 
As a variation of this method, row i of AB is a linear combination of the rows
of B using the entries of row i of A as coefficients, i.e.
n
(AB)i = Ai,1B1,● + Ai,2B2,● +  + Ai,nBn,● =  Ai,jBj,●
j=1
Here is the same example done this way.
 5 7  5 10
 5(5, 10) + 7(8, 5) 
 (25, 50) + (56, 35) 






AB =  2 3   8 5  =  2(5, 10) + 3(8, 5)  =  (10, 20) + (24, 15) 
3 5
 3(5, 10) + 5(8, 5) 
 (15, 30) + (40, 25) 
 (81, 85) 
 81 85 
=  (34, 35)  =  34 35 
 55 55 
 (55, 55) 
Before getting to an application that illustrates the value of this way of multiplying
matrices, we first need to take note of the fact that matrix multiplication is associative.
Proposition 1. If A, B and C are matrices of the appropriate dimensions then
A(BC) = (AB)C.
Proof. By the first definition of matrix multiplication (A(BC))ik = (Ai,●)(BC)●,k. By the
second definition of matrix multiplication (BC)●,k = B(C●,k). So
(A(BC))ik = (Ai,●)(B(C●,k)) = p(Bx) where p = Ai,● is a row vector and x = C●,k is a column
vector. On the other hand by the first definition of matrix multiplication ((AB)C)ik =
((AB)i,●)(C●,k). By the third definition of matrix multiplication (AB)i,● = (Ai,●)B. So
2.3 - 2
((AB)C)ik = ((Ai,●)B)(C●,k) = (pB)x. However, in the previous section we proved that if p
is a row vector and x is a column vector then p(Bx) = (pB)x. So (A(BC))ik = ((AB)C)ik. So
A(BC) = (AB)C. //
Here is an application that illustrates the value of matrix multiplication.
Example 1. In Example 1 in section 2.2 an electronics company made two types of circuit boards for
computers, namely ethernet cards and sound cards. Each of these boards requires a certain number of
resistors, capacitors and transistors as follows
resistors
capacitors
transistors
ethernet card
5
2
3
sound card
7
3
5
Let
e
s
r
c
t
= # of ethernet cards the company makes in a certain day
= # of sound card the company makes in a certain day
= # of resistors needed to produce the e ethernet cards and s sound cards
= # of capacitors needed to produce the e ethernet cards and s sound cards
= # of transistors needed to produce the e ethernet cards and s sound cards
Then we had the following linear functions.
r = 5e + 7s
c = 2e + 3s
which we wrote these compactly in vector matrix form as
e
(5, 7)  s 
r
 5e + 7s 
e
y =  c  =  2e + 3s  =
(2, 3)  s 
=
t
 3e + 5s 
e
(3, 5)  s 
5 7
e
where
x =  s 
A =  2 3 .
3 5








t = 3e + 5s
5 7e
 2 3   s  = Ax
3 5
Now suppose the company packages the ethernet cards and sound cards into two bundles with the
following number of each card.
ethernet cards
sound cards
bundle #1
5
8
bundle #1
10
5
Let
x
y
e
s
=
=
=
=
# of bundle #1 the company makes in a certain day
# of sound card the company makes in a certain day
# of ethernet cards needed to produce the x of bundle #1 and y of bundle #1
# of sound cards needed to produce the x of bundle #1 and y of bundle #1
Then
2.3 - 3
e = 5x + 10y
s = 8x + 5y
or
e =
s
 5x + 10y  =
 8x + 5y 
 (5, 10)  x  
y
5 10
x
x

=  8 5   y  B  y 
 (8, 5)  x  

y 
5 10
where B =  8 5 .
2.3 - 4