topic 4: matrices - carol newman€¦ · • each element of a matrix has a corresponding cofactor...

41
Topic 4: Matrices Reading: Jacques: Chapter 7, Section 7.1-7.3 1. Adding, subtracting and multiplying matrices 2. Matrix inversion 2. Matrix inversion 3. Application: National Income Determination

Upload: others

Post on 14-Nov-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Topic 4: MatricesReading: Jacques: Chapter 7, Section 7.1-7.3

1. Adding, subtracting and multiplying matrices

2. Matrix inversion2. Matrix inversion

3. Application:

• National Income Determination

Page 2: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

What is a matrix?

• A Matrix is a two-dimensional array of numbers arranged in rows and columns

• Convenient way of describing data

• Example: Suppose a firm produces 3 goods and sells those goods to 2 consumers. Sales in June are given by:

June Sales

7 3 4

1 5 6

=

A

June Sales

G1 G2 G3

Sold to consumer

C1 7 3 4

C2 1 5 6

A matrix is a convenient way of representing this information:

Page 3: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

What is a matrix?

• Each entry is said to be an element of the matrix

• A matrix that has m rows and n columns is said to be a matrix of order m x n

• They are denoted by capital letters in bold type (e.g. A, B, C,…)

• Elements are denoted by their corresponding lower-case • Elements are denoted by their corresponding lower-case letter in ordinary type (e.g. a, b, c,…)

• Subscript tells us which row (i) and column (j) the element enters (e.g. aij, bij, cij,….)

• Example: The matrix A is of order 2x3:

11 12 13

21 22 23

7 3 4

1 5 6

a a a

a a a

= =

A

Page 4: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

What is a matrix?

• A row vector is a matrix with only one row. Example:

[ ]5 2 3 8b =

2

d =

• A column vector is a matrix with only one column. Example:

5

9

d =

• Basic Matrix Operations:

• Transposition

• Addition and Subtraction

• Scalar Multiplication

• Matrix Multiplication

Page 5: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Transposition

• The transpose of a matrix replaces the rows with the columns

• The matrix A is of order 2x3:

11 12 13

21 22 23

a a a

a a a

=

A21 22 23a a a

• The transpose of A is of order 3x2:

11 21

12 22

13 23

a a

a a

a a

=

TA

Page 6: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Transposition• Example: Say we want to present the information as follows:

June Sales

G1 G2 G3

Sold to consumer

C1 7 3 4

C2 1 5 6

7 3 4

1 5 6

=

A7 1

3 5

4 6

=

TA

Sold to Consumer

C1 C2

June Sales G1 7 1

G2 3 5

G3 4 6

Page 7: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Adding and Subtracting Matrices

• Matrices can be added or subtracted by adding and subtracting the corresponding elements

• Only matrices of the same order (same number of rows and columns) can be added and subtracted

Page 8: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Adding and Subtracting Matrices

• Example: Suppose a firm produces 3 goods and sells those goods to 2 consumers. Sales in June are given by:

June Sales

G1 G2 G3

Sold to consumer

C1 7 3 4

C2 1 5 6

Sales in July are given by:

What are total sales for June and July?

consumer C2 1 5 6

July Sales

G1 G2 G3

Sold to consumer

C1 6 2 1

C2 0 4 4

Page 9: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Adding and Subtracting Matrices

• Write as matrices:

7 3 4

1 5 6

=

A6 2 1

0 4 4

=

B

• C is a matrix representing combined sales for June and July by good and consumer

7 6 3 2 4 1 13 5 5

0 1 5 4 6 4 1 9 10

+ + + + = = = + + +

A B C

Page 10: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Adding and Subtracting Matrices

• Example: D – E = F dij – eij = fij

5 8

2 1

=

D6 10

1 4

=

E

5 6 8 10 1 2

2 1 1 4 1 3

− − − − − = = = − − −

D E F2 1 1 4 1 3

− = = = − − − D E F

• Note:

• If A and B are mxn matrices, then A+B=B+A

• If A is an mxn matrix then A – A = 0 where 0 is a zero matrix of order mxn. Example:

7 3 4 7 3 4 0 0 0

1 5 6 1 5 6 0 0 0

− = − =

A A

• A + 0 = A

Page 11: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Scalar Multiplication

• To multiply a matrix A by a scalar k we multiply each element of A by k:

11 12 13

21 22 23

31 32 33

k a k a k a

k k a k a k a

k a k a k a

× × × = × × × × × ×

A

31 32 33

• Example:

• Suppose sales are the same every month as they are in June. What are total sales for the year by product and consumer?

12 7 12 3 12 4 84 36 4812 12

12 1 12 5 12 6 12 60 72

× × × × = = = × × ×

A A

• Examples

Page 12: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Multiplication

• To multiply a matrix A by a matrix B, the number of columns in Amust be equal to the number of rows in B

• First consider the multiplication of 2 vectors a and b

[ ] ( )saaa s ×= 1 ... 11211a ( )1 ...21

11

×

= sb

b

b

• Example: Find ab

( )1 ...

1

×

= s

bs

b

[ ] ( )11 ......

... 1121121111

1

21

11

11211 ×+++=

= ss

s

s bababa

b

b

b

aaaab

[ ]321=a

=6

5

4

b

Page 13: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Multiplication

• Example: Find ab

[ ]321=a

=6

5

4

b

• First check that they conform!

[ ] ( )1 2 3 1 3a = × ( )4

5 3 1

6

b = ×

[ ] ( ) ( ) ( ) ( )4

1 2 3 5 1 4 2 5 3 6 32 1 1

6

ab scalar = = + + = ×

• Example

Page 14: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Multiplication

• In general if A is m x s and B is s x n then A and B can be multiplied:

A x B = C

(m x s) (s x n) (m x n)

• cij is found by multiplying the ith row of A into the jth column of B

• Example: 1211 bb• Example:

a x B = c

(1 x 3) (3 x 2) (1 x 2)

[ ]11 12c c c=

11 11 11 12 21 13 31c a b a b a b= + +

[ ]

==

32

22

12

31

21

11

131211 ,

b

b

b

b

b

b

aaa Ba

Note: Order of new matrix

Page 15: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Multiplication

• In general if A is m x s and B is s x n then A and B can be multiplied:

A x B = C

(m x s) (s x n) (m x n)

• cij is found by multiplying the ith row of A into the jth column of B

• Example: 1211 bb• Example:

a x B = c

(1 x 3) (3 x 2) (1 x 2)

11 11 11 12 21 13 31c a b a b a b= + +

12 11 12 12 22 13 32c a b a b a b= + +

[ ]

==

32

22

12

31

21

11

131211 ,

b

b

b

b

b

b

aaa Ba

[ ]11 12c c c=

Page 16: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Multiplication

• Example: Find c=aB

11 1 2 4 5 6 1 28c = × + × + × =

Remember: Always check order to make sure multiplication can be performed

[ ]

==4

2

3

1

5

2

,641 Ba

11

12

1 2 4 5 6 1 28

1 3 4 2 6 4 35

c

c

= × + × + × == × + × + × =

• Example: Find C=AB

3 1 2 12 1 0

1 0 1 21 0 4

5 4 1 1

= =

A , B

[ ]28 35aB c= =

Page 17: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Properties - Summary

A + B = B + A a+b=b+a

A – A = 0 a-a=0

A + 0 = A a+0=a

k(A + B) = kA + kB k(a+b)=ka+kb

Scalar Counterpart

k(A + B) = kA + kB k(a+b)=ka+kb

k(lA) = (kl)A k(la)=(kl)a

A(B + C) = AB +AC a(b+c)=ab+ac

(A + B) C = AC + BC (a+b)c=ac+bc

A(BC) = (AB)C a(bc)=(ab)c

AB = BA ab=ba

Page 18: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

System of equations in Matrix form

• Matrix notation can be used to illustrate familiar mathematics problems e.g. a system of linear equations:

=

=+=+

:asnotation Matrix in expressed beCan

52

1134

bAx

yx

yx

A contains coefficientsx contains unknownsb contains right hand sides

=

=

=

=

5

11 , ,

12

34

where

bxA

bAx

y

x

Page 19: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Inversion

• Square matrix: number of rows and columns are equal• Identity matrix: analogous to number 1 in ordinary arithmetic

==

AI A

IA A• 2x2 Identity Matrix:

1 0

Scalar Counterpart: 1.a=a

• 3x3 Identity Matrix:

1 0

0 1

=

I

1 0 0

0 1 0

0 0 1

I =

Page 20: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Matrix Inversion

• Square matrix: number of rows and columns are equal• Identity matrix: analogous to number 1 in ordinary arithmetic

==

AI A

IA A• If A 2x2:

1 0 a a a b

Scalar Counterpart: 1.a=a

• There is another matrix:

1 0

0 1

=

I11 12

21 22

a a a b

a a c d

= =

A

1 1 d b

c aad bc− −

= −− A

• Such that: -1 1

-1

and

is the inverse of

−= =A A I AA I

A AScalar Counterpart:

a.a-1=1

Page 21: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Inverse of a 2x2 matrix

• How to invert a 2x2 matrix:

1. Swap the two numbers on the lead diagonal

a b

c d

=

A

d b

1

ad bc−

2. Change the sign of the off-diagonal elements

c a

3. Multiply the matrix by the scalar

d b

c a

− −

Page 22: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Determinant of a 2x2 matrix

• Determinant of a matrix (2x2) case:

a b

c d

=

A

( )deta b

ad bcc d

= = = −A A

• Note: If

( )c d

• A matrix with a non-zero determinant is said to be

non-singular

• Example: Find the inverse of the following matrices. Are they singular or non-singular?

-10 does not exist=A A

2 5

4 10

=

B1 2

3 4

=

A

1

0Since does not exist

Page 23: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Solving Systems of Equations

• Matrices can be used to solve systems of equations

• From before:

=

=+=+

:asnotation Matrix in expressed beCan

52

1134

bAx

yx

yx

• To solve:

( )( )

1

1 1

1 1

1

1

Multply both sides by :A

A Ax A b

A A x A b

Ix A b

x A b

− −

− −

=

=

==

Remember: multiplying a matrix by I has same effect as multiplying a scalar by 1

=

=

=

5

11 , ,

12

34

where

bxAy

x

Note: Cannot divide a matrix by a matrix – instead multiply by inverse

Page 24: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Solving Systems of Equations

• Example:

– Express the following systems in matrix form and solve for the unknown terms:

a)

b)1 2

1 2

4 13

2 5 7

P P

P P

− + = −− = −

52

1134

=+=+

yx

yx

Page 25: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Application: National Income Determination

Y C

FIRM S

Expenditure: Income: Payments

In jections: Investment

In jections: Investment

Government Expenditure Y = C+I*

Y C

C

HOUSEHOLDS

Expenditure: Consumption of

domestically produced goods

Income: Payments for factors of production

W ithdrawals: Savings

W ithdrawals : Savings Taxation

C=a+bY

Y = C+S

Page 26: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Application: National Income Determination

• Examples:

The equilibrium levels of income Y and consumption C for a simple two sector macroeconomic model satisfy the structural equations:

Y=C+I*Y=C+I*

C = a+bY

Where I* is planned investment.

Write this system in matrix notation and solve for the equilibrium level of income and consumption.

Page 27: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Application: National Income Determination

• Examples:

The equilibrium levels of income Y and consumption for a simple two sector macroeconomic model satisfy the structural equations:

Y=C+I*Y=C+I*

C = 10+0.6Y

where planned investment is

I* = 12

Write this system in matrix notation and solve for the equilibrium level of income and consumption.

Page 28: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Cofactors of a matrix

• Each element of a matrix has a corresponding cofactor

• For a 3x3 matrix A the cofactor Aij is the determinant of

the 2x2 matrix found by deleting the ith row and the jth column of A and prefixing with a + or – according to the

following pattern

+ − + + − + − + − + − +

Page 29: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Cofactors of a matrix

• Example: the cofactor A is found by

11 12 13

21 22 23

31 32 33

a a a

A a a a

a a a

=

+ − + − + − + − +

• Example: the cofactor A23 is found by

1. Deleting the 2nd row and third column

2. Finding the determinant of the resulting matrix

11 12

31 32

a a

a a

3. Prefixing with a + or - accordingly

( )11 1223 11 32 12 31 11 32 12 31

31 32

a aa a a a a a a a

a a= − = − − = − +A

Page 30: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Cofactors of a matrix

• Example

Find all cofactors of the matrix:

−=

325011203

A

Page 31: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Determinant of a 3x3 matrix

• To find the determinant of a 3x3 matrix we multiply the elements of any one row of the matrix by the corresponding cofactors and add them up

• It does not matter which row you use.

11 12 13a a a

A a a a

= 21 22 23

31 32 33

A a a a

a a a

=

( )

( )

( ) 333332323131

232322222121

131312121111

det

det

det

AaAaAa

or

AaAaAa

or

AaAaAa

++=

++=

++=

A

A

A

Page 32: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Determinant of a 3x3 matrix

• Example

Find the determinant of the matrix:

−=

325011203

A

Page 33: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Inverse of a 3x3 matrix

• The inverse of the matrix

11 12 13

21 22 23

31 32 33

a a a

A a a a

a a a

=

Is given by: Is given by:

11 21 311

12 22 32

13 23 33

1A A A

A A A

A A A

=

AA

Page 34: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Inverse of a 3x3 matrix

• Need to first compute the adjugate matrix (matrix of cofactors)

11 12 13

21 22 23

31 32 33

A A A

A A A

A A A

Then the adjoint matrix (transpose of matrix of cofactors):

11 21 31

12 22 32

13 23 33

A A A

A A A

A A A

Pre-multiply by:

A1

Page 35: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Inverse of a 3x3 matrix

• Example

Find the inverse of the matrix:

−=

325011203

A

Page 36: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Using matrices to solve systems of equations

• Given the system of equations:

3333231

2232221

1131211

bzayaxa

bzayaxa

bzayaxa

=++=++=++

Write as:

bAx =

=

333231

232221

131211

aaaaaaaaa

A

=

zyx

x

=

3

2

1

bbb

b

bAx 1−=

Page 37: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Using matrices to solve systems of equations

• Example

Use matrices to solve the following system of equations:

3233 =++ PPP

3543

3734

3233

321

321

321

=++=++=++

PPP

PPP

PPP

Page 38: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Cramer’s Rule

• When solving any nxn system Ax=b the ith variable can be found using

Where Ai is the nxnmatrix found by replacing the ith

( )( )AA

det

det iix =

Where Ai is the nxnmatrix found by replacing the ithcolumn of A by the right hand-side vector b

• Example: Given the system of equations

Find the value of x2

−=

126

5427

2

1xx

Page 39: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Cramer’s Rule

−=

126

5427

2

1xx

( )( )AA

det

det 22 =x

= 54

27A

−= 124

672A

( ) ( )( ) ( ) 4

27

108

835

2484

4257

641272 ==

−+=

−−−=x

Page 40: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Cramer’s Rule

• Example

Use Cramer’s Rule to solve the following

system of equations for x2

9423

452

834

321

321

321

=++=++−

=++

xxx

xxx

xxx

Page 41: Topic 4: Matrices - Carol Newman€¦ · • Each element of a matrix has a corresponding cofactor • For a 3x3 matrix A the cofactor Aij is the determinant of the 2x2 matrix found

Application: National Income Determination

Example:In a closed economy the consumption function is given by

C = 70+0.9Yd

and planned investment is

I* = 35

the government spends 20 on goods and services but charges levies a lump sum tax of 25 and a proportional tax of 20%.

Write this system of equations in matrix notation and use Cramer’s Rule to solve for the equilibrium level of income?