Tutorial 2 Solution
Tutorial 2 Solution
Counting Method
Conditional Probability
Total Probability Theorem
Bayes’ Rule
Computing Probability using Counting Methods
2
Put it back
identity
1 2 ≠1 2
n objects
e.g. a child has 3 coins and 4 labeled pockets, more than 1 coins
can be put in the same pockets. In how many ways can he put the
coins in his pockets?
1 2 3 4
Choose k objects from a set A that has n members with
replacement with ordering number of outcomes = nk
Computing Probability using Counting Methods
4
Without replacement with ordering
Without replacement With ordering
Select an object Note its ≠
identity
1 2 ≠1 2
n objects
e.g. a child has 3 coins and 4 labeled pockets, only1 coins can be
put in one pocket. In how many ways can he put the coins in his
pockets?
1 2 3 4
Choose k objects from a set A that has n members without
replacement with ordering number of outcomes= n ( n − 1)( n − 2 )( n − k + 1)
k terms
Computing Probability using Counting Methods
5
Without replacement without ordering
Without replacement Without ordering
Select an object Note its =
identity
1 2 =1 2
n objects
e.g. a child has 3 coins and 4 pockets, only1 coins can be put in
one pocket and the order of the pockets are not considered. In
how many ways can he put the coins in his pockets?
1 2 3 4
Computing Probability using Counting Methods
6
(2) How many ways are there to choose 1 iPod from 50 non-defective
iPods and 1 iPod from 10 defective iPods? 50 10
1 1
50 10
=
P[only one iPod is defective 1 1
] = 0.2825
60
2
(3) The 2 iPods can be both defective or only 1 is defective
Computing Probability using Counting Methods – Example 3
What is the
probability of
being dealt each
type of poker
hand?
10
Poker Probability – Solution
11
1. Royal Flush: five cards in sequence, ace is the highest card, all five
cards are from the same suit (i.e. 10-J-Q-K-A in any of the four suits)
There is only one royal flush in each suit
The number of ways to choose 1 suit from 4
suits is = 4
4
4
1
=
P[ Royal Flush ] 1
= 1.54 ×10−6
52
5
Poker Probability – Solution
12
2. Straight Flush: 5 cards are from the same suit, from A-2-3-4-5 up to
10-J-Q-K-A
3. Four of a kind: contains all four cards of one rank and any other
card (e.g. 9♣ 9♠ 9♦ 9♥ J ♦)
The 4 cards can be any one of the thirteen ranks from 4 suits
13 4
The number of ways to choose 4 cards is
1 4
The number of ways to choose the last card is12 4
1 1
13 4 12 4
[ Four of a kind ] =
1 4 1 1
P= 0.00024
52
5
Poker Probability – Solution
14
4. Full House: 3 matching cards from one rank and 2 matching cards
from another rank (e.g. 8♣ 8 ♥ 8♦ K ♥ K ♠)
5. Flush: any 5 cards from the same suit but not in sequence
10 5
4 − 40
P[ Straight ] =
1
= 0.00392
52
5
Poker Probability – Solution
17
7. Three of a kind: 3 cards are from any of the 13 ranks of the 4 suits,
the remaining 2 cards are from the remaining 12 ranks and each can
have any of the 4 suits. 13 4 12 2
4
of a kind ] =
1 3 2
=
P[Three 0.0211
52
5
8. Two pair: 2 cards of the same rank, two cards of another rank, one
2
card not of either rank. 11 4
13 4
P[Twopairs ] =
2 2 1 1
= 0.0475
52
5
Poker Probability – Solution
18
9. Pair: The pair can be any one of the 13 ranks, and any 2 of the 4
suits. The remaining 3 cards are of different ranks from the remaining
12 ranks in any suit. 13 4 12 3
4
=
P[Three 1 23
of a kind ] = 0.423
52
5
P[ A B ]
P[ A | B ] =
P[B ]
where we assume that P[B] >0
B1 B3 B5 B9 S
B7
A
B2 B6 B8 B10
B4
Total Probability Theorem Example
25
=
1. From the previous slide, we know P [ B1 ] 0.6921,
= P [ B2 ] 0.2825
10 50
P [ B3 ] =
2 0
= 0.0254
60
2
2. If B1 occurs, you will end up 2 non-defective iPods P [ A | B1 ] = 1
3. If B2 occurs, you return to store to select 1 non-defective iPod
50 − 1
P [ A=
| B2 ]
# of non-defective iPods in the store
= 0.8448
60 − 2 Total # of iPods in the store
4. If B3 occurs, you return to store to select 2 non-defective iPods
8 50
=0 2
[ 3]
P=A | B 0.7411
58
2
Total Probability Theorem Example
27
P [ A] = P [ A | B1 ] P[ B1 ] + P [ A | B2 ] P[ B2 ] + P [ A | B3 ] P[ B3 ]
= 1× 0.6921 + 0.8488 × 0.2825 + 0.7411× 0.0254
= 0.9496
Total Probability Theorem & Bayes’ Rule
– Example
28
A man is worried that he might have a disease. He decides to get
tested. Suppose that the testing methods for this disease are known
to be accurate 99 percent of the time, regardless of whether the
results come back positive or negative. His test results come back
positive. If half of the population has it, what is the chance that he
actually has the disease? If, instead, the doctor tells him that the
disease is actually quite rare, occurring randomly in the general
population in only one of every 10,000 people, what is the chance
that he has the disease?
Solution
Define the following events
A: “the man has disease”
B: “the testing result is positive”
Total Probability Theorem & Bayes’ Rule
– Example
29
P [ AB ]
We need to find out P [ A | B] =
P [ B]
1. P [ AB ] = P [ B | A] P[ A]
2.
A AC
P [ AB ] 0.99 × 0.5
[ A | B]
P= = = 0.99
P [ B ] 0.99 × 0.5 + (1 − 0.99 ) × 0.5
Total Probability Theorem & Bayes’ Rule
– Example
30