### Conditional Probability

```Conditional Probability
What is a conditional probability?
• It is the probability of an event in a subset
of the sample space
• Example: Roll a die twice, win if total ≥ 9
• Sample space S = set of outcomes
= {11, 12, 13, 14, 15, 16, 21, 22, …, 65, 66}
• Event W = pairs that sum to ≥ 9
= {36, 45, 46, 54, 55, 56, 63, 64, 65, 66}
• Pr(W) = 10/36
What is a conditional probability?
• Now suppose we know that the first roll is 4
or 5. What is now the probability that the
sum of the two rolls will be ≥ 9?
• Let B = first roll is 4 or 5
= {41, 42, …, 46, 51, 52, …, 56}
• Event W∩B = {45, 46, 54, 55, 56}
• Pr(W | B) = |W∩B|/|B| = 5/12
• “Probability of W given B”
Conditional probability
• But since the sample space is the same,
| W  B | | W  B | / | S | Pr(W  B)
Pr(W | B) 


|B|
|B|/|S|
Pr(B)
• In general, the conditional probability of
event A given event B is defined as
Pr(A  B)
Pr(A | B) 
Pr(B)
What is the difference between
Pr(A|B) and Pr(B|A)?
• Pr(A|B) is the proportion of B that is also within A,
that is, Pr(A|B) is |A∩B| as a proportion of |B|
A
B
A∩B
• Pr(A|B) is close to 1 but Pr(B|A) is close to 0
CS20
• This class has 42 students, 13 freshmen, 17
women, and 5 women freshmen
• So if a student is selected at random,
– Pr(Freshman) = 13/42,
– Pr(Woman) = 17/42
– Pr(Woman freshman) = 5/42.
• If a random selection chooses a woman, what is
the probability she is a freshman?
– Simple way: #women freshmen/#women = 5/17
– Using probability:
Pr(W  F) 5 / 42
5
Pr(F | W ) 


Pr(W )
17 / 42 17
Conditional Probability and
Independence
• Fact: A and B are independent events iff
Pr(A|B) = Pr(A).
• That is, knowing whether B is the case gives
no information that would help determine the
probability of A.
• Proof:
A and B independent iff Pr(A)∙Pr(B) = Pr(A∩B)
Pr(A∩B) = Pr(A|B)∙Pr(B)
So as long as Pr(B) is nonzero,
Pr(A)∙Pr(B) = Pr(A|B)∙Pr(B) iff Pr(A) = Pr(A|B)
Total Probability
• Suppose (hypothetically!):
– Rick Santorum has a 5% probability of getting
enough delegates to become the Republican
nominee, unless the voting goes beyond the first
ballot and there is a brokered convention
– In a brokered convention, Santorum has a 65%
probability of winning the nomination
– There is a 7% probability of a brokered
• What is the probability that Santorum will be
the Republican nominee?
Total Probability
Simple version: For any events A and B
whose probability is neither 0 nor 1:
Pr(A)  Pr(A | B)Pr(B)  Pr(A | B)Pr(B)
That is, Pr(A) is the weighted average of the
probability of A conditional on B
happening, and the probability of A
conditional on B not happening.
_
B
B
A
S
“Total probability” = weighted
average of probabilities
Pr(S)  Pr(S | B)Pr(B)  Pr(S | B)Pr(B)
• Pr(Santorum|Brokered) = .65
• Pr(Santorum|¬Brokered) = .05
• Pr(Brokered) = .07
• Then Pr(Santorum) =
.65∙.07 + .05∙.93 = .092
FINIS
```