Docsity

matrix multiplication matrix multiplicaityon, Summaries of Mathematics

Toggle sidebar
bg1
®
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 effect on the result. In this Section we pick our way through the
minefield of matrix multiplication.
Prerequisites
Before starting this Section you should . . .
•understand the concept of a matrix and
associated terms.
'
&
$
%
Learning Outcomes
On completion you should be able to . . .
•decide when the product AB exists
•recognise that AB 6=BA in most cases
•carry out the multiplication AB
•explain what is meant by the identity matrix I
HELM (2008):
Section 7.2: Matrix Multiplication
15
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download matrix multiplication matrix multiplicaityon and more Summaries Mathematics in PDF only on Docsity!

®

Matrix Multiplication







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 effect on the result. In this Section we pick our way through the minefield of matrix multiplication.









Prerequisites

Before starting this Section you should...

  • understand the concept of a matrix and associated terms.

'

&

$

%

Learning Outcomes

On completion you should be able to...

  • decide when the product AB exists
  • recognise that AB 6 = BA in most cases
  • carry out the multiplication AB
  • explain what is meant by the identity matrix I

HELM (2008): Section 7.2: Matrix Multiplication

1. Multiplying row matrices and column matrices together

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

A =

[

a b

]

B =

[

c d

]

The product of these two matrices is written AB and is the 1 × 1 matrix defined by:

AB =

[

a b

]

×

[

c d

]

= [ac + bd]

Note that corresponding elements are multiplied together and the results are then added together. For example

[ 2 − 3

]

×

[

]

= [12 − 15] = [−3]

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:

C =

[

]

B =

then we define the product of C with D as

CD =

[

]

×

 = [6^ −^12 −^ 6 + 10] = [−2]

The only requirement is that the number of elements of the row matrix is the same as the number of elements of the column matrix.

2. Multiplying two 2 ××× 2 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 is the same as the number of elements in the columns of B. In particular, we define 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 c d

]

×

[

w x y z

]

[

aw + by ax + bz cw + dy cx + dz

]

A B = C

The rule for calculating the elements of C is described in the following Key Point:

16 HELM (2008):

Workbook 7: Matrices

Finally find the two other elements of C = AB and hence write down the matrix C:

Your solution

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

C =

[

]

Clearly, matrix multiplication is tricky and not at all ‘natural’. However, it is a very important mathematical procedure with many engineering applications so must be mastered.

3. Some surprising results

We have already calculated the product AB where

A =

[

]

and B =

[

]

Now complete the following task in which you are asked to determine the product BA, i.e. with the matrices in reverse order.

Task For matrices A =

[

]

and B =

[

]

form the products of

row 1 of B and column 1 of A row 1 of B and column 2 of A row 2 of B and column 1 of A row 2 of B and column 2 of A

Now write down the matrix BA:

Your solution

Answer row 1, column 1 is 1 × 1 + (−1) × 3 = − 2 row 1, column 2 is 1 × 2 + (−1) × 4 = − 2 row 2, column 1 is − 2 × 1 + 1 × 3 = 1 row 2, column 2 is − 2 × 2 + 1 × 4 = 0

BA is

[

]

It is clear that AB and BA are not in general the same. In fact it is the exception that AB = BA. In the special case in which AB = BA we say that the matrices A and B commute.

18 HELM (2008):

Workbook 7: Matrices

®

Task Calculate AB and BA where

A =

[

a b c d

]

and B =

[

]

Your solution

Answer AB = BA =

[

]

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 is zero or b is zero or both are zero. The following task shows that this is not necessarily true for matrices.

Task Carry out the multiplication AB where

A =

[

]

, B =

[

]

Your solution

Answer AB =

[

]

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.

HELM (2008): Section 7.2: Matrix Multiplication

®

Task Calculate AB =

First find the element in row 2 column 1 of the product:

Your solution

Answer

Row 2 of A is (3, 4 , 0) column 1 of B is

The combination required is 3 × 2 + 4 × 1 + (0) × (0) = 10.

Now complete the multiplication to find all the elements of the matrix AB:

Your solution

Answer 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)

3 × 2 + 4 × 1 + 0 × 0 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)

i.e. AB =

The 3 × 3 unit matrix is: I =

 (^) and as in the 2 × 2 case this has the property that

AI = IA = A

The 3 × 3 zero matrix is

HELM (2008): Section 7.2: Matrix Multiplication

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.

Key Point 5

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 defined 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 jth^ column of C is obtained by multiplying the ith^ row of A with the jth^ column of B.

Example 4

Find the product AB if A =

[

]

and B =

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

AB =

[

]

×

[

]

[

]

[

]

[

]

[

]

22 HELM (2008):

Workbook 7: Matrices

Task Given A =

[

]

, B =

[

]

, C =

State which of the products AB, BA, AC, CA, BC, CB, (AB)C, A(CB) is defined and state the size (n × m) of the product when defined.

Your solution AB BA AC CA BC CB (AB)C A(CB)

Answer A B 2 × 3 2 × 2

not possible

B A

2 × 2 2 × 3

possible; result 2 × 3

A C

2 × 3 3 × 2

possible; result 2 × 2

C A

3 × 2 2 × 3

possible; result 3 × 3

B C 2 × 2 3 × 2

not possible

C B

3 × 2 2 × 2

possible; result 3 × 2

(AB)C not possible, AB not defined.

A (C B)

2 × 3 3 × 2

possible; result 2 × 2

We now list together some properties of matrix multiplication and compare them with corresponding properties for multiplication of numbers.

Key Point 6

Matrix algebra Number algebra A(B + C) = AB + AC a(b + c) = ab + ac AB 6 = BA in general ab = ba A(BC) = (AB)C a(bc) = (ab)c AI = IA = A 1 .a = a.1 = a A0 = 0A = 0 0 .a = a.0 = 0 AB may not be possible ab is always possible AB = 0 does not imply A = 0 or B = 0 ab = 0 → a = 0 or b = 0

24 HELM (2008):

Workbook 7: Matrices

®

Application of matrices to networks

A network is a collection of points (nodes) some of which are connected together by lines (paths). The information contained in a network can be conveniently stored in the form of a matrix.

Example 5

Petrol is delivered to terminals T 1 and T 2. They distribute the fuel to 3 storage depots (S 1 , S 2 , S 3 ). The network diagram below shows what fraction of the fuel goes from each terminal to the three storage depots. In turn the 3 depots supply fuel to 4 petrol stations (P 1 , P 2 , P 3 , P 4 ) as shown in Figure 2:

T 1 T 2

S 1 S^2 S 3

P 1 P 2 P 3 P^4

  1. 4

  2. 6

  3. 4

  4. (^4 0). 3

  5. (^5 0). 2

  6. 1

  7. 6

  8. 2

  9. 2

  10. 2

  11. 5

  12. 2

  13. 2

Figure 2 Show how this situation may be described using matrices.

Solution Denote the amount of fuel, in litres, flowing from T 1 by t 1 and from T 2 by t 2 and the quantity being received at Si by si for i = 1, 2 , 3. This situation is described in the following diagram:

S 1 S^2 S 3

T 1 T 2

  1. 4 0.^4 0.^3
  2. (^5 0). 2 0. 2

From this diagram we see that s 1 = 0. 4 t 1 + 0. 5 t 2 s 2 = 0. 4 t 1 + 0. 2 t 2 s 3 = 0. 2 t 1 + 0. 3 t 2

or, in matrix form:

s 1 s 2 s 3

[

t 1 t 2

]

HELM (2008): Section 7.2: Matrix Multiplication

®

Engineering Example 1

Communication network

Problem in words

Figure 3 represents a communication network. Vertices a, b, f and g represent offices. Vertices c, d and e represent switching centres. The numbers marked along the edges represent the number of connections between any two vertices. Calculate the number of routes from a and b to f and g

a

b

c

d

e

f

(^1) g

2

Figure 3: A communication network where a, b, f and g are offices and c, d and e are switching centres

Mathematical statement of the problem The number of routes from a to f can be calculated by taking the number via c plus the number via d plus the number via e. In each case this is given by multiplying the number of connections along the edges connecting a to c, c to f etc. This gives the result: Number of routes from a to f = 3 × 2 + 4 × 6 + 1 × 1 = 31.

The nature of matrix multiplication means that the number of routes is obtained by multiplying the matrix representing the number of connections from ab to cde by the matrix representing the number of connections from cde to f g.

Mathematical analysis The matrix representing the number of routes from ab to cde is:

( c^ d^ e a 3 4 1 b 2 1 3

The matrix representing the number of routes from cde to f g is:

   

f g c 2 1 d 6 3 e 1 2

HELM (2008): Section 7.2: Matrix Multiplication

The product of these two matrices gives the total number of routes.

( 3 4 1 2 1 3

3 × 2 + 4 × 6 + 1 × 1 3 × 1 + 4 × 3 + 1 × 2

2 × 2 + 1 × 6 + 3 × 1 2 × 1 + 1 × 3 + 3 × 2

Interpretation We can interpret the resulting (product) matrix by labelling the columns and rows.

f g a 31 17 b 13 11

Hence there are 31 routes from a to f , 17 from a to g, 13 from b to f and 11 from b to g.

28 HELM (2008):

Workbook 7: Matrices