Math 2

Post on 08-Nov-2014

59 views 10 download

Tags:

description

dsvdvsv

Transcript of Math 2

Bowen’s MathematicsChapter 1, 2

Systems of Linear Equations and Matrices

MATRIX: Definitions

2

Matrix: a rectangular array of numbers which we treat as a single (collective) object Demarcated within brackets, parentheses, or

double lines Denoted by bold capital letters Matrix has m rows and n columns

Definitions

3

Matrix: a rectangular array of numbers which we treat as a single (collective) object

Order of matrix = row X column Element of a matrix = element row column

Notation

4

Matrices are usually denoted using upper-case letters, while the corresponding lower-case letters, with two subscript indices, represent the entries. In addition to using upper-case letters to symbolize matrices, many authors use a special typographical style, commonly boldface upright (non-italic), to further distinguish matrices from other mathematical objects. An alternative notation involves the use of a double-underline with the variable name, with or without boldface style, e.g.,.

B

Definitions

5

=

333231

232221

131211

33

aaa

aaa

aaa

A X

MatrixShort notation

Order = 3x3

This is the 3,2 element, or element32

Types of Matrices

Square Matrix; Row Matrix; Column Matrix; Diagonal Matrix; Unit Matrix; Zero Matrix; Scalar Matrix; Sub Matrix; Symmetric Matrix

6

Definition

7

A square matrix is a matrix with the same number of rows and columns. An n-by-n matrix is known as a square matrix of order n. Any two square matrices of the same order can be added and multiplied. A square matrix A is called invertible or non-singular if there exists a matrix B such that

AB = In.

Definitions

8

Vector: a matrix containing a single row (row vector) or single column (column vector)

Square matrix: same # rows and columns

Definitions

9

Diagonal matrix: one or more non-zero values on main diagonal (top-left to bottom-right); all zeros on off-diagonal

800

050

001

Definitions

10

Scalar matrix: diagonal matrix with same non-zero values on entire main diagonal

500

050

005

Definitions

11

Unity or identity matrix is special case of scalar matrix where diagonal values = 1

100

010

001

Definitions

Symmetric Matrix: matrix remains unchanged when rows and columns are interchanged

511

162

125

12

Definitions

13

Equality: two matrices of same order and with all equal elements

Assume and

Then A = B implies that x=2 and y=3

=23

21A =

2

1

y

xB

Matrix Operations

14

In matrix algebra, an ordinary number is called a “scalar”.

In scalar multiplication, multiply all entries in matrix by the scalar.

The scalar often known as “scaling factor”

4872

12-36

46

1-312 =×

Addition and Subtraction

15

?127

264

354

234

?27

64

354

234

Some Laws of Matrix

16

Commutative LawA + B = B + A

Associative LawA + (B + C) = (A + B) + C

Identity LawA + O = AA – O = AO – A = -A

O is zero matrix. In a zero matrix all entries are 0s.

Matrix Multiplication

17

Scalar can be used to multiply a matrix of any dimension

Multiplication of two matrices is contingent upon the satisfaction of different dimensional requirementGiven two matrices A and B and we want to

find AB. The conformability condition for multiplication is that the column of A (lead matrix) must be equal to the row dimension of B (lag matrix)

The Rule of Multiplication

18

231213112212121121121111

232221

131211

1211

][

babababababaABC

bbb

bbbB

aaA

pm

CBA mqpqmn

+++==

=

=

=

Example

19

?39

25

04

82

31

=×== BABA

Laws

20

A commutative law for matrix multiplication does not hold.A • B ≠ B • A

An associative law for matrix multiplication does holdA • (B • C) = (A • B) • C = A • B • C

The product of any matrix and the zero matrix is zero matrixA • O = O • A = O

Identity Matrix

21

A • I = A and I • A = AThe role of identity (I) matrix is analogous to the role of

the number 1.

=++

++=×

50

12

)51()10()01()20(

)50()11()00()21(

50

12

10

01

xxxx

xxxx

Problem Set 2-4

22

63

52

41

110

010

001

.17

1-0

32

11

65

412-1-

2031

0112

.15

Problem 21

23

Interest at the rates 0.06, 0.07, and 0.08 is earned on respective investments of $3000, $2000 and $4000. Compute the total interest by matrix multiplication.

Problem 22

24

Two canned meat spreads, Regular and Superior, are made by grinding beef, pork and lamb together. The numbers of pounds of each meat in a 15-pound batch of each brand are in the following table.

Suppose we wish to make 10 batches of Superior and 20 of Regular. Multiply the meat matrix in the table and the batch vector ( 10 20) and interpret the result.

Suppose that the per pound prices of beef, pork, and lamb are $2.50, $2.00, and $3.00, respectively. Multiply the price vector and the meat matrix and interpret the results.

Brand Pounds of

Beef Pork Lamb

Superior 8 2 5

Regular 4 8 3

Basic Operations

25

Transposition of vector or matrix from A to A': a11 → a'11; a21 → a'12; a12 → a'21; etc. From A to A'

db

ca

dc

ba→

Transpose

Transpose: Swap rows with columns

=

ihg

fed

cba

M

26

=

ifc

heb

gda

M T

=

z

y

x

V [ ]zyxV T =

Basic Operations

27

Transposition of vector or matrix from A to A': a11 → a'11; a21 → a'12; a12 → a'21; etc. From A to A'

db

ca

dc

ba→

Transpose

Transpose: Swap rows with columns

=

ihg

fed

cba

M

28

=

ifc

heb

gda

M T

=

z

y

x

V [ ]zyxV T =

Transpose of a Matrix

29

A matrix obtained by interchanging rows and columns.

Inverse of a Matrix

30

IAA

aa

=

=

1-

1-

1-

-1

I.matrix identity theisproduct

their ifother each of inverses are matrices square Two

identity. theis a and a ofproduct the

because a of inverse tivemultiplica theis a

1)(

How to find Inverse of a Matrix?

31

Gauss-Jordan InversionThe Gauss-Jordan method finds A’. It

transforms the augmented matrix (A|I) into the augmented matrix (I|A’).

10

01

ba

yx

Example: Find Inverse

32

5-42

1-1-1

1-21

3

1

1-02

01-1

1-23

72-

3-1

12

37

1-

1-

==

==

AA

AA

Conditions of Inverse

33

It is a square matrixIt has independent rows and columnsDeterminant of the matrix is not zero

What is determinants?

34

A “useful number” associated with an n n matrix( ) [ ] ( )

1111 det , If 1 aAaA ==

( ) ( )21122211

2221

1211-det , If 2 aaaaA

aa

aaA ==

( )( )

( )jjjjjj

ininiiii

CaCaCaA

or

CaCaCaA

n

222211

2211

det

det

: 2For 3

+++=

+++=

>

35

( )( )

jjjjjj

ininiiii

CaCaCaA

CaCaCaA

222211

2211

det

det

+++=

+++=

Mij is the determinant obtained by deleting the ith row and jth column of A.

ijji

ij MC )1(

36

( ) ji+1-

++

++

++

++

--

--

--

--

++

+

++

-

--

-

The cofactor is the minor with a sign change considered

( )ij

jiij MC += 1-

Adjoint of a Square Matrix

37

Let A=[aij]nxn be a square matrix of order n, then adjoint of A is defined to be transpose of matrix [Aij]nxn, where Aij is co-factor of aij in |A|.

Example

38

41-3

132-

5-14

703

230

1-14

=

=

B

A

Inverse of a Matrix

Inverse of a square matrix is:

39

An n × n matrix is invertible if and only if

AdjAA

A11

0)det( A

Solution of Equation

40

1. Transform the equations in matrices Ax = d

2. A = coefficient matrix3. x = variable matrix4. d = RHS values5. Calculate the determinant of A …….|A|6. Calculate the cofactor matrix7. Calculate the Adj. A (Transpose of cofactor

matrix)8. Find the inverse of a matrix A-1= Adj A/|A|9. Solve x = A-1d

Example

41

• A manufacturer produces three products: P, Q and R which he sells in two markets. Annual sales volume are indicated as follows:

Market Product .

. P Q R .

I 10,000 2,000 18,000

II 6,000 20,000 8,000

. .

(i) If unit sale prices of P, Q, and R are Tk. 2.50, 1.25 and 1.50 respectively, find the total revenue in each market with the help of matrix algebra.

(ii)If the unit costs of the above 3 commodities are Tk. 1.80, 1.20 and 0.80 respectively, find the gross profit.

Basic Applications

42

Consider 2 equations, 2 unknowns:2x + 3y = 53x + 2y = 5

Now define the following column vectors:

Then the equations can be written asxa + yb = c

===5

5,

2

3,

3

2cba

Basic Applications

43

Why this works:Recall matrix (vector) addition rule

And matrix (vector) equality rule2x + 3y = 53x + 2y = 5

=+

+=+

5

5

)23(

)32(

2

3

3

2

yx

yx

y

y

x

x

Equation System to Matrix

44

4-3

92-4

6

=+

=+

=++

zyx

zyx

zyx

Inverse of a Matrix

Inverse of a square matrix is:

AadjA

A11 =

45

An n × n matrix is invertible if and only if

Solution of Equation

46

1dAx

dAx

=

=1. Transform the equations in

matrices Ax = d2. A = coefficient matrix3. x = variable matrix4. d = RHS values5. Calculate the determinant of

A …….|A|6. Calculate the cofactor matrix7. Calculate the Adj. A

(Transpose of cofactor matrix)

8. Find the inverse of a matrix A-1= Adj A/|A|

9. Solve x = A-1d

Example

47

114x-3

295x

63x-2

21

21

21

=

=+

=

x

x

x

Markov Process

48

• Markov Property: The state of the system at time t+1 depends only on the state of the system at time t

[ ] [ ] x | X x X x x X | X x X tttttttt ===== ++++ 111111 PrPr

• Stationary Assumption: Transition probabilities are independent of time (t)

49

Weather:

• raining today 40% rain tomorrow

60% no rain tomorrow

• not raining today 20% rain tomorrow

80% no rain tomorrow

Markov ProcessSimple Example

rain no rain

0.60.4 0.8

0.2

Stochastic FSM:

=8.02.0

6.04.0P

50

Weather:

• raining today 40% rain tomorrow

60% no rain tomorrow

• not raining today 20% rain tomorrow

80% no rain tomorrow

Markov ProcessSimple Example

• Stochastic matrix:Rows sum up to 1

• Double stochastic matrix:Rows and columns sum up to 1

The transition matrix:

51

– Gambler starts with $10

- At each play we have one of the following:

• Gambler wins $1 with probability p

• Gambler looses $1 with probability 1-p

– Game ends when gambler goes broke, or gains a fortune of $100

(Both 0 and 100 are absorbing states)

0 1 2 99 100

p p p p

1-p 1-p 1-p 1-pStart (10$)

Markov ProcessGambler’s Example

52

• Markov process - described by a stochastic FSM

• Markov chain - a random walk on this graph

(distribution over paths)

• We can ask more complex questions, like

Markov Process

[ ] ?Pr 2 ===+ b a | X X tt

0 1 2 99 100

p p p p

1-p 1-p 1-p 1-pStart (10$)

53

• Given that a person’s last cola purchase was Coke, there is a 90% chance that his next cola purchase will also be Coke.

• If a person’s last cola purchase was Pepsi, there is an 80% chance that his next cola purchase will also be Pepsi.

coke pepsi

0.10.9 0.8

0.2

Markov ProcessCoke vs. Pepsi Example

=8.02.0

1.09.0P

transition matrix:

54

Given that a person is currently a Pepsi purchaser, what is the probability that he will purchase Coke two purchases from now?

Pr[ Pepsi?Coke ] =

Pr[ PepsiCokeCoke ] + Pr[ Pepsi Pepsi Coke ] =

0.2 * 0.9 + 0.8 * 0.2 = 0.34

==66.034.0

17.083.0

8.02.0

1.09.0

8.02.0

1.09.02P

Markov ProcessCoke vs. Pepsi Example (cont)

Pepsi ? ? Coke

=8.02.0

1.09.0P

55

Given that a person is currently a Coke purchaser, what is the probability that he will purchase Pepsi three purchases from now?

Markov ProcessCoke vs. Pepsi Example (cont)

==562.0438.0

219.0781.0

66.034.0

17.083.0

8.02.0

1.09.03P

Markov ProcessCoke vs. Pepsi Example (cont)

56

=8.02.0

1.09.0P

•Assume each person makes one cola purchase per week

•Suppose 60% of all people now drink Coke, and 40% drink Pepsi

•What fraction of people will be drinking Coke three weeks from now?

=562.0438.0

219.0781.03P

Pr[X3=Coke] = 0.6 * 0.781 + 0.4 * 0.438 = 0.6438

Qi - the distribution in week i

Q0=(0.6,0.4) - initial distribution

Q3= Q0 * P3 =(0.6438,0.3562)

Markov ProcessCoke vs. Pepsi Example (cont)

57

Simulation:

week - i

Pr[X

i = C

oke]

2/3

[ ] [ ]31

32

31

32

8.02.0

1.09.0=

stationary distribution

coke pepsi

0.10.9 0.8

0.2

Steady State

58

A steady state vector is the state vector that remains unchanged by the transition matrix[v1 v2] X [T] = [v1 v2]

Example

59

1

4.06.0

2.08.0

21

21

=+

×

vv

vv

What is steady state matrix?

Example

60

Absorbing MarkovStationary Markov

4.6.

01