MATH 20: PROBABILITY

30
MATH 20: PROBABILITY Markov Chain Xingru Chen [email protected] XC 2020

Transcript of MATH 20: PROBABILITY

Page 1: MATH 20: PROBABILITY

MATH 20: PROBABILITY

Markov ChainXingru Chen

[email protected]

XC 2020

Page 2: MATH 20: PROBABILITY

Random Walk

1

2

3

4

5

…

A random walk is a mathematical object, known as a stochastic or random process, that describes a path that consists of a succession of random steps on some mathematical space such as the integers.

XC 2020

Page 3: MATH 20: PROBABILITY

Markov Chain

1

2

3

4

5

XC 2020

Page 4: MATH 20: PROBABILITY

Specifying a Markov Chain

Β§ We describe a Markov chain as follows: We have a set of states, 𝑆 = 𝑠!, 𝑠", β‹― , 𝑠# .

Β§ The process starts in one of these states and moves successively from one state to another. Each move is called a step. 𝑠!

𝑠"

𝑠#

𝑠$

𝑠%

XC 2020

Page 5: MATH 20: PROBABILITY

Β§ If the chain is currently in state 𝑠!, then it moves to state 𝑠" at the next step with a probability denoted by 𝑝!" .

Β§ The probability 𝑝!" does not depend upon which states the chain was in before the current state.

Β§ These probabilities are called transition probabilities.

𝑠!

𝑠"

𝑠#

𝑠$

𝑠%

𝑝!"𝑝$"

𝑝%&

𝑝&" 𝑝"&

XC 2020

Page 6: MATH 20: PROBABILITY

Β§ The process can remain in the state it is in, and this occurs with probability 𝑝!! .

𝑠!

𝑠"

𝑠#

𝑠$

𝑠%

𝑝!!

𝑝%%

XC 2020

Page 7: MATH 20: PROBABILITY

Β§ An initial probability distribution, defined on 𝑆, specifies the starting state. Usually this is done by specifying a particular state as the starting state.

𝑒!

𝑠#

𝑒"

𝑠$

𝑒#

𝑠%

𝑒$

𝑠&

𝑒%

𝑠'

𝑒= 𝑒# 𝑒$ 𝑒% 𝑒& 𝑒'

0 1 0 0 0

(!(#

)

𝑒! = 1

XC 2020

Page 8: MATH 20: PROBABILITY

THE LAND OF OZ

Β§ the Land of Oz is blessed by many things, but not by good weather.

Β§ They never have two nice days in a row. If they have a nice day, they are just as likely to have snow as rain the next day.

Β§ If they have snow or rain, they have an even chance of having the same the next day.

Β§ If there is change from snow or rain, only half of the time is this a change to a nice day.

XC 2020

Page 9: MATH 20: PROBABILITY

Β§ They never have two nice days in a row. If they have a nice day, they are just as likely to have snow as rain the next day.

12

12

XC 2020

Page 10: MATH 20: PROBABILITY

Β§ If they have snow or rain, they have an even chance of having the same the next day.

12

12

12

12

XC 2020

Page 11: MATH 20: PROBABILITY

Β§ If there is change from snow or rain, only half of the time is this a change to a nice day.

12

12

12

12

14

14

XC 2020

Page 12: MATH 20: PROBABILITY

Β§ If there is change from snow or rain, only half of the time is this a change to a nice day.

12

12

12

12

14

14

14

14

XC 2020

Page 13: MATH 20: PROBABILITY

12

12

12

12

14

14

14

14

Β§

β†—RNS

R N S

XC 2020

Page 14: MATH 20: PROBABILITY

12

12

12

12

14

14

14

14

Β§

β†—RNS

R N S)*

)+

)+

XC 2020

Page 15: MATH 20: PROBABILITY

12

12

12

12

14

14

14

14

Β§

β†—RNS

R N S)*

)+

)+

)* 0 )

*

XC 2020

Page 16: MATH 20: PROBABILITY

12

12

12

12

14

14

14

14

Β§

β†—RNS

R N S)*

)+

)+

)*

0 )*

)+

)+

)*

XC 2020

Page 17: MATH 20: PROBABILITY

12

12

12

12

14

14

14

14

Β§ States: Β§ 𝑠!: rainΒ§ 𝑠": niceΒ§ 𝑠&: snow

Β§ 𝑃 =

!"

!$

!$

!"

0 !"

!$

!$

!"

XC 2020

Page 18: MATH 20: PROBABILITY

Transition Matrix

Β§ The entries in the first row of the matrix 𝑃 in the example represent the probabilities for the various kinds of weather following a rainy day.

Β§ Similarly, the entries in the second and third rows represent the probabilities for the various kinds of weather following nice and snowy days, respectively.

Β§ Such a square array is called the matrix of transition probabilities, or the transition matrix.

𝑃 =

12

14

14

12

012

14

14

12

12

12

12

12

14

14

14

14

XC 2020

Page 19: MATH 20: PROBABILITY

𝑃 =

12

14

14

12

012

14

14

12

?the probability that, given the chain is in state 𝑖 today, it will be in state 𝑗 tomorrow

Β§ States: Β§ 𝑠!: rainΒ§ 𝑠": niceΒ§ 𝑠&: snow

12

12

12

12

14

14

14

14

XC 2020

Page 20: MATH 20: PROBABILITY

𝑃 =

12

14

14

12

012

14

14

12

?the probability that, given the chain is in

state 𝑖 today, it will be in state 𝑗tomorrow

Β§ States: Β§ 𝑠!: rainΒ§ 𝑠": niceΒ§ 𝑠&: snow

𝑝'((!) = 𝑝'(

?the probability that, given the chain is in state 𝑖 today, it will be in state 𝑗 the day

after tomorrow𝑝'((") = β‹―

12

12

12

12

14

14

14

14

XC 2020

Page 21: MATH 20: PROBABILITY

𝑃 =

12

14

14

12

012

14

14

12

Β§ States: Β§ 𝑠!: rainΒ§ 𝑠": niceΒ§ 𝑠&: snow

Day 0 Day 1 Day 2 …

? …

𝑝!&(") = β‹―

12

12

12

12

14

14

14

14

XC 2020

Page 22: MATH 20: PROBABILITY

12

12

12

12

14

14

14

14

𝑃 =

12

14

14

12

012

14

14

12

Β§ States: Β§ 𝑠#: rainΒ§ 𝑠$: niceΒ§ 𝑠%: snow

Day 0 Day 1 Day 2 …

…𝑝!&(")

= 𝑝!!𝑝!& + 𝑝!"𝑝"& + 𝑝!&𝑝&&

𝑝## 𝑝#%

𝑝#$ 𝑝$%

𝑝#% 𝑝%%

XC 2020

Page 23: MATH 20: PROBABILITY

𝑃 =𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

=

12

14

14

12

012

14

14

12

Β§ States: Β§ 𝑠#: rainΒ§ 𝑠$: niceΒ§ 𝑠%: snow

𝑝#%($) = 𝑝##𝑝#% + 𝑝#$𝑝$% + 𝑝#%𝑝%%

Day 0 Day 1 Day 2 …

…

𝑝!! 𝑝!#

𝑝!" 𝑝"#

𝑝!# 𝑝##

𝑝## 𝑝#$ 𝑝#% 𝑝#%𝑝$%𝑝%%

𝑃$ =𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

2𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

=𝑝#%($)

XC 2020

Page 24: MATH 20: PROBABILITY

𝑝#%($) = 𝑝##𝑝#% + 𝑝#$𝑝$% + 𝑝#%𝑝%%

= (,(#

%

𝑝#,𝑝,%

Day 0 Day 1 Day 2 …

…

𝑝!! 𝑝!#

𝑝!" 𝑝"#

𝑝!# 𝑝##

Day 0 Day 1 Day 2 …

…

𝑝!! 𝑝!#

𝑝!" 𝑝"#

𝑝!& 𝑝&#

…𝑝!β‹― 𝑝⋯#

𝑝#%($) = 𝑝##𝑝#% + 𝑝#$𝑝$% +β‹―+ 𝑝#-𝑝-%

= (,(#

-

𝑝#,𝑝,%

XC 2020

Page 25: MATH 20: PROBABILITY

Day 0 Day 1 Day 2 Day … Day n …

? β€¦οΌŸ …

Day 0 Day 1 Day 2 …

…

𝑝!! 𝑝!#

𝑝!" 𝑝"#

𝑝!# 𝑝##

𝑃$ =𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

2𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

=𝑝#%($)

𝑃) =𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

)

=𝑝#%())

XC 2020

Page 26: MATH 20: PROBABILITY

Transition Matrix

Β§ Let 𝑃 be the transition matrix of a Markov chain.

Β§ The 𝑖𝑗th entry 𝑝'( of the matrix 𝑃+ gives the probability that the Markov chain, starting in state 𝑠', will be in state 𝑠( after 𝑛 steps.

Day 0 Day 1 Day 2 Day … Day n …

? β€¦οΌŸ … 𝑃) =𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

)

=𝑝#%())

XC 2020

Page 27: MATH 20: PROBABILITY

Β§ Starting states: Β§ rain: 𝑒#Β§ nice: 𝑒$Β§ snow: 𝑒%

𝑒 = 𝑒! 𝑒" 𝑒&

Β§ Transition matrix:

𝑃 =𝑝!! 𝑝!" 𝑝!#𝑝"! 𝑝"" 𝑝"#𝑝#! 𝑝#" 𝑝##

=

12

14

14

12

012

14

14

12

𝑝!" 𝑝!#

𝑝##𝑝""

𝑝"! 𝑝#!

𝑝"#

𝑝#"

𝑒%(#) = 𝑒#𝑝#% + 𝑒$𝑝$% + 𝑒%𝑝%%

𝑒# 𝑒$ 𝑒%𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

𝑒(#) = 𝑒#(#) 𝑒$

(#) 𝑒%(#) = 𝑒𝑃

𝑝!#

𝑝"#

𝑝##

Day 0 Day 1 …

…

𝑒!

𝑒"

𝑒#

Β§ the probability that the chain is in state 𝑠( after 𝑛 steps:

Β§ π‘˜ = 3Β§ 𝑛 = 1

XC 2020

Page 28: MATH 20: PROBABILITY

𝑒,(#) = 𝑒#𝑝#, + 𝑒$𝑝$, + 𝑒%𝑝%,

𝑒(#) = 𝑒#(#) 𝑒$

(#) 𝑒%(#) = 𝑒𝑃

𝑝!#

𝑝"#

𝑝##

Day 0 Day 1 …

…

𝑒!

𝑒"

𝑒#

Β§ the probability that the chain is in state 𝑠( after 𝑛 steps:

Β§ 𝑛 = 1

𝑒%(#) = 𝑒#𝑝#% + 𝑒$𝑝$% + 𝑒%𝑝%%

Β§ the probability that the chain is in state 𝑠( after 𝑛 steps:

Β§ 𝑛 = 2

Day 0 Day 1 Day 2 …

𝑒!

…

𝑝!! 𝑝!#

𝑝!"𝑝"#

𝑝!#

𝑝##

𝑒"

𝑒#

𝑝!#(") = 𝑝!!𝑝!# + 𝑝!"𝑝"# + 𝑝!#𝑝## = .

(+!

#

𝑝!(𝑝(#

𝑒#(") = 𝑒!𝑝!#

(") + 𝑒"𝑝"#(") + 𝑒#𝑝##

(")

𝑒((") = 𝑒!𝑝!(

(") + 𝑒"𝑝"((") + 𝑒#𝑝#(

(")

𝑒(") = 𝑒!(") 𝑒"

(") 𝑒#(") = 𝑒𝑃"

XC 2020

Page 29: MATH 20: PROBABILITY

Transition Matrix

Β§ Let 𝑃 be the transition matrix of a Markov chain, and let 𝑒 be the probability vector which represents the starting distribution.

Β§ Then the probability that the chain is in state 𝑠, after 𝑛 steps is the π‘˜th entry in the vector

𝑒(+) = 𝑒𝑃+.

Day 0 Day 1 Day 2 Day … Day n …

? β€¦οΌŸ …

𝑒()) = 𝑒𝑃)

= 𝑒𝑝## 𝑝#$ 𝑝#%𝑝$# 𝑝$$ 𝑝$%𝑝%# 𝑝%$ 𝑝%%

)

= 𝑒#()) 𝑒$

()) 𝑒%())

𝑒!

𝑒"

𝑒#

XC 2020

Page 30: MATH 20: PROBABILITY

Open book

Scope: Mostly Chapters 7, 8, 9, 10, and 11

§ sum of random variables§ LLN and CLT§ generating functions§ Markov chains

Materials: slides, homework, quizzes, textbook

Date & Time: 12:00 pm – 10: 00 pm, August 30

Office hours: August 27, 28

Homework due: 11:00 pm August 28

August 2020Final

26 27 28 29 30 31 01

02 03 04 05 06 07 08

09 10 11 12 13 14 15

16 17 18 19 20 21 22

23 24 25 26 2827

30 0531 01 02 0403

29

Sun Mon Tue Wed Thu Fri Sat

XC 2020