



































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




































Probability plays a key role in the sciences ââhardâ and social âincluding com puter science. Many algorithms rely on randomization. Investigating their cor rectness and performance requires probability theory. Moreover, computer sys tems designs, such as memory management, branch prediction, packet routing, and load balancing are based on probabilistic assumptions and analyses. Probabil ity is central as well in related subjects such as information theory, cryptography, artificial intelligence, and game theory. But weâll start with a more down-to-earth application: getting a prize in a game show.
In the September 9, 1990 issue of Parade magazine, the columnist Marilyn vos Sa vant responded to this letter:
Suppose youâre on a game show, and youâre given the choice of three doors. Behind one door is a car, behind the others, goats. You pick a door, say number 1, and the host, who knows whatâs behind the doors, opens another door, say number 3, which has a goat. He says to you, âDo you want to pick door number 2?â Is it to your advantage to switch your choice of doors? Craig. F. Whitaker Columbia, MD
The letter describes a situation like one faced by contestants on the 1970âs game show Letâs Make a Deal, hosted by Monty Hall and Carol Merrill. Marilyn replied that the contestant should indeed switch. She explained that if the car was behind either of the two unpicked doors âwhich is twice as likely as the the car being behind the picked door âthe contestant wins by switching. But she soon received a torrent of letters, many from mathematicians, telling her that she was wrong. The problem generated thousands of hours of heated debate.
409
This incident highlights a fact about probability: the subject uncovers lots of examples where ordinary intuition leads to completely wrong conclusions. So un til youâve studied probabilities enough to have refined your intuition, a way to avoid errors is to fall back on a rigorous, systematic approach such as the Four Step Method.
Every probability problem involves some sort of randomized experiment, process, or game. And each such problem involves two distinct challenges:
In this section, we introduce a four step approach to questions of the form, âWhat is the probability that ââ ?â In this approach, we build a probabilistic model step-by-step, formalizing the original question in terms of that model. Remark ably, the structured thinking that this approach imposes provides simple solutions to many famously-confusing problems. For example, as youâll see, the four step method cuts through the confusion surrounding the Monty Hall problem like a Ginsu knife. However, more complex probability questions may spin off chal lenging counting, summing, and approximation problemsâ which, fortunately, youâve already spent weeks learning how to solve.
Craigâs original letter to Marilyn vos Savant is a bit vague, so we must make some assumptions in order to have any hope of modeling the game formally:
In making these assumptions, weâre reading a lot into Craig Whitakerâs letter. Other interpretations are at least as defensible, and some actually lead to differ ent answers. But letâs accept these assumptions for now and address the question, âWhat is the probability that a player who switches wins the car?â
car location
playerâs initial guess
door revealed
C
C
C
A
B
A
B
A B C A B C A B
A
C
A
C C
B
A
B
outcome
B
(A,A,B)
(A,A,C)
(A,B,C)
(B,A,C)
(B,B,A)
(B,B,C)
(B,C,A)
(C,A,B)
(C,B,A)
(C,C,A)
(C,C,B)
(A,C,B)
Notice that the third layer reflects the fact that the host has either one choice or two, depending on the position of the car and the door initially selected by the player. For example, if the prize is behind door A and the player picks door B, then the host must open door C. However, if the prize is behind door A and the player picks door A, then the host could open either door B or door C. Now letâs relate this picture to the terms we introduced earlier: the leaves of the tree represent outcomes of the experiment, and the set of all leaves represents the sample space. Thus, for this experiment, the sample space consists of 12 outcomes. For reference, weâve labeled each outcome with a triple of doors indicating:
(door concealing prize, door initially chosen, door opened to reveal a goat)
In these terms, the sample space is the set:
(A, A, B), (A, A, C), (A, B, C), (A, C, B), (B, A, C), (B, B, A), (B, B, C), (B, C, A), (C, A, B), (C, B, A), (C, C, A), (C, C, B)
The tree diagram has a broader interpretation as well: we can regard the whole experiment as following a path from the root to a leaf, where the branch taken at each stage is ârandomlyâ determined. Keep this interpretation in mind; weâll use it again later.
Our objective is to answer questions of the form âWhat is the probability that... ?â, where the missing phrase might be âthe player wins by switchingâ, âthe player initially picked the door concealing the prizeâ, or âthe prize is behind door Câ, for example. Each of these phrases characterizes a set of outcomes: the outcomes specified by âthe prize is behind door Câ is:
{(C, A, B), (C, B, A), (C, C, A), (C, C, B)}
A set of outcomes is called an event. So the event that the player initially picked the door concealing the prize is the set:
{(A, A, B), (A, A, C), (B, B, A), (B, B, C), (C, C, A), (C, C, B)}
And what weâre really after, the event that the player wins by switching, is the set of outcomes:
{(A, B, C), (A, C, B), (B, A, C), (B, C, A), (C, A, B), (C, B, A)}
Letâs annotate our tree diagram to indicate the outcomes in this event.
car location
playerâs initial guess
door revealed
switch wins?
C
C
C
A
B
A
B
A B C A B C A B
A
C
A
C C
B
A
B
outcome
X X X X X X B
(A,A,B)
(A,A,C)
(A,B,C)
(B,A,C)
(B,B,A)
(B,B,C)
(B,C,A)
(C,A,B)
(C,B,A)
(C,C,A)
(C,C,B)
(A,C,B)
car location
playerâs initial guess
door revealed switch wins?
C
C
C
A
B
A
B
A B C A B C A B
A
C
A
C C
1/
1/
1/
1/ 1/
1/
1/ 1/
1/
1/
1/
1/
1 1 1 1 1 1
1/2 B
1/
1/
1/
A
B
1/
1/
outcome
X X X X X X B
(A,A,B)
(A,A,C)
(A,B,C)
(B,A,C)
(B,B,A)
(B,B,C)
(B,C,A)
(C,A,B)
(C,B,A)
(C,C,A)
(C,C,B)
(A,C,B)
Step 3b: Compute Outcome Probabilities
Our next job is to convert edge probabilities into outcome probabilities. This is a purely mechanical process: the probability of an outcome is equal to the product of the edge-probabilities on the path from the root to that outcome. For example, the probability of the topmost outcome, (A, A, B) is
1 1 1 1 =. 3
Thereâs an easy, intuitive justification for this rule. As the steps in an experi ment progress randomly along a path from the root of the tree to a leaf, the proba bilities on the edges indicate how likely the walk is to proceed along each branch. For example, a path starting at the root in our example is equally likely to go down each of the three top-level branches. Now, how likely is such a walk to arrive at the topmost outcome, (A, A, B)? Well, there is a 1-in-3 chance that a walk would follow the A-branch at the top level, a 1-in-3 chance it would continue along the A-branch at the second level, and 1-in-2 chance it would follow the B-branch at the third level. Thus, it seems that about 1 walk in 18 should arrive at the (A, A, B) leaf, which is precisely the probability we assign it. Anyway, letâs record all the outcome probabilities in our tree diagram.
car location
playerâs initial guess
door revealed switch wins?
C
C
C
A
B
A
B
A B C A B C A B
A
C
A
C C
1/
1/
1/
1/ 1/
1/
1/ 1/
1/
1/
1/
1/
1 1 1 1 1 1
1/2 B
1/
1/
1/
A
B
1/
1/
outcome
X X X X X X
probability 1/
1/
1/
1/
1/
1/
1/
1/
1/
1/
1/
1/
B
(A,A,B)
(A,A,C)
(A,B,C)
(B,A,C)
(B,B,A)
(B,B,C)
(B,C,A)
(C,A,B)
(C,B,A)
(C,C,A)
(C,C,B)
(A,C,B)
Specifying the probability of each outcome amounts to defining a function that maps each outcome to a probability. This function is usually called Pr. In these terms, weâve just determined that:
Pr {(A, A, B)} = 18 1 Pr {(A, A, C)} = 18 1 Pr {(A, B, C)} = 9 etc.
We now have a probability for each outcome, but we want to determine the prob ability of an event which will be the sum of the probabilities of the outcomes in it. The probability of an event, E, is written Pr {E}. For example, the probability of
Problem 18.2. To determine which of two people gets a prize, a coin is flipped twice. If the flips are a Head and then a Tail, the first player wins. If the flips are a Tail and then a Head, the second player wins. However, if both coins land the same way, the flips donât count and whole the process starts over. Assume that on each flip, a Head comes up with probability p, regardless of what happened on other flips. Use the four step method to find a simple formula for the probability that the first player wins. What is the probability that neither player wins? Suggestions: The tree diagram and sample space are infinite, so youâre not go ing to finish drawing the tree. Try drawing only enough to see a pattern. Summing all the winning outcome probabilities directly is difficult. However, a neat trick solves this problem and many others. Let s be the sum of all winning outcome probabilities in the whole tree. Notice that you can write the sum of all the winning probabilities in certain subtrees as a function of s. Use this observation to write an equation in s and then solve.
Problem 18.3. [The Four-Door Deal] Letâs see what happens when Letâs Make a Deal is played with four doors. A prize is hidden behind one of the four doors. Then the contestant picks a door. Next, the host opens an unpicked door that has no prize behind it. The contestant is allowed to stick with their original door or to switch to one of the two unopened, unpicked doors. The contestant wins if their final choice is the door hiding the prize. Use The Four Step Method of Section 18.1 to find the following probabilities. The tree diagram may become awkwardly large, in which case just draw enough of it to make its structure clear.
(a) Contestant Stu, a sanitation engineer from Trenton, New Jersey, stays with his original door. What is the probability that Stu wins the prize?
(b) Contestant Zelda, an alien abduction researcher from Helena, Montana, switches to one of the remaining two doors with equal probability. What is the probability that Zelda wins the prize?
Problem 18.4. [Simulating a fair coin] Suppose you need a fair coin to decide which door to choose in the 6.042 Monty Hall game. After making everyone in your group empty their pockets, all you managed to turn up is some crumpled bubble gum wrappers, a few used tissues, and one penny. However, the penny was from Prof. Meyerâs pocket, so it is not safe to assume that it is a fair coin. How can we use a coin of unknown bias to get the same effect as a fair coin
of bias 1 / 2? Draw the tree diagram for your solution, but since it is infinite, draw only enough to see a pattern. Suggestion: A neat trick allows you to sum all the outcome probabilities that cause you to say âHeadsâ: Let s be the sum of all âHeadsâ outcome probabilities in the whole tree. Notice that you can write the sum of all the âHeadsâ outcome proba bilities in certain subtrees as a function of s. Use this observation to write an equation in s and then solve.
Homework Problems
Problem 18.5. I have a deck of 52 regular playing cards, 26 red, 26 black, randomly shuffled. They all lie face down in the deck so that you canât see them. I will draw a card off the top of the deck and turn it face up so that you can see it and then put it aside. I will continue to turn up cards like this but at some point while there are still cards left in the deck, you have to declare that you want the next card in the deck to be turned up. If that next card turns up black you win and otherwise you lose. Either way, the game is then over.
(a) Show that if you take the first card before you have seen any cards, you then have probability 1 / 2 of winning the game.
(b) Suppose you donât take the first card and it turns up red. Show that you have then have a probability of winning the game that is greater than 1 / 2.
(c) If there are r red cards left in the deck and b black cards, show that the proba bility of winning in you take the next card is b/(r + b).
(d) Either,
18.2 Set Theory and Probability
Letâs abstract what weâve just done in this Monty Hall example into a general mathematical definition of probability. In the Monty Hall example, there were only finitely many possible outcomes. Other examples in this course will have a countably infinite number of outcomes. General probability theory deals with uncountable sets like the set of real num bers, but we wonât need these, and sticking to countable sets lets us define the probability of events using sums instead of integrals. It also lets us avoid some distracting technical problems in set theory like the Banach-Tarski âparadoxâ men tioned in Chapter 5.2.5.
Rule (Complement Rule).
Pr A = 1 â Pr {A}.
Sometimes the easiest way to compute the probability of an event is to compute the probability of its complement and then apply this formula. Some further basic facts about probability parallel facts about cardinalities of finite sets. In particular:
Pr {B â A} = Pr {B} â Pr {A â© B} , (Difference Rule) Pr {A âȘ B} = Pr {A} + Pr {B} â Pr {A â© B} , (Inclusion-Exclusion) Pr {A âȘ B} †Pr {A} + Pr {B}. (Booleâs Inequality)
The Difference Rule follows from the Sum Rule because B is the union of the dis joint sets B â A and A â© B. Inclusion-Exclusion then follows from the Sum and Difference Rules, because AâȘB is the union of the disjoint sets A and BâA. Booleâs inequality is an immediate consequence of Inclusion-Exclusion since probabilities are nonnegative. The two event Inclusion-Exclusion equation above generalizes to n events in the same way as the corresponding Inclusion-Exclusion rule for n sets. Booleâs inequality also generalizes to
Pr {E 1 âȘ · · · âȘ En} †Pr {E 1 } + · · · + Pr {En}. (Union Bound)
This simple Union Bound is actually useful in many calculations. For example, suppose that Ei is the event that the i-th critical component in a spacecraft fails. Then E 1 âȘ · · · âȘ En is the event that some critical component fails. The Union Bound can give an adequate upper bound on this vital probability. Similarly, the Difference Rule implies that
If A â B, then Pr {A} †Pr {B}. (Monotonicity)
Suppose two players take turns flipping a fair coin. Whoever flips heads first is declared the winner. What is the probability that the first player wins? A tree diagram for this problem is shown below:
1/
1/
1/
1/
1/
1/
1/
1/
etc.
first player
second player
first player
second player
1/
1/
1/
1/
The event that the first player wins contains an infinite number of outcomes, but we can still sum their probabilities:
1 1 1 1 Pr {first player wins} = + + + + 2 8 32 128
(^2) n=0 4 1 1 2 = =. 2 1 â 1 / 4 3 Similarly, we can compute the probability that the second player wins: 1 1 1 1 Pr {second player wins} = + + + + 4 16 64 256
To be formal about this, sample space is the infinite set
S ::= {TnH | n â N}
where Tn^ stands for a length n string of Tâs. The probability function is
1 Pr {TnH} ::=. 2 n+
Since this function is obviously nonnegative, To verify that this is a probability space, we just have to check that all the probabilities sum to 1. But this follows directly from the formula for the sum of a geometric series:
ïżœ ïżœ 1 1 ïżœ (^1) Pr {TnH} = = = 1. TnHâS nâN 2 n+1^2 nâN^2 n Notice that this model does not have an outcome corresponding to the possi bility that both players keep flipping tails forever âin the diagram, flipping for ever corresponds to following the infinite path in the tree without ever reaching
(a) Show that the probability that the system fails could be as small as p by de scribing appropriate probabilities for the outcomes. Make sure to verify that the sum of your outcome probabilities is 1.
(b) Show that the probability that the system fails could actually be as large as np by describing appropriate probabilities for the outcomes. Make sure to verify that the sum of your outcome probabilities is 1.
(c) Prove inequality (18.1).
Problem 18.7. Here are some handy rules for reasoning about probabilities that all follow directly from the Disjoint Sum Rule in the Appendix. Prove them.
Pr {A â B} = Pr {A} â Pr {A â© B} (Difference Rule)
Pr A = 1 â Pr {A} (Complement Rule)
Pr {A âȘ B} = Pr {A} + Pr {B} â Pr {A â© B} (Inclusion-Exclusion)
Pr {A âȘ B} †Pr {A} + Pr {B}. (2-event Union Bound)
If A â B, then Pr {A} †Pr {B}. (Monotonicity)
Problem 18.8. Suppose Pr {} : S â [0, 1] is a probability function on a sample space, S, and let B be an event such that Pr {B} > 0. Define a function PrB {·} on events outcomes w â S by the rule:
PrB {w} ::=
Pr {w} / Pr {B} if w â B, (18.2) 0 if w /â B.
(a) Prove that PrB {·} is also a probability function on S according to Defini tion 18.2.2.
(b) Prove that Pr {A â© B} PrB {A} = Pr {B}
for all A â S.
18.3 Conditional Probability
Suppose that we pick a random person in the world. Everyone has an equal chance of being selected. Let A be the event that the person is an MIT student, and let B be the event that the person lives in Cambridge. What are the probabilities of these events? Intuitively, weâre picking a random point in the big ellipse shown below and asking how likely that point is to fall into region A or B:
A
B
The vast majority of people in the world neither live in Cambridge nor are MIT students, so events A and B both have low probability. But what is the probability that a person is an MIT student, given that the person lives in Cambridge? This should be much greaterâ but what is it exactly? What weâre asking for is called a conditional probability; that is, the probability that one event happens, given that some other event definitely happens. Questions about conditional probabilities come up all the time:
There is a special notation for conditional probabilities. In general, Pr {A | B} denotes the probability of event A, given that event B happens. So, in our example, Pr {A | B} is the probability that a random person is an MIT student, given that he or she is a Cambridge resident. How do we compute Pr {A | B}? Since we are given that the person lives in Cambridge, we can forget about everyone in the world who does not. Thus, all outcomes outside event B are irrelevant. So, intuitively, Pr {A | B} should be the fraction of Cambridge residents that are also MIT students; that is, the answer
L 1/
W
W
L 2/
L (^) 1/
W
L
L (^) 1/
W
W
1st game outcome 2nd game outcome
3rd game outcome probability
outcome
event B: win the 1st game?
event A: win the series?
LL
outcome
Step 1: Find the Sample Space
Each internal vertex in the tree diagram has two children, one corresponding to a win for the Halting Problem (labeled W ) and one corresponding to a loss (labeled L). The complete sample space is:
S = {W W, W LW, W LL, LW W, LW L, LL}
Step 2: Define Events of Interest
The event that the Halting Problem wins the whole tournament is:
T = {W W, W LW, LW W }
And the event that the Halting Problem wins the first game is:
F = {W W, W LW, W LL}
The outcomes in these events are indicated with checkmarks in the tree diagram.
Step 3: Determine Outcome Probabilities
Next, we must assign a probability to each outcome. We begin by labeling edges as specified in the problem statement. Specifically, The Halting Problem has a 1 / 2 chance of winning the first game, so the two edges leaving the root are each as signed probability 1 / 2. Other edges are labeled 1 / 3 or 2 / 3 based on the outcome
of the preceding game. We then find the probability of each outcome by multiply ing all probabilities along the corresponding root-to-leaf path. For example, the probability of outcome W LL is:
2
Step 4: Compute Event Probabilities
We can now compute the probability that The Halting Problem wins the tourna ment, given that they win the first game:
Pr {A â© B} Pr {A | B} = Pr {B} Pr {{W W, W LW }} = Pr {{W W, W LW, W LL}} 1 /3 + 1/ 18 = 1 /3 + 1/ 18 + 1 / 9 7 = 9
Weâre done! If the Halting Problem wins the first game, then they win the whole tournament with probability 7 / 9.
Weâve now settled into a routine of solving probability problems using tree dia grams. But weâve left a big question unaddressed: what is the mathematical justi fication behind those funny little pictures? Why do they work? The answer involves conditional probabilities. In fact, the probabilities that weâve been recording on the edges of tree diagrams are conditional probabilities. For example, consider the uppermost path in the tree diagram for the Halting Prob lem, which corresponds to the outcome W W. The first edge is labeled 1 / 2 , which is the probability that the Halting Problem wins the first game. The second edge is labeled 2 / 3 , which is the probability that the Halting Problem wins the second game, given that they won the firstâ thatâs a conditional probability! More gener ally, on each edge of a tree diagram, we record the probability that the experiment proceeds along that path, given that it reaches the parent vertex. So weâve been using conditional probabilities all along. But why can we mul tiply edge probabilities to get outcome probabilities? For example, we concluded that:
1 2 Pr {W W } = 2