15-251Great Theoretical Ideas in Computer ScienceLecture 10, September 25, 2008Probability Theory:Counting in Terms of ProportionsSome PuzzlesTeams A and B are equally goodIn any one game, each is equally likely to winWhat is the most likely length of a “best of 7” series?Flip coins until either 4 heads or 4 tails Is this more likely to take 6 or 7 flips?6 and 7 Are Equally LikelyTo reach either one, after 5 games, it must be 3 to 2! chance it ends 4 to 2; ! chance it doesn’tSilver and GoldOne bag has two silver coins, another has two gold coins, and the third has one of eachOne bag is selected at random. One coin from it is selected at random. It turns out to be goldWhat is the probability that the other coin is gold?3 choices of bag2 ways to order bag contents 6 equally likely pathsGiven that we see a gold, 2/3 of remaining paths have gold in them!So, sometimes, probabilities can be counter-intuitive??Language of ProbabilityThe formal language of probability is a very important tool in computer science (and science)Finite Probability DistributionA (finite) probability distribution p is a finite set S of elements, together with a non-negative real weight, or probability p(x) for each element x in S ! p(x) = 1x " SS is often called the sample space and elements x in S are called samplesThe weights must satisfy:SSample spaceSample Space p(x) = 0.2weight or probability of x0.20.130.060.110.170.10.1300.1EventsAny set E # S is called an event! p(x)x " EPrD[E] = S0.170.10.130PrD[E] = 0.4Uniform DistributionIf each element has equal probability, the distribution is said to be uniform! p(x) = x " EPrD[E] = |E||S|A fair coin is tossed 100 times in a rowWhat is the probability that we get exactly half heads?The sample space S is the set of all outcomes {H,T}100Each sequence in S is equally likely, and hence has probability 1/|S|=1/2100Using the LanguageS = all sequencesof 100 tosses x = HHTTT……THp(x) = 1/|S|VisuallySet of all 2100 sequences{H,T}100Probability of event E = proportion of E in SEvent E = Set of sequences with 50 H’s and 50 T’s10050/ 2100Suppose we roll a white die and a black die What is the probability that sum is 7 or 11? (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6) }Pr[E] = |E|/|S| = proportion of E in S = 8/36Same Methodology!S = {23 people are in a roomSuppose that all possible birthdays are equally likelyWhat is the probability that two people will have the same birthday?x = (17,42,363,1,…, 224,177)23 numbersAnd The Same Methods Again!Sample space W = {1, 2, 3, …, 366}23Event E = { x " W | two numbers in x are same }Count |E| instead!What is |E|?all sequences in S that have no repeated numbersE =|W| = 36623|E| = (366)(365)…(344)= 0.494…|W||E||E||W|= 0.506…Sons of AdamAdam was X inches tallHe had two sons:One was X+1 inches tallOne was X-1 inches tallEach of his sons had two sons …XX-1 X+1X-2 X+2XX-3 X+3X-1 X+1X-4 X+4X-2 X+2X11 11121 3 3 11 4 6 4 1In the nth generation there will be 2n males, each with one of n+1 different heights: h0, h1,…,hn hi = (X-n+2i) occurs with proportion:ni/ 2nUnbiased Binomial Distribution On n+1 ElementsLet S be any set {h0, h1, …, hn} where each element hi has an associated probabilityAny such distribution is called an Unbiased Binomial Distribution or an Unbiased Bernoulli Distributionni2nand is defined to be = SABproportion of A $ B More Language Of ProbabilityThe probability of event A given event B is written Pr[ A | B ]to BPr [ A $ B ] Pr [ B ]event A = {white die = 1}event B = {total = 7}Suppose we roll a white die and black dieWhat is the probability that the white is 1 given that the total is 7?(1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6) }S = {|B|Pr[B]6|A $ B|=Pr [ A | B ]Pr [ A $ B ]1= =event A = {white die = 1} event B = {total = 7}Independence!A and B are independent events ifPr[ A | B ] = Pr[ A ]%Pr[ A $ B ] = Pr[ A ] Pr[ B ] %Pr[ B | A ] = Pr[ B ] Pr[A1 | A2 $ A3] = Pr[A1]Pr[A2 | A1 $ A3] = Pr[A2]Pr[A3 | A1 $ A2] = Pr[A3]Pr[A1 | A2 ] = Pr[A1] Pr[A1 | A3 ] = Pr[A1]Pr[A2 | A1 ] = Pr[A2] Pr[A2 | A3] = Pr[A2]Pr[A3 | A1 ] = Pr[A3] Pr[A3 | A2] = Pr[A3]E.g., {A1, A2, A3}are independent events if:Declaration of IndependenceA1, A2, …, Ak are independent events if knowing if some of them occurred does not change the probability of any of the others occurringSilver and GoldOne bag has two silver coins, another has two gold coins, and the third has one of eachOne bag is selected at random. One coin from it is selected at random. It turns out to be goldWhat is the probability that the other coin is gold?Let G1 be the event that the first coin is goldPr[G1] = 1/2Let G2 be the event that the second coin is goldPr[G2 | G1 ] = Pr[G1 and G2] / Pr[G1]= (1/3) / (1/2)= 2/3Note: G1 and G2 are not independentMonty Hall ProblemAnnouncer hides prize behind one of 3 doors at randomYou select some doorAnnouncer opens one of others with no prizeYou can decide to keep or switchWhat to do?Stayingwe win if we chose the correct doorSwitchingwe win if we chose the incorrect doorPr[ choosing correct door ] = 1/3Pr[ choosing incorrect door ] = 2/3Monty Hall ProblemSample space = { prize behind door 1, prize behind door 2, prize behind door 3 } Each has probability 1/3We are inclined to think: “After one door is opened, others are equally likely…”But his action is not independent of yours!Why Was This Tricky?Cognitive DissonanceMonty Meets Monkeys(from article by John Tierney)Experiment: Psychologists first observe that a monkey seeks out red, blue, and green M&Ms about equallyThe monkey is given a choice of red or blue candy. It chooses red.If the monkey is then given a choice of blue or green, it is more likely to choose green.Monty Meets MonkeysPsychological explanation: Monkey rationalizes its initial rejection of blue by telling itself it doesn’t really like blue. (Cognitive dissonance)Probabilistic
View Full Document