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

Matrix completion wikipedia , lookup

Covariance and contravariance of vectors wikipedia , lookup

Linear least squares (mathematics) wikipedia , lookup

Capelli's identity wikipedia , lookup

Rotation matrix wikipedia , lookup

Principal component analysis wikipedia , lookup

Jordan normal form wikipedia , lookup

System of linear equations wikipedia , lookup

Eigenvalues and eigenvectors wikipedia , lookup

Determinant wikipedia , lookup

Singular-value decomposition wikipedia , lookup

Matrix (mathematics) wikipedia , lookup

Perron–Frobenius theorem wikipedia , lookup

Non-negative matrix factorization wikipedia , lookup

Four-vector wikipedia , lookup

Orthogonal matrix wikipedia , lookup

Matrix calculus wikipedia , lookup

Cayley–Hamilton theorem wikipedia , lookup

Gaussian elimination wikipedia , lookup

Matrix multiplication wikipedia , lookup

Transcript
1.6 Multiplication of matrices
In the previous section we discussed the product of a matrix and a vector and we saw that
this product allowed us to specify all linear functions that map column vectors to column
vectors. In this section we consider multiplying two matrices A and B to form the matrix
AB and we see that it corresponds to the composition of linear functions. There are five
equivalent ways that the product of two matrices can be defined.
Definition 1. Let A be an mn matrix then B must be a np matrix. The product AB is
the mp matrix defined by any of the following methods.
Method 1. One multiplies the rows of A by the columns of B to get the entries of AB.
More precisely the element in row i and column k of AB is row i of A
multiplied by column k of B, i.e
n
(1)
(AB)ik = Ai,●B●,k =  AijBjk
j=1
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
(2)
(AB)●,k = A(B●,k)
Method 3. As a variation of Method 2, 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
(3)
(AB)k = B1,kA●,1 + B2,kA●,2 +  + Bn,kA●,n =  Bj,kA●,j
j=1
Method 4. 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
(4)
(AB)i,● = (Ai,●)B.
Method 5. As a variation of Method 4, 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
(5)
(AB)i = Ai,1B1,● + Ai,2B2,● +  + Ai,nBn,● =  Ai,jBj,●
j=1
1.6 - 1
For many formulas, one uses rows for the matrix on the right and columns for the matrix
on the left. One way to remember this is with the formula RC.
5 7
 5 10 
Example 1. Let A =  2 3  and B =  8 5 . Using method 1 one has
3 5
 (5, 7)( 8 ) (5, 7)( 5 ) 
 (2, 3)( 5 ) (2, 3)( 10 ) 
8
5


5
10
(3,
5)
(3,
5)
 (8) ( 5 )
5
 5 7  5 10


AB =  2 3   8 5  =
3 5
10
 25+56
=  10+24
 15+40
50+35

20+15 
30+25 
 81
=  34
 55
85

35 
55 
Using method 2 one has
5
10
(5, 7)( 8 )
(5, 7)( 5 )





5 7
5 7
5 7
5 10
5
10 
5  
10  









2 3
AB = 2 3 ( 8 5 ) =
, 2 3
=
(2, 3)( 8 ) , (2, 3)( 5 )
3 5
  3 5 ( 8 )  3 5  ( 5 )   


  (3, 5)( 58 )   (3, 5)( 105 )  
=
50+35
  25+56
10+24  ,  20+15  
  15+40   30+25  
=
85
81
 81
34 ,  35   =  34
 55  55    55
85
35 
55 
Using method 3 one has
AB =
=
 25 37  5 10
3 5( 8 5 )
=
 5 52  + 8 37  ,
  3 5
85
81
 81
34 ,  35   =  34
 55  55    55
5 7 =
10 2 + 5 3
3  5
56
50
35
  25
10  +  24  ,  20  +  15  
  15   40   30   25  
85
35 
55 
Using method 4 one has
 (5, 7)( 8 5 ) 
5 7
 (2, 3)( 58 105 ) 
  5 10
AB = 2 3 ( 8 5 ) =
3 5
 (3, 5) 5 10 
 ( 8 5 )
5 10
=
 (( 81,
34,
 ( 55,
85 )
35 )  =
55 ) 
 81
34
 55
 ( (5, 7)( 8 ),
 ( (2, 3)( 58 ),
=
 ( (3, 5) 5 ,
 (8)
5
( 105 ) )  ( 25+56,
10
 =  ( 10+24,
(2, 3)( 5 ) )
  ( 15+40,
10
(3, 5)( 5 ) ) 
(5, 7)
50+35 )
20+15 ) 
30+25 ) 
85
35 
55 
Using method 5 one has
AB =
 25 37  5 10
3 5( 8 5 )
=
10) + 7(8, 5)
 5(5,
2(5, 10) + 3(8, 5) 
 3(5, 10) + 5(8, 5) 
=
(25, 50) + (56, 35)
 (10,
20) + (24, 15) 
 (15, 30) + (40, 25) 
=
85)
 (81,
(34, 35) 
 (55, 55) 
=
 81
34
 55
85
35 
55 
Remark. Note that AB has as many rows as A and as many columns as B.
1.6 - 2
Before showing that multiplication of matrices corresponds to composition of linear
functions, we first show that matrix multiplication is associative.
Proposition 1. If A, B and C are matrices of the appropriate dimensions, t is a number
and I is the appropriate identity matrix then the following are true.
(6)
(A + B)C = AC + BC
a distributive property
(7)
A(B + C) = AB + AC
another distributive property
(8)
A(BC) = (AB)C
the associative property
(9)
A(tB) = t(AB)
(10)
(tA)B = t(AB)
(11)
AI = A
(12)
IA = A
(13)
(AB)T = BTAT
(14)
A0 = 0
and
0A = 0
Proof. We prove (8). The rest are left to exercises. 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 ((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. //
Despite the fact that matrix multiplication obeys many of the laws of regular algebra,
there is one law that is not true. Matrix multiplication is NOT commutative in general.
Here is an example illustrating this.
0 10 0
1 0
0 00 1
Example 2.  0 0   1 0  =  0 0  but  1 0   0 0 
1.6 - 3
0 0
= 0 1
Even though matrix multiplication is not commutative in general, there are many
important situations where one has two matrices A and B where AB = BA. The simplest
case is when one of the matrices is the identity matrix or a multiple of the identity matrix.
Two matrices A and B are said to commute if AB = BA. Here is another example of two
matrices that commute.
0 1
1 -1
1 1
1 -1
0 1
1 1
Example 3.  - 1 0   1 1  =  - 1 1  and  1 1   - 1 0  =  - 1 1 
Certain formulas in ordinary algebra only hold when the matrices involve commute. We
shall see some of these below when we discuss matrix powers.
One very important property of multiplication of matrices is that it corresponds to
composition of linear functions.
Proposition 2. Let A be an mn matrix and B be an np matrix. Let z = S(y) = Ay for
 y1 
y
any column vector y =  .2  with n components and y = T(x) = Bx for any column vector
 
 yn 
 x1 
x
x =  .2  with p components. Finally, let R(x) = S(T(x)) be the composition of the
 
 xp 
functions S and T. Then R(x) = (AB)x.
Proof. R(x) = S(T(x)) = A(Bx) = (AB)x where we used (8) at the last equality. //
Here is an application that illustrates Proposition 2.
Example 4. In Example 3 in section 1.5 an electronics company made two types of circuit boards for
computers, namely thernet cards and sound cards. Each of these boards requires a certain number of
resistors, capacitors and transistors as follows
resistors
capacitors
transistors
thernet card
5
2
3
sound card
7
3
5
Let
e
s
r
c
= # of thernet 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 thernet cards and s sound cards
= # of capacitors needed to produce the e thernet cards and s sound cards
1.6 - 4
t = # of transistors needed to produce the e
thernet 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
(14)
v =  c  =  2e + 3s  =
(2, 3)  s 
=
t
 3e + 5s 
e
(3, 5)  s 
5 7
e
where
u =  s  and A =  2 3 .
3 5




Now suppose the company packages the
following number of each card.




t = 3e + 5s
5 7e
 2 3   s  = Au
3 5
thernet cards and sound cards into two bundles with the
Bundle #1
5
8
thernet cards
sound cards
bundle #1
10
5
Let
x
y
e
s
=
=
=
=
# of bundle #1 the company makes in a certain day
# of bundle #2 the company makes in a certain day
# of thernet 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
e = 5x + 10y
s = 8x + 5y
or
(15)
e
u = s  =
where w =
x
y
 5x + 10y  =
 8x + 5y 
and
 (5, 10)  x  
y
5 10
x

=  8 5   y  = Bw
 (8, 5)  x  

y 
5 10
B =  8 5 .
In order to find the number of resistors, capacitors and transistors needed to make x of bundle #1 and y of
bundle #2 we combine equations (14) and (15). So v = Au = A(Bw) = (AB)w, where we used the associative
property of matrix multiplication for the last equality. In Example 1 we computed AB. So
r = 81x + 85y
r
c =
t
 81
34
 55
85
35 
55 
x
y

c = 34x + 35y
t = 55x + 55y
If we put x = 1 and y = 0 we see that the significance of the first column of AB, i.e.
1.6 - 5
81 = # of resistors needed to make a bundle #1
34 = # of capacitors needed to make a bundle #1
55 = # of transitors needed to make a bundle #1
Similarly, the second column of AB has the number of resistors, capacitors and transistors to make a bundle
#1.
Matrix Powers. The powers of a square matrix are defined in an analogous fashion to
the powers of a number.
Definition 2. If A is a square matrix then A0 = I, A1 = A, A2 = AA, A3 = A2A = AAA, and,
in general,
An = AA…A = A multiplied by itself n times = An-1A
0 1
0 1
0 1
0 0
Example 4. Suppose J =  0 0 . Then J2 =  0 0   0 0  =  0 0  = 0, so Jn = 0 for all
n  2.
Proposition 3. If A is a square matrix then An+m = AnAm and (An)m = Anm. In particular
any two powers of a matrix commute. If A and B are square matrices that commute then
(AB)n = AnBn and
n
n
n
(A + B)n = An + 2An-2B2 + … +  j An-jBj + … + 2A2Bn-2 + nABn-1 + Bn
The last formula is called the binomial formula.
a 1
an nan-1
Example 5. Suppose K =  0 a . Then Kn =  0 an . To see this write K = aI + J and
use the binomial formula and the fact that Jn = 0 for all n  2.
1.6 - 6