lecture 4 rules of matricies. addition and subtraction of matrices to add or subtract matrices, they...

93
Lecture 4 Rules of Matricies

Upload: shanon-hamilton

Post on 27-Dec-2015

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Lecture 4

Rules of Matricies

Page 2: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order,

m x n where m is the number of rows, and n is the number of columns. We always say the number of rows, then the number of columns in this order. To add matrices of the same order, add their corresponding entries. To subtract matrices of the same order, subtract their corresponding entries. The general rule is as follows using mathematical notation: The i represents the row number, and j the column number

ij ij

ij ij

A B a b

A B a b

Page 3: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Addition Add the matrices

4 3 1 1 2 3

0 5 2 6 7 9

5 6 0 0 4 8

Page 4: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: AdditionSolution Add the matrices

Solution: First note that each matrix has dimensions of 3x3, so we are able to perform the addition. The result is shown at right:

Adding corresponding entries, we have

4 3 1 1 2 3

0 5 2 6 7 9

5 6 0 0 4 8

3 1 4

6 2 7

5 10 8

Page 5: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Subtraction Now, we will subtract the

same two matrices

4 3 1 1 2 3

0 5 2 6 7 9

5 6 0 0 4 8

Page 6: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: SubtractionSolution Now, we will subtract the

same two matrices Subtract corresponding

entries as follows:

4 3 1 1 2 3

0 5 2 6 7 9

5 6 0 0 4 8

4 ( 1) 3 2 1 3

0 6 5 ( 7) 2 9

5 0 6 ( 4) 0 8

5 5 2

6 12 11

5 2 8

=

Page 7: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Scalar Multiplication

The scalar product of a number k and a matrix A is the matrix denoted by kA, obtained by multiplying each entry of A by the number k. The number k is called a scalar. In mathematical notation,

ijAk ka

Page 8: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Scalar Multiplication Find (-1)A, where A =

1 2 3

6 7 9

0 4 8

Page 9: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Scalar MultiplicationSolution Find (-1)A, where A =

Solution:

(-1)A= -11 2 3

6 7 9

0 4 8

1 2 3

6 7 9

0 4 8

1 2 3 1 2 3

( 1) 6 7 9 6 7 9

0 4 8 0 4 8

Page 10: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Alternate Definition of Subtraction of Matrices The definition of

subtraction of two real numbers a and b is a – b = a + (-1)b or “a plus the opposite of b”. We can define subtraction of matrices similarly:

If A and B are two matrices of the same dimensions, then A – B = A + (-1)B, where (-1) is a scalar.

Page 11: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example

The example on the right illustrates this procedure for two 2x2 matrices.

50

31

13

12

43

21

13

12)1(

43

21

13

12

43

21

Page 12: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Matrix EquationsExample: Find a, b, c, and d so that

2 1 4 3

5 6 2 4

a b

c d

Page 13: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Matrix EquationsExample: Find a, b, c, and d so that

2 1 4 3

5 6 2 4

a b

c d

Solution: Subtract the matrices on the left side:2 1 4 3

5 6 2 4

a b

c d

Use the definition of equality to change this matrix equation into 4 real number equations:

a - 2 = 4 b + 1 = 3 c + 5 = -2 d - 6 = 4 a = 6 b = 2 c = -7 d = 10

Page 14: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Product of a Row Matrix and a Column Matrix In order to understand the general procedure of matrix

multiplication, we will introduce the concept of the product of a row matrix by a column matrix.

A row matrix (or ROW VECTOR) consists of a single row of numbers, while a column matrix (or COLUMN VECTOR) consists of a single column of numbers. If the number of columns of a row matrix equals the number of rows of a column matrix, the product of a row matrix and column matrix is defined. Otherwise, the product is not defined.

Page 15: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Row by Column Multiplication

Example: A row matrix consists of 1 row of 4 numbers so this matrix has four columns. It has dimensions 1 x 4. This matrix can be multiplied by a column matrix consisting of 4 numbers in a single column (this matrix has dimensions 4 x 1).

1x4 row matrix multiplied by a 4x1 column matrix. Notice the manner in which corresponding entries of each matrix are multiplied:

Page 16: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Matricies in Mathematica

When multiplying matricies in Mathematica, you have to use what is called the “Dot” operator, see RV.CV

RV is 1x4 CV is 4x1, thus they are

conformable, and result in a 1x1 (otherwise known as a scalar)

Page 17: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Pay attention to order

Be careful however, as we will see, it REALLY matters what order you put things in when doing matrix mathematics

Multiplying CV.RV, gives you a 4x4. Why?

Page 18: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example:Revenue of a Car Dealer A car dealer sells four model types: A, B, C, D. In a

given week, this dealer sold 10 cars of model A, 5 of model B, 8 of model C and 3 of model D. The selling prices of each automobile are respectively $12,500, $11,800, $15,900 and $25,300. Represent the data using matrices and use matrix multiplication to find the total revenue.

Page 19: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Solution using Matrix Multiplication We represent the number of each model sold using a

row matrix (4x1), and we use a 1x4 column matrix to represent the sales price of each model. When a 4x1 matrix is multiplied by a 1x4 matrix, the result is a 1x1 matrix containing a single number.

12,500

11,80010 5 8 3 10(12,500) 5(11,800) 8(15,900) 3(25,300) 387,100

15,900

25,300

Page 20: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Mathematica… you need the dot

Page 21: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Matrix Product (Conformity)

If A is an m x p matrix and B is a p x n matrix, the matrix product of A and B, denoted by AB, is an m x n matrix whose element in the i th row and j th column is the real number obtained from the product of the i th row of A and the j th column of B. If the number of columns of A does not equal the number of rows of B, the matrix product AB is not defined. Very easy to keep track of if you always write down the matrix dimensions. Inner numbers must be equal, outer numbers give you new matrix size with m rows and n columns

Page 22: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Premultiply and Postmultiply are not the same (noncommutative) Premultiply A by B means

BA Postmultiply A by B means

AB

Page 23: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Multiplying a 2x4 matrix by a 4x3 matrix to obtain a 2x3

The following is an illustration of the product of a 2x4 matrix with a 4x3. (Note 4=4, and 2x3 is new matrix dimension. First, the number of columns of the matrix on the left must equal the number of rows of the matrix on the right, so matrix multiplication is defined. A row-by column multiplication is performed three times to obtain the first row of the product: 70 80 90.

Page 24: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Final Result

Page 25: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Undefined Matrix Multiplication

Why is the matrix multiplication below not defined?

4 by 3 and a 2 by 4. 3 is not 2… can’t proceed!

Page 26: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Undefined Matrix MultiplicationSolution

Why is the matrix multiplication below not defined? The answer is that the left matrix has three columns but the matrix on the right has only two rows. To multiply the second row [4 5 6] by the third column, 3 , there is no number to pair with 6 to multiply. 7

Page 27: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example

1 6

3 5

2 4

Given A = B =

Find AB if it is defined:

3 1 1

2 0 3

1 6

3 5

2 4

3 1 1

2 0 3

2x3 3x2

3=32x2 is new size

Page 28: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Solution

2 0 3

3 1 1

Since A is a 2 x 3 matrix and B is a 3 x 2 matrix, AB will be a 2 x 2 matrix. 1. Multiply first row of A by first column of B: 3(1) + 1(3) +(-1)(-2)=82. First row of A times second column of B: 3(6)+1(-5)+ (-1)(4)= 9 3. Proceeding as above the final result is

6

5

4

1

3

2

4

98

4 2

=

Page 29: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Is Matrix Multiplication Commutative?

1 6

3 5

2 4

3 1 1

2 0 3

Now we will attempt to multiply the matrices in reverse order: BA = ?

We are multiplying a 3 x 2 matrix by a 2 x 3 matrix. This matrix multiplication is defined, but the result will be a 3 x 3 matrix. Since AB does not equal BA, matrix multiplication is not commutative.

15 1 17

1 3 18

2 2 14

=

Page 30: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Transposes of Matricies Now, we will find the

Transpose of the matrix. You just make the rows into columns.

If it is a column vector, it becomes a row vector, and vice versa

It is denoted by a PRIME or what you see as an apostrophe.

ihg

fed

cba

ifc

heb

gda

Page 31: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Rules of Transpose

(A’)’=A (A+B)’=A’+B’ (AB)’=B’A’

The third is the most confusing, but most important!!!

We use this property quite a bit in economics

Page 32: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Practical Application

Suppose you a business owner and sell clothing. The following represents the number of items sold and the cost for each item. Use matrix operations to determine the total revenue over the two days: Monday: 3 T-shirts at $10 each, 4 hats at $15 each, and 1 pair of shorts at $20. Tuesday: 4 T-shirts at $10 each, 2 hats at $15 each, and 3 pairs of shorts at $20.

Page 33: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Solution of Practical Application Represent the information using two matrices: The product of

the two matrices gives the total revenue:

Then your total revenue for the two days is = [110 130] Price times Quantity = Revenue

3 4

10 15 20 4 2

1 3

Unit price of each item:

Qty sold of each item on Monday

Qty sold of each item on Tuesday

Page 34: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Identity Matrix for Multiplication

1 is called the multiplicative identity for real numbers since a(1) = (1)a = aFor example 5(1) = 5

A matrix is called square if it has the same number of rows and columns, that is, it has size n x n.

The set of all square matrices of size n x n also has a multiplicative identity In, with the property

AIn = InA = A

In is called the n x n identity matrix.

Page 35: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Identity Matrices

2 x 2 identity matrix: 3 x 3 identity matrix

1 0

0 1

1 0 0

0 1 0

0 0 1

Page 36: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Identity Matrix Multiplication

AI = A (Verify the multiplication) We can also show that IA = A and in general AI = IA =

A for all square matrices A.

11 12 13 11 12 13

21 22 23 21 22 23

31 32 33 31 32 33

1 0 0

0 1 0

0 0 1

a a a a a a

a a a a a a

a a a a a a

Page 37: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Inverse of a Matrix

All real numbers (excluding 0) have an inverse.

For example

15 1

5

11a

a

.

Page 38: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Matrix Inverses Matrix must be square to have an inverse Some (not all) square matrices also have matrix inverses If the inverse of a matrix A exists, we shall call it A-1

Then

1 1nA A A A I

Notice this is ‘commutative’ and a square multiplied by it’s inverse is equal to the identity matrix. More specifically, the equation to find an inverse is 1/determinant of A, multiplied by the adjoint (or minor) of A. Determinants? Adjoints?

A ofadjoint theis C where,' where,11 CadjAadjAA

A

Page 39: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

This formula comes in handy

A ofadjoint theis C where,' where,11 CadjAadjAA

A

Page 40: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Rules of Matrix Inversion

The second rule here is the most frequently used. It’s really important you get the order correct.

)'()'(

)(

)(

11

111

11

AA

ABAB

AA

Page 41: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Inverse of a 2x2 Matrix, formulaic

There is a simple procedure to find the inverse of a two by two matrix. This procedure only works for the 2 x 2 case.

An example will be used to illustrate the procedure. Example: Find the inverse of 2 3

1 2

Page 42: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Inverse of a 2x2 matrix (memorize) Step 1: Determine whether or not the inverse actually

exists. We define Δ = the determinant of the matrix.

In order for the inverse of a 2 x 2 matrix to exist, Δ cannot equal zero. (We will call this a determinant)

If Δ happens to be zero, then we conclude the inverse does not exist, and we stop all calculations.

In our case Δ = 2(2)-1(3) = 1, so we can proceed.

2 3

1 2

Det[] finds the matrix determinant ad-bc for a 2x2

Page 43: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Inverse of a 2x2 matrix (continued)

2 3

1 2

Step 2. Reverse the entries on the main diagonal.In this example, both entries are 2, and no change is visible.Step 3. Reverse the signs of the other diagonal entries 3 and 1 so they become -3 and -1 Step 4. Divide each element of the matrix by the ‘determinant’ which in this case is 1, so no apparent change will be noticed.

2 3

1 2

Page 44: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Inverse of a 2x2 matrix (continued) The inverse of the matrix is then

To verify that this is the inverse, we will multiply the original matrix by its inverse and hopefully obtain the 2 x 2 identity matrix:

2 3

1 2

2 3

1 2

2 3

1 2

= 4 3 6 6 1 0

2 2 3 4 0 1

Page 45: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

General 2x2 Matrix Inversion

Page 46: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Adjoint (Minors and Cofactors) The adjoint is defined as a matrix of ‘cofactors’ (see

the C) which are determinants of minor matricies multiplied by negative 1 if the sum of R&C is odd

The minor of element a11 below is

3331

131122

3332

232211

333231

232221

131211

M and ,M where,aa

aa

aa

aa

aaa

aaa

aaa

j COLUMN and i,ROW IN NOT are

tmatrix tha theof elements allOr ij. ELEMENT ofminor theas defined is

||)1(|C| where,

||||||

||||||

||||||

' ij

21

22221

11211

ij

ijji

nnnn

n

n

M

M

CCC

CCC

CCC

adjAC

Page 47: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

First, a 2x2

example. in this 1or |A|1/by hismultiply t step...last The

21

32 giving matrix'cofactor ' thisposemust trans weNow,

23

12 giving 1(-1) changesign no and 2,t Determinan with ,2M Now

,3

12 change.sign and 3,t Determinan with ,3M Now ,

12

1(-1) and 321 since changesSign 1,t Determinan 2.column 1, rowin not elements ,1M

.2

2. ismatrix cofactor our in 1,1element Thus

scalar theof value theisscalar a oft determinan thesince 2M oft determinan The

positive is and ,1(-1) thus2,11ji and one,column

or one rowin not is that right termlower the,2Mminor The matrix.cofactor theNow,

1.simply moreor 1/1 is inversean findingfor formula

sChiang'in first termour So 1.(3)(1)-(2)(2) is A, oft determinan theFirst, ,21

32

even22

21

312

11

2

11

Page 48: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Inverse of a 3x3 Matrix

Find the inverse of

Start by finding the determinant of the matrix (expand along first column 1((1)(1)-(2)(-2)) + (-1)2((-1)(1)-(3)(-2)) + (-2)((-1)(2)-(3)(1)) =

1(5)+-2(5)+(-2)(-5) = 5. The first term in the formula is 1/|A| = 1/5 or 0.2.

1 1 3

2 1 2

2 2 1

2- of valuea 1,3element giving 1,by multiplied 2,- ist determinan ,22

12M

6element 1,2 giving ,1(-1)by multiplied 6, oft determinan a giving,12

22M

5 ismatrix cofactor our in 1,1element thus,5)2*2(1*1M oft determinan The

positive is and ,1(-1) thus2,11ji and ,12

21M where,

122

212

311

13

312

11

211

Page 49: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

2-6-5

C

-2.C of valuea 1,3element giving 1,by multiplied 2,- ist determinan ,22

12M

-6C giving ,1(-1)by multiplied 6, oft determinan a giving,12

22M

5 ismatrix cofactor our in )(C 1,1element thus,5)2)(2()1(1M oft determinan The

positive is and ,1(-1) thus2,11ji and ,12

21M

ts.determinanminor ofmatrix C where,C'adjA adjA.2.

1A ,

122

212

311

1313

123

12

1111

211

1-

Page 50: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

it!Check original.our of inversean isit NOW .

5/35/45/2

5/45/75/6

1-1-1

342

476

5-5-5

5

1

342

476

5-5-5

C',

345

475

2-6-5

C,3C change,sign no ,3,12

11M

4C change,sign ,4,22

31M

5C change,sign no ,5,21

31M

475

2-6-5

C,4C change,sign ,4,22

11M

7C change,sign no ,7,12

31M

5C change,sign ,5,12

31M

ts.determinanminor ofmatrix C where,C'adjA adjA.2.

1A ,

122

212

311

3333

3232

3131

2323

2222

2121

1-

D

D

D

D

D

D

Page 51: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Inverse of a General Square Matrix

1. Augment the matrix with the n x n identity matrix. 2. Use elementary row operations to transform the

matrix on the left side of the vertical line to the n x n identity matrix. The row operations are used for the entire row, so that the matrix on the right hand side of the vertical line will also change.

3. When the matrix on the left is transformed to the n x n identity matrix, the matrix on the right of the vertical line is the inverse.

Page 52: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Inverse of a 3x3 Matrix Find the inverse of

Step 1. Multiply R1 by (-2) and add the result to R2. Step 2. Multiply R1 by 2 and add the result to R3

1 1 3

2 1 2

2 2 1

Page 53: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example (continued) Step 3. Multiply row 2 by (1/3) to get a 1 in the second

row, first position. Step 4. Add R2 to R1. Step 5. Multiply R2 by 4 and add the result to R3. Step 6. Multiply R3 by 3/5 to get a 1 in the third row, third

position.

Page 54: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example (continued) Step 7. Eliminate the (5/3) in the first row, third position by

multiplying R3 by (-5/3) and adding result to R1. Step 8. Eliminate the (-4/3) in the second row, third position

by multiplying R3 by (4/3) and adding result to R2. Step 9. You now have the identity matrix on the left, which

is our goal.

Page 55: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example Solution The inverse matrix appears on the right hand side of

the vertical line and is displayed below. Many calculators as well as computers have software programs that can calculate the inverse of a matrix quite easily.

Page 56: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Determinant and Inverse of 3x3 GENERAL

Rearrangement of the Mathematica output in the second line you should see a(ei-fh) + b(ei-fg) + c(dh-ge). This is called ‘expanding’ along the first row, and multiplying by the ‘sub-determinants’ or determinant of the matrix made up of those values that are not in the same row or column as your expansion term…

Page 57: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Cramer’s Rule

Cramer’s Rule, extends from the previous method of inversion using the adjoint (or transpose of the cofactor matrix… or more thoroughly the transpose of the matrix of minor determinants), to a system of equations.

If we have a problem, such as Ax=d where x is a column vector of unknowns, and d is a column vector of answers, we can find xi by replacing the ith column of A with the values from d, take the determinant, and then divide it by the determinant of A

Page 58: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Cramer’s Rule

Generally… x*j is the solution to the jth variable.

x*j is found by

nnnnn

n

n

j

adaa

adaa

adaa

AA

A

21

222221

111211

||

1

||

||

Page 59: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Cramer’s Rule in Mathematica

Page 60: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Matrix Equations

Let’s review one property of solving equations involving real numbers. Recall If ax = b then x = , or

A similar property of matrices will be used to solve systems of linear equations.

Many of the basic properties of matrices are similar to the properties of real numbers, with the exception that matrix multiplication is not commutative.

1b

a

b

a

Page 61: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Basic Properties of Matrices

Assuming that all products and sums are defined for the indicated matrices A, B, C, I, and 0, we have Addition Properties

Associative: (A + B) + C = A + (B+ C)Commutative: A + B = B + AAdditive Identity: A + 0 = 0 + A = AAdditive Inverse: A + (-A) = (-A) + A = 0

Page 62: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Basic Properties of Matrices(continued) Multiplication Properties

Associative Property: A(BC) = (AB)CMultiplicative identity: AI = IA = AMultiplicative inverse: If A is a square matrix and

A-1 exists, then AA-1 = A-1A = I Combined Properties

Left distributive: A(B + C) = AB + ACRight distributive: (B + C)A = BA + CA

Page 63: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Basic Properties of Matrices(continued) Equality

Addition: If A = B, then A + C = B + CLeft multiplication: If A = B, then CA = CBRight multiplication: If A = B, then AC = BC

The use of these properties is best illustrated by an example of solving a matrix equation.

Example: Given an n x n matrix A and an n x p matrix B and a third matrix denoted by X, we will solve the matrix equation AX = B for X.

Page 64: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Solving a Matrix EquationReasons for each step:1. Given; since A is n x n,

X must by n x p.2. Multiply on the left by A-1.3. Associative property of matrices4. Property of matrix inverses.5. Property of the identity matrix6. Solution. Note A-1 is on the left of

B. The order cannot be reversed because matrix multiplication is not commutative.

1 1

1 1

1

1

n

AX B

A AX A B

A A X A B

I X A B

X A B

Page 65: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example Example: Use matrix inverses to

solve the system 2 1

2 2

2 2 3

x y z

x y

x y z

Page 66: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example Example: Use matrix inverses to

solve the system

Solution: Write out the matrix of

coefficients A, the matrix X containing the variables x, y, and z, and the column matrix B containing the numbers on the right hand side of the equal sign.

2 1

2 2

2 2 3

x y z

x y

x y z

1 1 2

2 1 0

1 2 2

A

1

2

3

B

x

X y

z

Page 67: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example (continued)

1 1 2

2 1 0

1 2 2

x

y

z

Form the matrix equation AX = B. Multiply the 3 x 3 matrix A by the 3 x 1 matrix X to verify that this multiplication produces the 3 x 3 system at the bottom:

2 1

2 2

2 2 3

x y z

x y

x y z

1

2

3

Page 68: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example (continued) If the matrix A-1 exists, then the

solution is determined by multiplying A-1 by the matrix B. Since A-1 is 3 x 3 and B is 3 x 1, the resulting product will have dimensions 3 x 1 and will store the values of x, y and z.

A-1 can be determined by the methods of a previous section or by using a computer or calculator. The resulting equation is shown at the right:

1X A B

1 1 112 2 2

1 0 1 2

3 1 1 3

4 4 4

X

Page 69: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example Solution

1X A B

1 1 112 2 2

1 0 1 2

3 1 1 3

4 4 4

X

The product of A-1 and B is The solution can be read off from the X matrix:

x = 0, y = 2,z = -1/2

Written as an ordered triple of numbers, the solution is (0, 2, -1/2)

0

2

1

2

X

Page 70: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Doing this using Mathematica

Page 71: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Another ExampleExample: Solve the system on the right using the inverse matrix method.You can enter this in Mathematica the old way as well if you desire.Notice, that this won’t work, what is Mathematica telling us?

2 1

2 2 2

3 3 4

x y z

x y z

x y z

Page 72: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Another ExampleExample: Solve the system on the right using the inverse matrix method.

Solution:The coefficient matrix A is displayed at the right. The inverse of A does not exist. (We can determine this by using a calculator.) We cannot use the inverse matrix method. Whenever the inverse of a matrix does not exist, we say that the matrix is singular. We can figure this out because the determinant of this matrix is ZERO

2 1

2 2 2

3 3 4

x y z

x y z

x y z

1 2 1

2 1 2

3 1 3

Page 73: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Singular Matrix

Determinant is ZERO For a system to be

solvable… it must have a NON-ZERO DETERMINANT

Also called “NONSINGULAR”

For matrix Determinant is1((-1)*3-2*1)+2(2*3-2*3)+1(2*1-(-1)*3)

OR-5+0+5=0… This is singularTry expanding along the

second row, or second column… always the same

Page 74: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Cases When Matrix Techniques Do Not Work There are two cases when inverse methods will not work:

1. If the coefficient matrix is singular 2. If the number of variables is not the same as the number of equations.

Page 75: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Application

Guitar model Labor cost Material cost

A $30 $20

B $40 $30

Production scheduling: Labor and material costs for manufacturing two guitar models are given in the table below: Suppose that in a given week $1800 is used for labor and $1200 used for materials. How many of each model should be produced to use exactly each of these allocations?

Page 76: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

SolutionLet x be the number of model A guitars to produce and y represent the number of model B guitars. Then, multiplying the labor costs for each guitar by the number of guitars produced, we have

30x + 40y = 1800 Since the material costs are $20 and $30 for models A and B respectively, we have

20x + 30y = 1200.

This gives us the system of linear equations:

30x + 40y = 1800 20x + 30y = 1200

We can write this as a matrix equation:

1200

1800

3020

4030

y

x

Page 77: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Solution (continued)1X A B

30 40

20 30A

The inverse of matrix A is

Solution: Produce 60 model A guitars and no model B guitars.

0.3 0.4

0.2 0.3

0

60

1200

1800

3.02.0

4.03.0

y

x

Page 78: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Leontief Input-Output Analysis In this section, we will study an important economic

application of matrix inverses and matrix multiplication. This branch of applied mathematics is called input-output

analysis and was first proposed by Wassily Leontief, who won the Nobel Prize in economics in 1973 for his work in this area.

Page 79: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Wassily Leontief (continued)At Harvard, he developed his theories and methods of Input-Output analysis. This work earned him the Nobel prize in Economics in 1973 for his analysis of America's production machinery. His analytic methods, as the Nobel committee observed, became a permanent part of production planning and forecasting in scores of industrialized nations and in private corporations all over the world.Professor Leontief passed away on Friday February 6th, 1999. For more information on his life, visit http://www.iioa.org/leontief/Life.html

Page 80: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Basic Input-Output ProblemThe main problem of input-output analysis is the following:

Consider an economy with several industries. Each industry has a demand for products from other instrustries (internal demand). There are also external demands from the outside. Find a production level for the industries that will meet both internal and external demands.

Page 81: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Two-Industry Model ExampleWe start with an economy that has only two industries (agriculture and energy) to illustrate the method. Later, this method will generalized to three or more industries. These two industries depend upon each other. For example, each dollar’s worth of agriculture produced requires $0.40 of agriculture and $0.20 of energy. Each dollar’s worth of energy produced requires $0.20 of agriculture and $0.10 of energy.So, both industries have an internal demand for each others resources. Let us suppose there is an external demand of $12,000,000 of agriculture and $9,000,000 dollars of energy.

Page 82: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Matrix Equations

Let x represent the total output from agriculture and y represent the total output of energy (in millions of $)The expressions

0.4x + 0.2y 0.2x + 0.1y

can be used to represent the internal demands for agriculture and energy.

The external demands of 12 and 9 million must also be met, so the revised equations are :

x = 0.4x + 0.2y + 12 y = 0.2x + 0.1y + 9

These equations can be represented by the following matrix equation:

0.4 0.2 12

0.2 0.1 9

x x

y y

Page 83: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example:Technology Matrix (M )

$1

$1

$1 $1

input from input from

agriculture agriculture

to produce to produce

of agriculture of energy

input of energy input of energy

to produce to produce of

of agriculture energy

0.4 0.2

0.2 0.1

A

A

E

Read left to right, E then up

= M

Page 84: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Solving the Matrix Equations0.4 0.2 12

0.2 0.1 9

x x

y y

We can solve this matrix equation as follows:

X = MX+D

X – MX = D

IX – MX = D

(I – M)X = D

if the inverse of (I – M) exists.

1( )X I M D

Page 85: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Solution

We will now find 1( )X I M D

1 0 0.4 0.2 0.6 0.2

0 1 0.2 0.1 0.2 0.9

First, find (I – M):

1.8 .4

.4 1.2

The inverse of (I – M) is:

Page 86: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Solution (continued) After finding the inverse of (I – M), multiply that result by the external demand matrix D. The answer is:Produce a total of $25.2 million of agriculture and $15.6 million of energy to meet both the internal demands of each resource and the external demand.

1.8 .4

.4 1.2

12

9

25.2

15.6

Page 87: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Another Example

Suppose consumer demand changes from $12 million dollars of agriculture to $8 million dollars and energy consumption changes from $9 million to $5 million. Find the output for each sector that is needed to satisfy this final demand.

Page 88: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example (continued)

Suppose consumer demand changes from $12 million dollars of agriculture to $8 million dollars and energy consumption changes from $9 million to $5 million. Find the output for each sector that is needed to satisfy this final demand. Solution: Recall that our general solution of the problem is

The only change in the problem is the external demand matrix. (I – M) did not change. Therefore, our solution is to multiply the inverse of (I –M) by the new external demand matrix D.

1( )X I M D

Page 89: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

ExampleSolution

1( )X I M D

1.8 .4

.4 1.2

8 16.4

5 9.2

Page 90: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

More Than Two Sectors of the EconomyThis method can also be used if there are more than two sectors of the economy. If there are three sectors, say agriculture, building and energy, the technology matrix M will be a 3 x 3 matrix. The solution to the problem will still be

although in this case it is necessary to determine the inverse of a 3 x 3 matrix.

1( )X I M D

Page 91: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example: Three-Industry ModelAn economy is based on three sectors, agriculture (A), energy (E), and manufacturing (M). Production of a dollar’s worth of agriculture requires an input of $0.20 from the agriculture sector and $0.40 from the energy sector. Production of a dollar’s worth of energy requires an input of $0.20 from the energy sector and $0.40 from the manufacturing sector. Production of a dollar’s worth of manufacturing requires an input of $0.10 from the agriculture sector, $0.10 from the energy sector, and $0.30 from the manufacturing sector.

Find the output from each sector that is needed to satisfy a final demand of $20 billion for agriculture, $10 billion for energy, and $30 billion for manufacturing.

Page 92: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example(continued)The technology matrix is as follows:

0.2 0 0.1

0.4 0.2 0.1

0 0.4 0.3

Output

A E Ma

Input

A

E

Ma

= M

0.8 0 0.1

0.4 0.8 0.1

0 0.4 0.7

I M

1

1.3 0.1 0.2

( ) 0.7 1.4 0.3

0.4 0.8 1.6

I M

Page 93: Lecture 4 Rules of Matricies. Addition and Subtraction of Matrices To add or subtract matrices, they must be of the same order, m x n where m is the number

Example(continued)

Thus, the output matrix X is given by:

1

2

3

1.3 0.1 0.2 20 33

0.7 1.4 0.3 10 37

0.4 0.8 1.6 30 64

x

x

x

X (I - M)-1 D

An output of $33 billion for agriculture, $37 billion for energy, and $64 billion for manufacturing will meet the given final demands.