2.5 Multiplication of Matrices

2.5 Multiplication of Matrices Example - A flower shop sells 96 roses, 250 carnations and 130 daisies in a week. The roses sell for $2 each, the carna...
Author: Beverley Foster
16 downloads 3 Views 69KB Size
2.5 Multiplication of Matrices Example - A flower shop sells 96 roses, 250 carnations and 130 daisies in a week. The roses sell for $2 each, the carnations for $1 each and the daisies for $0.50 each. Find the revenue of the shop during the week using matrices. Answer - Express the number of flowers in a 1x3 matrix:

In general, If A is 1xn and B is nx1, the product AB is a 1x1 matrix:

⎡ b11 ⎤ ⎢ ⎥ ⎢b ⎥ A ⋅ B = [ a11 a12 … a1n ]⋅ ⎢ 21 ⎥ ⎢ ⎥ ⎢ ⎥ ⎢bn1 ⎥ ⎣ ⎦ = [ a11 ⋅ b11 + a12 ⋅ b21 + … + a1n ⋅ bn1 ] Even more general,

Next express the price as a 3 x 1 matrix:

We can think of this as a type x price matrix.

The shop’s revenue is $507.00

23

If A is an mxn matrix and B is a nxp matrix, then the product matrix A·B=C is mxp.

⎡b b …⎤ ⎥ a1n ⎤ ⎢ 11 12 ⎥ ⎥ ⎢b21 b22 ⎥ a2 n ⎥ ⋅ ⎢ ⎥ ⎢ ⎥ ⎥  ⎥⎦ ⎢ ⎢bn1 ⎥  ⎣ ⎦ ⎡( a11 ⋅ b11 + a12 ⋅ b21 + …a1n ⋅ bn1 ) ( ab)12 …⎤ ⎢ ⎥ ⎥ ( ab) 22 =⎢ ( ab) 21 ⎢ ⎥ ⎢ ⎥   ⎣ ⎦ ⎡ a11 ⎢ A ⋅ B = ⎢ a21 ⎢ ⎢ ⎣

a12 a22 

… … 

24

Matrix multiplication is not commutative. That means, in general, that AB≠BA

One special matrix is called the identity matrix, I. It is a square matrix with 1's on the diagonal and zeros elsewhere,

Example: find the products AB and BA where

⎡1 0 … 0⎤ ⎢ ⎥ ⎢0 1 0⎥ ⎥ I =⎢ ⎢  ⎥ ⎢ ⎥ ⎢0 0 … 1⎥ ⎣ ⎦

⎡ 1 0⎤ ⎥ A= ⎢ ⎢⎣−2 3⎥⎦

⎡−1 2 ⎤ ⎥ B=⎢ ⎢⎣ 0 −3⎥⎦

Answer

I2 is a 2x2 identity matrix and In is an nxn identity matrix. The identity matrix has the following property

Matching dimensions is not everything!

Example - multiply our [A] from the last example by I.

Look back at the flower problem – a (3x1)*(1x3) gives a 3x3, but does it mean anything??

Answer –

25

26

Example - Cost Analysis - The Mundo Candy Company makes three types of chocolate candy: cheery cherry (cc), mucho mocha (mm) and almond delight (ad). The company produces its candy in San Diego (SD), Mexico City (MC) and Managua (Ma) using two main ingredients, sugar (su) and chocolate (choc). (a) Each kilogram (kg) of cheery cherry requires .5 kg of sugar and .2 kg of chocolate. Each kilogram of mucho mocha requires .4 kg of sugar and .3 kg of chocolate. Each kilogram of almond delight requires .3 kg of sugar and .3 kg of chocolate. Put this information in a 2x3 matrix.

27

(b) The cost of 1 kg of sugar is $3 in San Diego, $2 in Mexico City and $1 in Managua. The cost of 1 kg of chocolate is $3 in San Diego, $3 in Mexico City and $4 in Managua. Put this information into a matrix in such a way that when it is multiplied by the matrix in part (a) it will tell us the cost of producing each kind of candy in each city.

28

Matrix multiplication and linear equations:

2.6 Inverse of a Square Matrix

We can express a system of linear equations as a matrix product, AX=B.

For any non-zero real number r, the reciprocal (or inverse) is

Consider the system

2x − 3 y = 6 −x + 2 y = 4

1 or r −1 r

Multiplicative identity:

In matrix form this looks like

For matrices, the inverse is A-1 and it is defined by

⎡ 2 −3⎤ ⎡ x ⎤ ⎡ 6 ⎤ ⎢ −1 2 ⎥ ⎢ y ⎥ = ⎢ 4 ⎥ ⎣ ⎦⎣ ⎦ ⎣ ⎦

A matrix with no inverse is called singular. If needed, find the inverse with the x-1 function on the calculator. The one use of matrix inverses is to solve matrix equations. Solve the matrix equation AX = B for X

29

30

Solve the matrix equation D = X – AX for X.

Matrix inverses can be use to encrypt messages. First, assign each letter of the alphabet a number: 1 to A 8 to H 15 to O 22 to V

2 to B 9 to I 16 to P 23 to W

3 to C 10 to J 17 to Q 24 to X

4 to D 11 to K 18 to R 25 to Y

5 to E 12 to L 19 to S 26 to Z

6 to F 7 to G 13 to M 14 to N 20 to T 21 to U 27 to space

So the word aggies would be written To make this more difficult to decode, we can put the letters in a message matrix. Our encoding matrix will be 3x3, so our message will need to have 3 rows: M=

And multiply by an encoding matrix E =

EM =

31

32

Decode the message,

2.7 Leontief Input-Output Model

M = E-1 (EM) = Consider the economy of small village that has two industries, farming and weaving. The villagers find that to produce $1.00 of food, they need $0.40 of food and $0.10 of cloth.

Decode the message below using the encryption matrix E. 150 114 149 178 113 184 182 148 227 260 193 269

To produce $1.00 of cloth, they need $0.30 of food and $0.20 of cloth. The local city is demanding $7200 worth of food and $2700 of cloth. How much food and cloth needs to be produced to meet the villagers internal need and have the necessary exports? Define your variables, x1 = x2 = Set up the system of equations

33

34

x1 = 0.40x1 + 0.30x2 + 7200

X=

x2 = 0.10x1 + 0.20x2 + 2700 Define the following matrices So the village must produce ___________ of food and _________ of cloth to meet the internal and external demands.

X = production matrix =

A = I-O matrix = D = demand matrix = System can then be written as Solve this matrix equation

35

36

Given the following IO matrix, interpret the meaning of each element and find the amount each sector needs to produce to meet internal and external demand. auto A = energy transportation

auto 0.2 0.1 0.2

auto D = energy transportation

474 948 474

energy 0.4 0.2 0.2

transportation 0.1 0.2 0.1

in millions of dollars.

37