probability - courses.cs.washington.edu€¦ · probability 3.1 discrete random variables basics...

36
Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun

Upload: others

Post on 19-Oct-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Probability3.1 Discrete Random Variables Basics

Anna KarlinMost slides by Alex Tsun

Page 2: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Agenda● Intro to Discrete Random Variables● Probability Mass Functions● Cumulative Distribution function● Expectation

Page 3: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flipping two coins

Page 4: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Random Variable

Page 5: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

20 balls numbered 1..20● Draw a subset of 3 uniformly at random.● Let X = maximum of the numbers on the 3 balls.

Isupport91 111a 203

b 20

c 18

d F

Page 6: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Random Variable

Page 7: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Identify those RVs

a

bc

d

Which cont Whichhas Range 42,3a a

b bc 4d d

Page 8: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Random Picture

Page 9: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flipping two coins

Page 10: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flipping two coins

i

Page 11: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flipping two coins

Page 12: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Probability Mass Function (PMF)

Page 13: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Probability Mass Function (PMF)

Page 14: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

20 balls numbered 1..20● Draw a subset of 3 uniformly at random.● Let X = maximum of the numbers on the 3 balls.

Page 15: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Probability Mass Function (PMF)

Page 16: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

20 balls numbered 1..20● Draw a subset of 3 uniformly at random.● Let X = maximum of the numbers on the 3 balls.

● Pr (X = 20)

● Pr (X = 18)

a Kaka

b Ypgc Mad

ag

Page 17: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Cumulative distribution function(CDF)The cumulative distribution function (CDF) of a random variable specifies for each possible real number , the probability that , that is

FX(x)<latexit sha1_base64="sRHOyOvZfuCwr5D5z+nUz+WLjz4=">AAAB7nicbVDLSgNBEOz1GeMr6tHLYBDiJexGQY9BQTxGMA9IljA7mU2GzM4uM71iCPkILx4U8er3ePNvnCR70MSChqKqm+6uIJHCoOt+Oyura+sbm7mt/PbO7t5+4eCwYeJUM15nsYx1K6CGS6F4HQVK3ko0p1EgeTMY3kz95iPXRsTqAUcJ9yPaVyIUjKKVmrfdVunpjHQLRbfszkCWiZeRImSodQtfnV7M0ogrZJIa0/bcBP0x1SiY5JN8JzU8oWxI+7xtqaIRN/54du6EnFqlR8JY21JIZurviTGNjBlFge2MKA7MojcV//PaKYZX/lioJEWu2HxRmEqCMZn+TnpCc4ZyZAllWthbCRtQTRnahPI2BG/x5WXSqJS983Ll/qJYvc7iyMExnEAJPLiEKtxBDerAYAjP8ApvTuK8OO/Ox7x1xclmjuAPnM8f9lKOqg==</latexit>

x<latexit sha1_base64="hL+FaLtOT9luwfLW3Ut08xl3Pcw=">AAAB6HicbVDLTgJBEOzFF+IL9ehlIjHxRHbRRI9ELx4hkUcCGzI79MLI7OxmZtZICF/gxYPGePWTvPk3DrAHBSvppFLVne6uIBFcG9f9dnJr6xubW/ntws7u3v5B8fCoqeNUMWywWMSqHVCNgktsGG4EthOFNAoEtoLR7cxvPaLSPJb3ZpygH9GB5CFn1Fip/tQrltyyOwdZJV5GSpCh1it+dfsxSyOUhgmqdcdzE+NPqDKcCZwWuqnGhLIRHWDHUkkj1P5kfuiUnFmlT8JY2ZKGzNXfExMaaT2OAtsZUTPUy95M/M/rpCa89idcJqlByRaLwlQQE5PZ16TPFTIjxpZQpri9lbAhVZQZm03BhuAtv7xKmpWyd1Gu1C9L1ZssjjycwCmcgwdXUIU7qEEDGCA8wyu8OQ/Oi/PufCxac042cwx/4Hz+AOeHjQA=</latexit>

FX(x) = P (X x)<latexit sha1_base64="c4X+es9QB862+1Tfu6CmKcTO2yw=">AAAB/HicbVBNS8NAEN3Ur1q/oj16WSxCeylJFfQiFAXxWMG2gTaEzXbTLt1swu5GGkL9K148KOLVH+LNf+O2zUFbHww83pthZp4fMyqVZX0bhbX1jc2t4nZpZ3dv/8A8POrIKBGYtHHEIuH4SBJGOWkrqhhxYkFQ6DPS9cc3M7/7SISkEX9QaUzcEA05DShGSkueWb71nOqkBq9gq+rAPiNwUvPMilW35oCrxM5JBeRoeeZXfxDhJCRcYYak7NlWrNwMCUUxI9NSP5EkRniMhqSnKUchkW42P34KT7UygEEkdHEF5+rviQyFUqahrztDpEZy2ZuJ/3m9RAWXbkZ5nCjC8WJRkDCoIjhLAg6oIFixVBOEBdW3QjxCAmGl8yrpEOzll1dJp1G3z+qN+/NK8zqPowiOwQmoAhtcgCa4Ay3QBhik4Bm8gjfjyXgx3o2PRWvByGfK4A+Mzx83bZKO</latexit>

X x<latexit sha1_base64="v7SPDaFpFd5Ee6fK5tkbtZs9vpE=">AAAB7nicbVBNS8NAEJ3Ur1q/qh69LBbBU0mqoMeiF48V7Ae0oWy2k3bpZhN2N2IJ/RFePCji1d/jzX/jts1BWx8MPN6bYWZekAiujet+O4W19Y3NreJ2aWd3b/+gfHjU0nGqGDZZLGLVCahGwSU2DTcCO4lCGgUC28H4dua3H1FpHssHM0nQj+hQ8pAzaqzU7pCeQPLUL1fcqjsHWSVeTiqQo9Evf/UGMUsjlIYJqnXXcxPjZ1QZzgROS71UY0LZmA6xa6mkEWo/m587JWdWGZAwVrakIXP190RGI60nUWA7I2pGetmbif953dSE137GZZIalGyxKEwFMTGZ/U4GXCEzYmIJZYrbWwkbUUWZsQmVbAje8surpFWrehfV2v1lpX6Tx1GEEziFc/DgCupwBw1oAoMxPMMrvDmJ8+K8Ox+L1oKTzxzDHzifP3objwE=</latexit>

Page 18: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Homeworks of 3 students returned randomly● Each permutation equally likely● X: # people who get their own homework

Prob Outcome w X(w)

1/6 1 2 3 3

1/6 1 3 2 1

1/6 2 1 3 1

1/6 2 3 1 0

1/6 3 1 2 0

1/6 3 2 1 1

I pmf

43ko

g L's

Page 19: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Probability

Alex TsunJoshua Fan

Page 20: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flipping two coins

Page 21: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Expectation

Page 22: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Homeworks of 3 students returned randomly● Each permutation equally likely● X: # people who get their own homework● What is E(X)?

Prob Outcome w X(w)

1/6 1 2 3 3

1/6 1 3 2 1

1/6 2 1 3 1

1/6 2 3 1 0

1/6 3 1 2 0

1/6 3 2 1 1

X nXHP wX123P123 X 132P 132 t X 2B P 2B tX321 P321 X231 P231 t X 312 P 312

Page 23: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flip a biased coin until get heads (flips independent)With probability p of coming up heads Keep flipping until the first Heads observed.

Let X be the number of flips until done.

● Pr(X = 1)

● Pr(X = 2)

● Pr(X = k)

a pkb fl p

k

c tp pd p u p

Page 24: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flip a biased coin until get heads (flips independent)With probability p of coming up heads Keep flipping until the first Heads observed.

Let X be the number of flips until done. What is E(X)?

A

x'Ik o

osx at

Page 25: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flip a biased coin independently Probability p of coming up heads, n coin flipsX: number of Heads observed.

● Pr(X = k)

a K pb pkapy

k

c E a pjd 2 pkap'T

Page 26: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Repeated coin flippingFlip a biased coin with probability p of coming up Heads n times. Each flip independent of all others.

X is number of Heads.

What is E(X)? A 20 p

a I

b 4

c 5

d 10

Page 27: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Repeated coin flippingFlip a biased coin with probability p of coming up Heads n times.

X is number of Heads.

What is E(X)?

Page 28: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Flip a Fair coin independently ● Probability p of coming up heads, n coin flips● X: number of Heads observed.

Page 29: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Probability3.2 More on Expectation

Alex Tsun

Page 30: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Agenda● Linearity of Expectation (LoE)● Law of the Unconscious Statistician (Lotus)

Page 31: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Linearity of Expectation (Idea)Let’s say you and your friend sell fish for a living.● Every day you catch X fish, with E[X] = 3.● Every day your friend catches Y fish, with E[Y] = 7.

how many fish do the two of you bring in (Z = X + Y) on an average day? E[Z] = E[X + Y] = e[X] + E[Y] = 3 + 7 = 10

You can sell each fish for $5 at a store, but you need to pay $20 in rent. How much profit do you expect to make? E[5Z - 20] = 5E[Z] - 20 = 5 x 10 - 20 = 30

Page 32: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Linearity of Expectation (Idea)Let’s say you and your friend sell fish for a living.● Every day you catch X fish, with E[X] = 3.● Every day your friend catches Y fish, with E[Y] = 7.

how many fish do the two of you bring in (Z = X + Y) on an average day? E[Z] = E[X + Y] =

You can sell each fish for $5 at a store, but you need to pay $20 in rent. How much profit do you expect to make? E[5Z - 20] = 5E[Z] - 20 = 5 x 10 - 20 = 30

Page 33: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Linearity of Expectation (Idea)Let’s say you and your friend sell fish for a living.● Every day you catch X fish, with E[X] = 3.● Every day your friend catches Y fish, with E[Y] = 7.

how many fish do the two of you bring in (Z = X + Y) on an average day? E[Z] = E[X + Y] = e[X] + E[Y] = 3 + 7 = 10

You can sell each fish for $5 at a store, but you need to pay $20 in rent. How much profit do you expect to make? E[5Z - 20] = 5E[Z] - 20 = 5 x 10 - 20 = 30

Page 34: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Linearity of Expectation (Idea)Let’s say you and your friend sell fish for a living.● Every day you catch X fish, with E[X] = 3.● Every day your friend catches Y fish, with E[Y] = 7.

how many fish do the two of you bring in (Z = X + Y) on an average day? E[Z] = E[X + Y] = e[X] + E[Y] = 3 + 7 = 10

You can sell each fish for $5 at a store, but you need to pay $20 in rent. How much profit do you expect to make? E[5Z - 20] = 5E[Z] - 20 = 5 x 10 - 20 = 30

Page 35: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Linearity of Expectation (LoE)

Page 36: Probability - courses.cs.washington.edu€¦ · Probability 3.1 Discrete Random Variables Basics Anna Karlin Most slides by Alex Tsun. Agenda Intro to Discrete Random Variables Probability

Linearity of Expectation (Proof)