Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Discrete Probability Hsin-Lung Wu Assistant Professor Advanced Algorithms 2008 Fall.

Similar presentations


Presentation on theme: "1 Discrete Probability Hsin-Lung Wu Assistant Professor Advanced Algorithms 2008 Fall."— Presentation transcript:

1 1 Discrete Probability Hsin-Lung Wu Assistant Professor Advanced Algorithms 2008 Fall

2 2 Sample space (set) S of elementary event  eg. The 36 ways of 2 dices can fall An event A is a subset of S  eg. Rolling 7 with 2 dices A probability distribution Pr{} is a map from events of S to R Probability Axiom: 

3 3

4 4 A random variable ( r. v.) X is a function from S to R  The event “ X = x ” is defined as { s  S : X ( s ) = x }  eg. Rolling 2 dices: | S |= 36 possible outcomes Uniform distribution: Each element has the same probability 1 /| S |= 1/36 Let X be the sum of dice Pr{ X = 5 } = 4/36, {(1, 4), (2, 3), (3, 2), (4, 1)} Expected value: Linearity:  X 1 : number on dice 1  X 2 : number on dice 2  X = X 1 + X 2, E[ X 1 ]=E[ X 2 ]= 1/6 ( 1+2+3+4+5+6 )= 21/6

5 5 Independence Two random variables X and Y are independent if

6 6 Indicator random variables  Given a sample space S and an event A, the indicator random variable I { A } associated with event A is defined as:

7 7 E.g.: Consider flipping a fair coin:  Sample space S = { H, T }  Define random variable Y with Pr { Y = H } = Pr { Y = T }= 1/2  We can define an indicator r.v. X H associated with the coin coming up heads, i.e. Y=H

8 8

9 9 The birthday paradox:  How many people must there be in a room before there is a 50% chance that two of them born on the same day of the year? (1)  Suppose there are k people and there are n days in a year, b i : i -th person’s birthday, i = 1,…, k  Pr { b i =r } =1/n, for i = 1,…, k and r=1,2,…,n  Pr { b i =r, b j =r }= Pr { b i =r } . Pr { b j =r } = 1/n 2

10 10   Define event A i : Person i ’s birthday is different from person j ’s for j < i   Pr{B k } = Pr{B k-1 ∩ A k } = Pr{B k-1 }Pr{A k |B k-1 } where Pr{B 1 } = Pr{A 1 }=1 

11 11 (2) Analysis using indicator random variables  For each pair (i, j) of the k people in the room, define the indicator r.v. X ij, for 1≤ i < j ≤ k, by 

12 12  When k(k-1) ≥ 2n, the expected number of pairs of people with the same birthday is at least 1 

13 13 Balls and bins problem:  Randomly toss identical balls into b bins, numbered 1,2,…,b. The probability that a tossed ball lands in any given bin is 1/b  (a) How many balls fall in a given bin? If n balls are tossed, the expected number of balls that fall in the given bin is n/b  (b) How many balls must one toss, on the average, until a given bin contains a ball? By geometric distribution with probability 1/b

14 14  (c) (Coupon collector’s problem) How many balls must one toss until every bin contains at least one ball? Want to know the expected number n of tosses required to get b hits. The i th stage consists of the tosses after the (i-1) st hit until the i th hit. For each toss during the i th stage, there are i-1 bins that contain balls and b-i+1 empty bins Thus, for each toss in the i th stage, the probability of obtaining a hit is (b-i+1)/b Let n i be the number of tosses in the i th stage. Thus the number of tosses required to get b hits is n= ∑ b i=1 n i Each n i has a geometric distribution with probability of success (b-i+1)/b → E[n i ]=b/b-i+1

15 15 Streaks Flip a fair coin n times, what is the longest streak of consecutive heads?Ans:θ(lg n) Let A ik be the event that a streak of heads of length at least k begin s with the i th coin flip For j=0,1,2,…,n, let L j be the event that the longest streak of heads has Length exactly j, and let L be the length of the longest streak.

16 16

17 17 We look for streaks of length s by partitioning the n flips into approximately n/s groups of s flips each.

18 18 The probability that a streak of heads of length does not begin in position i is s ss n

19 19

20 20 Using indicator r.v. : 

21 21 If c is large, the expected number of streaks of length clgn is very small. Therefore, one streak of such a length is very likely to occur.

22 22 The on-line hiring problem: To hire an assistant, an employment agency sends one candidate each day. After interviewing that person you decide to either hire that person or not. The process stops when a person is hired. What is the trade-off between minimizing the amount of interviewing and maximizing the quality of the candidate hired?

23 23 The on-line hiring problem: P1P1 P2P2 P k-1 PkPk …. PiPi P k-1 <?

24 24 What is the best k?

25 25 Let M(j) = max 1  i  j {score(i)}. Let S be the event that the best-qualified applicant is chosen. Let S i be the event the best-qualified applicant chosen is the i-th one interviewed. S i are disjoint and we have Pr{S}=  n i=1 Pr{S i }. If the best-qualified applicant is one of the first k, we have that Pr{S i }=0 and thus Pr{S}=  n i=k+1 Pr{S i }.

26 26 Let B i be the event that the best-qualified applicant must be in position i. Let O i denote the event that none of the applicants in position k+1 through i-1 are chosen If S i happens, then B i and O i must both happen. B i and O i are independent! Why? Pr{S i } = Pr{B i  O i } = Pr{B i } Pr{O i }. Clearly, Pr{B i } = 1/n. Pr{O i } = k/(i-1). Why??? Thus Pr{S i } = k/(n(i-1)).

27 27

28 28


Download ppt "1 Discrete Probability Hsin-Lung Wu Assistant Professor Advanced Algorithms 2008 Fall."

Similar presentations


Ads by Google