280 likes | 491 Views
Discrete Probability. Hsin-Lung Wu Assistant Professor Advanced Algorithms 2008 Fall. 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
E N D
Discrete Probability Hsin-Lung Wu Assistant Professor Advanced Algorithms 2008 Fall
Sample space (set) S of elementary event • eg. The 36 ways of 2 dices can fall • An eventA is a subset of S • eg. Rolling 7 with 2 dices • A probability distributionPr{} is a map from events of S to R • Probability Axiom:
A random variable (r.v.) X is a function from S to R • The event “X = x” is defined as {sS : 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: • X1: number on dice 1 • X2: number on dice 2 • X=X1+X2, E[X1]=E[X2]=1/6(1+2+3+4+5+6)=21/6
Independence • Two random variables X and Y are independent if
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:
E.g.: Consider flipping a fair coin: • Sample space S = { H,T } • Define random variableY with Pr{ Y=H } = Pr{ Y=T }=1/2 • We can define an indicator r.v.XH associated with the coin coming up heads, i.e.Y=H
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,bi : i-th person’s birthday, i =1,…,k • Pr{bi=r}=1/n, for i =1,…,k and r=1,2,…,n • Pr{bi=r, bj=r}=Pr{bi=r}.Pr{bj=r} = 1/n2
Define event Ai : Person i’s birthday is different from person j’s for j < i • Pr{Bk}= Pr{Bk-1∩Ak}= Pr{Bk-1}Pr{Ak|Bk-1}where Pr{B1}= Pr{A1}=1
(2) Analysis using indicator random variables • For each pair (i, j) of the k people in the room, define the indicator r.v.Xij, for 1≤ i < j ≤ k, by
When k(k-1)≥ 2n, the expected number of pairs of people with the same birthday is at least 1
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
(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 ith stage consists of the tosses after the (i-1)st hit until the ith hit. • For each toss during the ith stage, there are i-1 bins that contain balls and b-i+1 empty bins • Thus, for each toss in the ith stage, the probability of obtaining a hit is (b-i+1)/b • Let ni be the number of tosses in the ith stage. Thus the number of tosses required to get b hits is n=∑bi=1 ni • Each ni has a geometric distribution with probability of success (b-i+1)/b→ E[ni]=b/b-i+1
Streaks • Flip a fair coin n times, what is the longest streak of consecutive heads? Ans:θ(lg n) • Let Aik be the event that a streak of heads of length at least k begins with the ith coin flip • For j=0,1,2,…,n, let Lj be the event that the longest streak of heads has Length exactly j, and let L be the length of the longest streak.
We look for streaks of length s by partitioning the n flips into approximately n/s groups of s flips each.
s s s n • The probability that a streak of heads of length does not begin in position i is
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.
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?
The on-line hiring problem: Pi Pk-1 Pk-1 <? P2 P1 Pk ….
Let M(j) = max 1ij{score(i)}. • Let S be the event that the best-qualified applicant is chosen. • Let Si be the event the best-qualified applicant chosen is the i-th one interviewed. • Si are disjoint and we have Pr{S}= ni=1Pr{Si}. • If the best-qualified applicant is one of the first k, we have that Pr{Si}=0 and thus • Pr{S}= ni=k+1Pr{Si}.
Let Bi be the event that the best-qualified applicant must be in position i. • Let Oi denote the event that none of the applicants in position k+1 through i-1 are chosen • If Si happens, then Bi and Oi must both happen. • Bi and Oi are independent! Why? • Pr{Si} = Pr{Bi Oi} = Pr{Bi} Pr{Oi}. • Clearly, Pr{Bi} = 1/n. • Pr{Oi} = k/(i-1). Why??? • Thus Pr{Si} = k/(n(i-1)).