m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m...

54
Ch 06 matrices v29 Page 1 of 54 www.utstat.utoronto.ca/sharp Data Projector Frameworks: MATA33 W11 Sharp (partly stolen from Haeussler et al 13e Ch 6) Matrix ‘size’ A matrix consisting of m horizontal rows and n vertical columns is called an m×n matrix or a matrix of size m×n. For the entry a ij , we call i the row subscript and j the column subscript. mn m m n n a a a a a a a a a ... . ... . . . ... . . . ... . . ... ... 2 1 2 12 21 1 12 11

Transcript of m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m...

Page 1: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 1 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Data Projector Frameworks: MATA33 W11 Sharp

(partly stolen from Haeussler et al 13e Ch 6)

Matrix ‘size’

• A matrix consisting of m horizontal rows and n vertical columns is called an m×n matrix or a matrix of size m×n.

• For the entry aij, we call i the row subscript

and j the column subscript.

mnmm

n

n

aaa

aaa

aaa

...

......

......

......

...

...

21

21221

11211

Page 2: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

A

b

c

d

h

Ch 06 matrices v

A. Th

. The

. The

d. Mat

as siz

v29

he mat

matr

matr

trix

ze 3 x

S

trix

rix

rix [7]

x 5

   Page 2 o

Size of

] ha

of 54                         

f a Ma

ha

h

as size

                                

atrix

as size

as siz

e 1 x

                            w

e 1 x

ze 3 x

x 1.

www.utstat.utoron

3 .

x 2.

to.ca/sharp 

Page 3: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 3 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Equality

Matrices A = [aij

] and B = [bij] are equal if

they have the same size and aij

= bij for each i

and j.

Page 4: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 4 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Transpose of a Matrix

A transpose matrix is denoted by AT

Roughly, rotate it around its diagonal if it had one. Note that (AT)T = A

654

321A

63

52

41TA

Page 5: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

MSuco

Ex

(a)

(b

no

Ch 06 matrices v

Matrixum A orrespo

xampl

)

b)

3

1

ot much

63

52

41

v29

x Add+ B iondin

le 1

4

2

h sens

3

6

7

6

5

4

ditions the mg entr

1

2

se: mat

0

46

2

   Page 5 o

n

m × nries of

= ? B

trices n

33

62

71

of 54                         

matrif A an

ut (b)

not sam

06

45

24

                                

ix obtand B

is not

me siz

6

4

8

                            w

ained

define

ze.

6

9

2

www.utstat.utoron

by ad

ed, ma

to.ca/sharp 

dding

akes

Page 6: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 6 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Properties of Scalar Multiplication:

k(A+B) =kA + kB

(k+l)A=kA+lA k(lA)=(kl)A

0A=0 k0=0 (A+B)T = AT +BT

(kA)T= k AT

Page 7: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 7 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Matrix Subtraction:

(a)

(b)

13

08

84

3203

1144

2662

30

14

26

23

14

62

52

80

42

66

10

262BAT

Page 8: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 8 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Matrix of 'size'  2 by 4 3 2 5 6

4 3 7 1

Matrix of 'size'  2 by 3 3 2 6

4 3 1

Maybe this 2 by 3 matrix indicates games of soccer and of chess played by 

Rob,  Sal and Ted last week:

Rob Sal Ted

Soccer 3 2 6

Chess 4 3 1

Call the matrix A. If they play the same number of games 4 weeks in a row, 

then total for the short month is:

12 8 24

16 12 4

We have multiplied the matrix A by the scalar 4 in the obvous way.  Note 4A=A4 (commutative

Let's do a matrix addition of a fifth week's data, B, also in the obvious way:

2 2 3 12 8 24

3 1 3 16 12 4

14 10 27

19 13 7

 Working element by element, since x+y=y+x for scalars, then matrix addition is commutative:

Also, since( x +y)+z=x+ (y+z) for scalars, then matrix addition also is associative

)

( )

( )

( )

+

=A

(

)

( )

( )

B+A=  A+B

(A+B)+C= A+(B+C)

4A=

B+4A= 

=  (

Page 9: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

M

Siz

A

B

AB C D CD

ijc

Ch 06 matrices v

Matrix

• AB

give

zes an

= 3 ×

= 5 ×

B = 3

= 3 ×= 7 ×D = u

n

kj

v29

Multi

is the

en by

nd pro

5 ma

3 ma

× 3 m

× 5 ma× 3 mandefin

n

ikba1

plicat

e m× p

oducts

atrix

atrix

matrix

atrix

atrix

ned bu

kj ab

   Page 9 o

ion

p mat

:

but B

ut DC

ji ba 11

of 54                         

trix C

BA = 5

C = 7 ×

i ba 2

                                

C who

5 × 5 m

× 5 ma

jb 2

                            w

ose en

matrix

atrix.

a...

www.utstat.utoron

ntry cij

x.

njinba

to.ca/sharp 

ij is

Page 10: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 10 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Matrix by matrix multiplication examples

2 3 3 2 5 6 18 13 31 15

0 1 4 3 7 1 4 3 7 1

2*6+3*1=15

2 2 ‐2 3 3 2 5 2 13 0 36 11

0 1 ‐3 1 4 3 7 4 ‐1 2 18 ‐1

2 ‐1 ‐3 2

1 ‐4 2 1

5 0 0 0 ‐1 0.2 0.0 0.0 0.0

0 2 0 0 = 0.0 0.5 0.0 0.0

0 0 ‐1 0 0.0 0.0 ‐1.0 0.0

0 0 0 1 0.0 0.0 0.0 1.0)

( )( )

( ) (

( )* =

( )) )( (* =

Page 11: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 11 of 54                                                                                    www.utstat.utoronto.ca/sharp 

More matrix products

a)

b)

c)

d)

32

6

5

4

321

183

122

61

61

3

2

1

1047

0110

11316

212

315

201

401

122

031

2222122121221121

2212121121121111

2221

1211

2221

1211

babababa

babababa

bb

bb

aa

aa

Page 12: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 12 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Example: Cost Vector

Given the price and the quantities, calculate the total cost.

Solution:

The cost vector is

432P

C of units

B of units

A of units

11

5

7

Q

73

11

5

7

432

PQ

Page 13: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 13 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Example: Matrix Mult is Associative

compute ABC in two ways

Associative: A(BC)=(AB)C

11

20

01

211

103

43

21CBA

1318

94

43

12

43

21

11

20

01

211

103

43

21BCA

1318

94

11

20

01

5413

521

11

20

01

211

103

43

21CAB

Page 14: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 14 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Example: Raw materials and cost:

Quantities of each of 3 house types:

Use by each type of 5 raw materials:

Price of products:

Materials cost for 1 copy:

Materials cost for the quantities produced:

1275Q

1500

150

800

1200

2500

C

71650

81550

75850

1500

150

800

1200

2500

1358256

21912187

17716205

RC

900,809,1

71650

81550

75850

1275

RCQQRC

1358256

21912187

17716205

R

Page 15: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 15 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Examples using I and 0 matrices:

00

00

10

01

41

23

103

101

51

52

OIBA

31

22

41

23

10

01 a.

AI

63

63

20

02

41

233

10

012

41

23323 b. IA

OAO

00

00

41

23 c.

IAB

10

01

41

23 d.

103

101

51

52

Page 16: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 16 of 54                                                                                    www.utstat.utoronto.ca/sharp 

7

4

38

52

2

1

x

x

BAX

Matrix form of linear equations:

Can be written:

738

452

21

21

xx

xx

Page 17: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

1. 2. 3.

a

Ch 06 matrices v2

InteMulAdd

a diff

29

E

erchanltiplyiding aferent

Elemen

nging ing a

a multrow o

   Page 17 o

ntary

two rrow btiple oof tha

of 54                       

row o

rows by a nof oneat mat

                                

operat

of a mnonzee rowtrix

                             w

tions:

matrixero nu

w of a

www.utstat.utoron

x umbermatri

nto.ca/sharp 

r ix to

Page 18: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 18 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Properties of a reduced matrix

• All zero-rows at the bottom. • For each nonzero-row, leading entry is 1 and

the rest in that column are zeros. • Leading entry in each row is to the right of the

leading entry in any row above it.

Page 19: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 19 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Reduced matrices: Not red (3 sb 1) Reduced Not reduced

Reduced Not reduced Reduced

0000

2100

3010

f.

010

000

001

e. 000

000d.

01

10c.

010

001b.

30

01 a.

Page 20: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 20 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Evil Nerd 1: he likes to make things complex

He knows that x=3 y=5 but he likes to baffle classmates so instead he says: x =3 2x +y =11 or even better 3x + y = 14 4x+2y=22

Classmates say ‘go away to Evil Nerd’ and disentangle it:

3 1 | 144 2 | 22 (start, now R2 /2 to give:)

Typeequationhere.

3 1 | 142 1 | 11 (now R1 – R2 to give:)

Page 21: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 21 of 54                                                                                    www.utstat.utoronto.ca/sharp 

1 0 | 32 1 | 11 (now R2 – 2R1 to give)

1 0 | 30 1 | 5 (hence x=3, y=5, ha ha nerd)

Page 22: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

So

Exlinpreeqrowdia

Ch 06 matrices v2

olving

xpress ne. Canettier f

quationws, muagonal

29

system

this asn thinkform (ns. So ultiplyl.

ms of

s an ‘ak of thOK, lefeel fr

y rows

   Page 22 o

equat

2x-x+

augmene augmess uglree to s

in an

of 54                       

ions b

-7y=50+3y=10

nted mmentedly formswap reffort

                                

by red

0 0

matrix’d matrm) of trows, sto get

                             w

ucing

’ with rix as jthe linsubtract ones

www.utstat.utoron

matri

a vertiust a ear ct rowalong

nto.ca/sharp 

ices

ical

ws, add the

Page 23: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v229

   Page 23 o

Redx-34x

of 54                       

ductio3y=-11+3y=9

                                

on 1 9

                             wwww.utstat.utoronnto.ca/sharp 

Page 24: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

(c

Ch 06 matrices v2

an see

29

e there

’s a pr

   Page 24 o

Red3x

12x

roblem

of 54                       

ductiox+y=4x+4y=

m: mult

                                

on

=2

tiply fi

                             w

first eq

www.utstat.utoron

quation

nto.ca/sharp 

n by 4))

Page 25: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 25 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Evil Nerd 2 x=3 y=2 z=4 Above is what he knows, but he makes it complex: x+2y=7 (adding 2*(y=2)) y=2 z=4 x+2y+z=11 (adding (z=4)) x+3y+0z=9 x+3y+z=13 x+2y+z=1 2x+5y+z=20 x+3y+z=13

Page 26: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 26 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Decode Evil Nerd

1 2 1 112 5 1 201 3 1 13

R1 swap R22 5 1 201 2 1 111 3 1 13

R1-R21 3 0 91 2 1 111 3 1 13

R2-R11 3 0 90 -1 1 21 3 1 13

R2*(-1)1 3 0 90 1 -1 -21 3 1 13

R3-R11 3 0 90 1 -1 -20 0 1 4

R2+R31 3 0 90 1 0 20 0 1 4

R1-3R21 0 0 30 1 0 20 0 1 4

x=3, y=1, z=4: Nerd foiled

Page 27: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 27 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Section 6.4, Example 3 Matrix Reduction

Example 3

2 3 -12 1 51 1 1

R1-3*R3-1 0 -42 1 51 1 1

(-1)*R11 0 42 1 51 1 1

R2-2*R11 0 40 1 -31 1 1

R3-R1-R21 0 40 1 -30 0 0

x=4y=-3

1

52

132

yx

yx

yx

Page 28: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 28 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Section 6.4, Example 5 Parametric Form of Solution

1 3/2 1 3 50 1 2 1 20 -9/2 -6 -3 -6

-(3/2)R2+R11 0 -2 3/2 20 1 2 1 20 -9/2 -6 -3 -6

(9/2)R2+R31 0 -2 3/2 20 1 2 1 20 0 3 3/2 3

R3/31 0 -2 3/2 20 1 2 1 20 0 1 1/2 1

-2R3+R21 0 -2 3/2 20 1 0 0 00 0 1 1/2 1

2R3+R11 0 0 5/2 40 1 0 0 00 0 1 1/2 1

9633

22

06232

431

432

4321

xxx

xxx

xxxx

Page 29: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 29 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Section 6.4, Example 5 Parametric Form (Cont)

Where x4 (or r= x4 looks neater) is any real value x1 = 4 – (5/2) r x2 = 0 x3 = 1 – (1/2) r x4 = 0 + r and let r vary.

x1 4 -5/2

x2 = 0 +r 0

x3 1 -1/2

x4 0 1

This is a line in 4-space, going through (4,0,1,0)T

421

3

2

425

1

1

0

4

xx

x

xx

Page 30: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 30 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Two Parameter Families of Solutions (Ch 6.5)

These are found when e.g. we use matrix reduction and end up with two free variables, and can express the other variables in terms of them. It makes more sense with an example:

Page 31: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 31 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Probs06.05Q06: Solve the set: w + x+ y +2z =4 2w+ x +2y +2z =7 w+ 2x+ y+ 4z = 5 3w -2x + 3y -4z = 7 4w- 3x + 4y -6z = 9

1 1 1 2 4

2 1 2 2 7

1 2 1 4 5

3 ‐2 3 ‐4 7

4 ‐3 4 ‐6 9

1 1 1 2 4

0 ‐1 0 ‐2 ‐1

0 1 0 2 1

0 ‐5 0 ‐10 ‐5

0 ‐7 0 ‐14 ‐7

1 1 1 2 4

0 1 0 2 1

0 1 0 2 1

0 ‐5 0 ‐10 ‐5

0 ‐7 0 ‐14 ‐7

1 0 1 0 3

0 1 0 2 1

0 0 0 0 0

0 0 0 0 0

0 0 0 0 0

Last matrix above is the unique reduced form

Page 32: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 32 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Probs06.05Q06 (cont)

The rows of zeros mean that y, z can be regarded as taking all real values-it is traditional to say y=r, z=s: w=-r+3 x=-2s +1 y=r z=s

w 3 -1 0

x = 1 +r 0 +s -2y 0 1 0z 0 0 1

Letting r and s vary, this is a plane in 4-space.

Page 33: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 33 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Homogeneous Systems

Is called homogeneous if c1 =c2 =….=cm =0 (all the c=0). Reduce it, say that k non-zero rows survive.

If homogeneous then If k<n there’s infinite solutions If k=n there’s a unique solution Unique but trivial: xi =0 for all i

o Example of trivial: x+y=0 3x+y=0 has unique trivial solution x=0, y=0

o Example of infinite: x+y=0 3x+3y=0 has infinite solutions: line y=-x/3

mnmnmm

nn

cxaxaxa

cxaxaxa

...

.

.

.

.

...

2211

11212111

Page 34: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 34 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Homogenous: Infinite Solutions or all-zero solution? Probs06.05Q20: Solve the homogeneous set: 2x+ y +z =0 x -y +2z =0 x+ y+ z = 0

Page 35: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 35 of 54                                                                                    www.utstat.utoronto.ca/sharp 

2 1 1 0

1 ‐1 2 0

1 1 1 0

Drop last column: all zeros

2 1 1

1 ‐1 2

1 1 1

1 0 0

1 ‐1 21 1 1

1 0 0

0 ‐1 2

0 1 1

1 0 0

0 1 ‐2

0 1 1

1 0 0

0 1 ‐2

0 0 3

1 0 0

0 1 ‐2

0 0 1

1 0 0

0 1 0

0 0 1 Last matrix above is the unique reduced form. k=n=3.It gives us x=0, y=0, z=0: the unique trivial solution.

Page 36: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 36 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Homogenous: Infinite Solutions or all-zero solution? Probs06.05Q20 changed a bit: Solve the homogeneous set: 2x+ y +z =0 x -y +2z =0 x + z= 0 (was x+ y+ z = 0 previously) You can maybe see that adding the first and second equations gives the third (time 3). That is, the third equation gives no more info, so we have two equations, three unknowns. But let’s check by reducing it:

Page 37: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 37 of 54                                                                                    www.utstat.utoronto.ca/sharp 

2 1 1 0

1 ‐1 2 0

1 0 1 0

Drop last column: all zeros

2 1 1

1 ‐1 2

1 0 1

1 1 0

1 ‐1 21 0 1

1 1 0

0 ‐1 1

1 0 1

1 0 1

0 1 ‐1

1 0 1

1 0 1

0 1 ‐1

0 0 0

1 0 1

0 1 ‐1

0 0 0

Last matrix above is the unique reduced form. k=2, n=3. Setting r=z x=-r y=r z=r

Page 38: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 38 of 54                                                                                    www.utstat.utoronto.ca/sharp 

(6.6) Matrix Inverse to solve equation

Say we have a system of equations Ax = B

Here’ some logic:

Matrix inverse A-1 exists =>

A-1 exists such that A-1 A =I =>

x=A-1 B , a unique solution But we already know that in trying to solve for x, there might be 0, 1 or an infinite number of solutions. So the logic above says that a matrix inverse can only exist if there is just 1 solution. It turns out that this can only happen if A is a square matrix.

Page 39: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 39 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Matrices A has an inverse?

So only square matrices can have inverses, and not all of them do. But if a square matrix A does have an inverse A-1 then:

A-1 also is square A-1 is unique A-1 is the same size as A A-1 commutes with A: A-1 A = I = AA-1

Page 40: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 40 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Example 1: Inverse of Matrix

So C is the inverse of A, A is ‘invertible’.

Which was expected since a matrix commutes with its inverse. AC=CA=I

73

21A

13

27C

ICA

10

01

73

21

13

27

IAC

10

01

13

27

73

21

Page 41: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 41 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Finding Inverse by Reduction

[A|I] => => => [R|B]

Where R is the reduced form of A

If R=I, then A is invertible and A-1 =B (we did it‼) If R≠I, then A is not invertible (no-one can do it!)

Example 3: Inversion by Reduction

Can we invert A? Can we reverse the changes that Evil Nerd made? Turns out we can:

So we have

22

01A

10

01

22

01IA

12

01

20

01

2/11

01

10

01

2/11

011A

Page 42: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 42 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Example 5 – Use Inverse to Solve a System

1 0 ‐2 1 0 0

4 ‐2 1 0 1 0

1 2 ‐10 0 0 1

1 0 ‐2 1 0 0

0 ‐2 9 ‐4 1 0

0 2 ‐8 ‐1 0 1

1 0 ‐2 1 0 0

0 ‐2 9 ‐4 1 0

0 0 1 ‐5 1 1

1 0 0 ‐9 2 2

0 ‐2 9 ‐4 1 0

0 0 1 ‐5 1 1

1 0 0 ‐9 2 2

0 ‐2 0 41 ‐8 ‐9

0 0 1 ‐5 1 1

1 0 0 ‐9 2 2

0 1 0 ‐20.5 4 4.5

0 0 1 ‐5 1 1

1 3

1 2 3

1 2 3

2 1

4 2 2

2 10 1

x x

x x x

x x x

1021

124

201

A

Page 43: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 43 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Example 5 –Use Inverse to Solve a System(cont)

X=A-1 B

115

4

229

29

2411A

4

17

7

1

2

1

115

4

229

29

241

3

2

1

x

x

x

Page 44: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 44 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Two easy inverses:

10 1

10 1

c

b

a

D

00

00

00

c

b

a

D

/100

0/10

00/11

Page 45: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 45 of 54                                                                                    www.utstat.utoronto.ca/sharp 

Remember about matrices

A is symmetric if AT = A o needs A T ij = Aij i,j o hence needs Akl = Alk k, l.

Homogeneous systems Ax = 0,

n unknowns m equations k=number of nonzero rows in reduced coeff. mat If kn: (always true if m n)

o Infinity solutions, including trivial xi =0 i If k=n: one unique solution, the trivial xi =0 i

Matrix Inverse

A-1 is unique if it exists at all A-1 commutes with A: that is A-1 A= I= A A-1 If A-1 and B-1 exist, then (AB)-1 = B-1 A-1 If A-1 exists then (AT)-1 = (A-1) T

Page 46: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v2

(d) S

Com-9 = 5k2 =

29

MA

Solutio

mmute i6-3k2

= 25

ATA3

on

if ,,,,, k = k = ±

   Page 46 o

33 Fin

6

= ±√5, ±√5

of 54                       

al Sum

23 59

233

and

                                

mmer

5

1

                             w

2009

1015

1515

www.utstat.utoron

Q3

nto.ca/sharp 

Page 47: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 47 of 54                                                                                    www.utstat.utoronto.ca/sharp 

MATA33 Final Summer 2009 LAQ3a Let k be an arbitrary real constant and let x and y be variables. Find all solutions to the system [6 points] kx + 2y = x x - ky = y

Solution (k-1) x + 2y =0 x -(k+1)y=0 Fast: Can e.g. substitute second equation in first and get (k-1)(k+1)y + 2y=0=(k2+1)y, hence y=0, x=0 Slow: Reduce:

1 21 1

1 11 2

1 10 2 1 1

1 10 1

1 00 1

So only the trivial solution x=0, y=0 for all k Hence homogeneous, with trivial solution x=0, y=0

Page 48: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 48 of 54                                                                                    www.utstat.utoronto.ca/sharp 

MATA33 Final Summer 2009 LAQ3b

What equation must real constants a, b, and c satisfy in order that the system of linear equations x + 3y + z = a 2x - y - z = b 4x + 5y + z = c has infinitely many solutions ? [6 points] Solution Can only have infinitely many solutions if number of non-zero rows in reduced matrix, k <3=n, number of variables.

1 3 12 1 14 5 1

1 3 10 7 30 7 3

2 4

So if the second and third row are the same, we have two equations in three unknowns, infinite solutions, which needs: b-2a=c-4a or 2a +b-c=0

Page 49: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v2

(a) S0 = A

Coul

so B

rules (c) n

29

M

SolutioA3 – AB

ld hav

2 =0, A

s out b

need no

MATA

on B2 = A

e A=

AB=10

both (b)

ot be tr

   Page 49 o

A33 W

A(A2 –

0 10 01 00 0b) and

rue: co

of 54                       

Winter

B2) =

so

BA

(d) as

ould h

                                

2008 F

A(A2

o A2 =0

A=00

being

have A=

                             w

Final

-B2)

0, B=

01

g not re

=0

www.utstat.utoron

Q3

0 01 0

, whic

equire

nto.ca/sharp 

ch

ed

Page 50: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v2

(b) n

29

M

n>m≥k

MATA

k so w

   Page 50 o

A33 W

we hav

of 54                       

Winter

ve infin

                                

2008 F

nitely m

                             w

Final

many

www.utstat.utoron

Q6

solutio

nto.ca/sharp 

ons

Page 51: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v2

(D11

(D22

Othe

29

) 2 =3

) 2 =4

er entri

MAT

=>

=>

ies all

   Page 51 o

TA33 S

D11 =

D22 =

zero:

of 54                       

Summ

= ±√3

= ±2

4 solu

                                

mer 09

utions.

                             w

Test

www.utstat.utoron

1

nto.ca/sharp 

Page 52: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v2

(c) S(i) Tredu

(ii) F

(iii) (iv) F

29

SolutioTrue: e.uction r

False:

True: False,

MAT

on: .g tworoute

e.g. A

n>m ≥e.g. Z

   Page 52 o

TA33 S

matri

=00

≥ k so Z=3, co

of 54                       

Summ

ces at

10

,

infinitonstant

                                

mer 09

differe

, B=00

tely mt

                             w

Test

ent sta

0 20 0any so

www.utstat.utoron

1

ages on

so A

olution

nto.ca/sharp 

n the

AB =0

ns

0

Page 53: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v2

29

MAT

   Page 53 o

TA33 S

of 54                       

Summ

                                

mer 09

                             w

Test

www.utstat.utoron

1

nto.ca/sharp 

Page 54: m horizontal rows and n vertical columns is called an m n ... ongoing... · d pro 5 ma 3 ma × 3 m 5 ma 3 ma ndefin aikb 1 plicat m× p ducts trix trix atrix ... 5000‐1 0.2 0.0

Ch 06 matrices v29    Page 54 of 54                                                                                    www.utstat.utoronto.ca/sharp 

MATA33 Final Summer 2009 LAQ8

In all of this question let P be an arbitrary n × n matrix where n ≥ 2. (a) Assume P is invertible and prove mathematically that the matrix equation PX = Q has a solution for every n × 1 matrix Q. [3 points] Solution: P invertible => P-1 exists => P-1PX= P-1 Q => X= P-1 Q (b) Assume the matrix equation PX = B has a solution for each n×1 matrix B and prove mathematically that P is invertible. (Note: parts (a) and (b) are independent of each other (they are not related.)) [6 points] Let Mi be the n×1 matrix with all zeros except a 1 in row i. Let Si be the n×1 matrix which solves PX = Mi, so P Si= Mi

Let Q be the n×n matrix with columns the Si

Solution: Q= (S1, S2, …..... Sn) PQ = P(S1, S2, …..... Sn) = (M1, M2, ……..Mn) = I Hence Q is an inverse to P and P is invertible.