L18 Probability
L18 Probability
CSCI 104
Discrete Probability
Aaron Cote
Mark Redekopp'
2
Definitions
• A trial is a procedure that yields one of a set of possible outcomes. A
sequence of trials is an experiment.
– Flipping a coin is a trial.
• The sample space is the set of possible outcomes
– {heads, tails, on edge}
• An event is a subset of the sample space
– {heads, on edge}
• You roll two dice and are wondering if you’ll get snake eyes (two 1’s).
• What is the trial?
Definitions
• A trial is a procedure that yields one of a set of possible outcomes. A
sequence of trials is an experiment.
– Flipping a coin is a trial.
• The sample space is the set of possible outcomes
– {heads, tails, on edge}
• An event is a subset of the sample space
– {heads, on edge}
• You roll two dice and are wondering if you’ll get snake eyes (two 1’s).
• What is the trial?
– Rolling two dice
• What is the sample space?
– {1,2,3,4,5,6} x {1,2,3,4,5,6}
• What is the event?
– Snake eyes (1,1)
• What is the probability of the event?
– 1/36
5
Practice 1
• What is the probability that the sum of two dice rolls is 7?
Practice 1 Solution
• What is the probability that the sum of two dice rolls is 7?
6 1
➢ =
36 6
• How many 5-card Poker hands are there?
52
➢ 5
• How many 5-card Poker hands contain a 4-of-a-kind?
➢ 13 ∙ 48
• What is the probability of a 4-of-a-kind?
13 ∙ 48
➢ 52 = 0.024%
5
• What is the probability of a full house?
4 4
𝑃 ∙
13 2 3 2
➢ 52
5
8
Inverting Probabilities
• You have a sequence of 10 bits, generated
by the uniform distribution. What is the
probability that at least one bit is a 0?
E
𝑝 𝐸ത = 1 − 𝑝(𝐸)
E
9
Inverting Probabilities
• You have a sequence of 10 bits, generated by
the uniform distribution. What is the
probability that at least one bit is a 0?
➢ ______________________________
1 1 1 3
➢ + − =
2 5 10 5
Non-Uniform Distributions
• A biased coin is twice as likely to come up
heads as tails. What is the probability it
comes up heads?
➢2Τ3
• 𝑝 𝐸 = σ𝑠∈𝐸 𝑝(𝑠)
– provided all s are disjoint (mutually exclusive)
14
CONDITIONAL PROBABILITY
15
Conditional Probability
• For the same biased die, we know that an odd
number was rolled. What is the probability a 3
was rolled?
2Τ
➢ 4Τ
7
= 1Τ2 E|F
7
F E
Practice 2
There are 4 people in line. Each person is either
a pirate or a ninja (but not both), assigned by
the uniform distribution. What is the probability
there are two consecutive ninjas, given the first
person in line is a ninja?
𝑝(NN ∩ 1N)
𝑝 NN 1𝑁 =
𝑃(1N)
17
Practice 2 Solution
There are 4 people in line. Each person is either
a pirate or a ninja (but not both), assigned by
the uniform distribution. What is the probability
there are two consecutive ninja, given the first
person in line is a ninja?
𝑝(NN ∩ 1N) Compute 𝑝 NN ∩ 1N :
𝑝 NN 1𝑁 =
𝑃(1N) NNPP
NNPN
𝑝(NN∩1N) NNNP
= 1
2 NNNN
NPNN
=
5 𝑝 NN ∩ 1N = 5ൗ16
8
18
Practice 3
• Intuition B: There are 3 possible events for "at least one boy": BG, GB, BB.
So it is 1Τ3 ?
• Intuition B is correct.
19
• Because:
𝑝(𝐸∩𝐹1) 𝑝 𝐸∩𝐹𝑘
𝑝 𝐸 = ∙ 𝑝 𝐹1 + … + ∙ 𝑝 𝐹𝑘
𝑝(𝐹1) 𝑝 𝐹𝑘
= 𝑝 𝐸 ∩ 𝐹1 + … + 𝑝(𝐸 ∩ 𝐹𝑘)
F1 F2
F3
21
Monty Hall
• Intuition A: there are two doors left, and each is
equally likely, so it doesn’t matter which door you
open.
Indepedence
• Two events E and F are independent exactly
when:
➢𝑃(𝐸|𝐹) = 𝑃(𝐸) or equivalently when
➢𝑃 𝐸 ∩ 𝐹 = 𝑃 𝐸 ∙ 𝑃(𝐹)
𝑃(𝐸∩𝐹) 𝑃(𝐸∩𝐹)
• 𝑃 𝐸𝐹 = and = P(𝐸) only if
𝑃(𝐹) 𝑃(𝐹)
𝑃 𝐸 ∩ 𝐹 = 𝑃 𝐸 ∙ 𝑃(𝐹) to make
𝑃(𝐸 ∩ 𝐹) 𝑃 𝐸 P(𝐹)
= = 𝑃(𝐸)
𝑃(𝐹) 𝑃(𝐹)
27
Practice 4
• A family has 2 children, the gender is determined u.a.r. The event E is when
there are two girls. F is when there is at least one girl. Are E and F
independent?
• The family has 3 children. E is when there is a boy and a girl. F is when there is
at most 1 boy. Are E and F independent?
• There are 4 people in line. Each person is a pirate or ninja (not both),
generated u.a.r. E is when the first person is a ninja. F is when there are an
even number of ninjas. Are E and F independent?
28
Practice 4 Solution
• A family has 2 children, the gender is determined u.a.r. The event E is when
there are two girls. F is when there is at least one girl. Are E and F
independent?
1
– No. p E = 1Τ4 𝑝 𝐹 = 3Τ4 𝑝 𝐸 ∙ 𝑝 𝐹 = 3Τ16 𝑝 𝐸∩𝐹 =
4
• The family has 3 children. E is when there is a boy and a girl. F is when there is
at most 1 boy. Are E and F independent?
3
– Yes. p E = 3Τ4 𝑝 𝐹 = 1Τ2 𝑝 𝐸 ∙ 𝑝 𝐹 = 3Τ8 𝑝 𝐸∩𝐹 =
8
• There are 4 people in line. Each person is a pirate or ninja (not both),
generated u.a.r. E is when the first person is a ninja. F is when there are an
even number of ninjas. Are E and F independent?
1
– Yes. p E = 1Τ2 𝑝 𝐹 = 1Τ2 𝑝 𝐸 ∙ 𝑝 𝐹 = 1Τ4 𝑝 𝐸∩𝐹 =
4
29
Practice 5
• You have a jar with 6 red marbles and 4 blue marbles.
You draw 3 of them from the jar, u.a.r.
➢ Let E be the event where not all marbles are the same
color.
➢ Let F be the event where the first marble drawn is red.
• Are E and F independent?
➢𝑝 𝐹 =
➢ 𝑝 𝐸ത = 𝑝 𝐸 =
➢𝑝 𝐸 ∩ 𝐹 =
• Not independent!
30
Practice 5 Solution
• You have a jar with 6 red marbles and 4 blue
marbles. You draw 3 of them from the jar, u.a.r.
➢Let E be the event where not all marbles are the same
color.
➢Let F be the event where the first marble drawn is red.
• Are E and F independent?
➢𝑝 𝐹 = 6Τ10
6
+ 43
➢𝑝 𝐸ത = 3
10 = 1Τ5 𝑝 𝐸 = 4Τ5
3
➢𝑝 𝐸 ∩ 𝐹 = 3Τ5 ∙ 1 − 5Τ9 ∙ 4Τ8 = 13Τ30
• Not independent!
31
• n = 10: 11.7%
• n = 23: 50.7%
• n = 30: 70.6%
• n = 50: 97%
• n = 70: 99.9%
• n=367: 100%
33
Practice 6
• Consider 2 fair coin flips.
– E1 is the event where the first flip is heads.
– E2 is the event where the second flip is heads.
– E3 is the event where exactly one flip is heads.
• Are these pairwise independent? Mutually
independent?
– p(E1) = p(E2) = p(E3) = 1Τ2
– p(E1 ∩ E2) = p(E1 ∩ E3) = p(E2 ∩ E3) = 1Τ4
– p(E1 ∩ E2 ∩ E3) = 0
• Pairwise, but not mutual.
34
Practice 7
• An integer between 1 and 8 inclusive is chosen
u.a.r.
– E1 is the event that the number is ≤ 4.
– E2 is the event that the number is odd.
– E3 is the event that the number is prime.
• Pairwise independent? Mutually independent?
– p(E1) = p(E2) = p(E3) =
– p(E1 ∩ E2 ∩ E3) =
– p(E2 ∩ E3) =
• Neither!
35
Practice 7 Solution
• An integer between 1 and 8 inclusive is chosen
u.a.r.
– E1 is the event that the number is ≤ 4.
– E2 is the event that the number is odd.
– E3 is the event that the number is prime.
• Pairwise independent? Mutually independent?
– p(E1) = p(E2) = p(E3) = 1Τ2
– p(E1 ∩ E2 ∩ E3) = 1Τ8
– p(E2 ∩ E3) = 3Τ8
• Neither!
36
Bernoulli Trials
• A Bernoulli Trial is a trial with 2 outcomes that
may or may not have equal probability. One
outcome is the success with probability p, the
other is the failure with probability q = 1-p.
• If you have an experiment of n identical
Bernoulli trials, the probability of getting
exactly k successes is:
𝒏
➢ 𝒌
𝒑𝒌 𝒒𝒏−𝒌
• This looks like the Binomial Theorem!
37
Practice 8
• A biased coin has probability of heads 2Τ3.
Given 4 flips, what is the probability of exactly
2 heads?
➢
Practice 8 Solution
• A biased coin has probability of heads 2Τ3.
Given 4 flips, what is the probability of exactly
2 heads?
4 2 2
➢ 2
∙ 2Τ3 ∙ 1Τ3 = 30%
• There are 10 people in line. Each person has a
90% chance of being a pirate, and is otherwise
a ninja. What is the probability of exactly 8
pirates?
10
➢ 2
∙ (1Τ10)2 ∙ (9Τ10)8 = 19%
39
Randomized Algorithms
• Suppose a group of size n got together yesterday, and they’re worried that they
contracted coronavirus during this gathering.
• Let’s say that enough social mingling occurred that if even one person had it, then
each person now has a 10% of having it now.
• You could test everyone from the gathering, but that may not be feasible if testing is
limited.
• Instead, you can test k of the members (chosen u.a.r.), and assert that if no one tests
positive, then no one contracted the virus at the gathering.
• If no one actually contracted the virus, what is the probability you will assert as
much?
– Define success as positive test: P(success)=0
– 𝑝 0 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑜𝑢𝑡 𝑜𝑓 𝑘 𝑡𝑒𝑠𝑡𝑠 = 𝑘0 00 (1)𝑘 = 1 (i.e. 100%)
• If someone did contract the virus, what is the probability you will incorrectly assert
that no one did?
1
– Now P(success)=
10
𝑘 1 9
– 𝑝 0 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝑜𝑢𝑡 𝑜𝑓 𝑘 𝑡𝑒𝑠𝑡𝑠 = 𝑘
( )0 ( )𝑘
10 10
• If k = 66, this is < 0.1%. If k = 132, this is < 0.0001%
40
Randomized Algorithms
• This was an example of a Monte Carlo
randomized algorithm: such an algorithm is
always fast, but sometimes returns the wrong
answer.
– When you get to them in CSCI 104, you will see that a
Bloom Filter is a Monte Carlo data structure.
Simpson’s Paradox
• Alice and Bob are studying for the CSCI 104 midterm. They each do
25 practice problems, split over 2 types (graphs and probability).
• Bob does 5 graph problems, and gets 3 of them right.
• Alice does 20 graph problems, and gets 13 of them right.
• Bob does 20 probability problems and gets 15 of them right.
• Alice does 5 probability problems and gets 4 of them right.
• Bob got a 60% on graphs, Alice got a 65%
(Alice did better).
• Bob got a 75% on probability, Alice got an 80%
(Alice did better).
• Bob got 18 out of 25 problems right, Alice got 17 out of 25 right
(Bob did better overall).
43
Simpson’s Paradox
• A new study promotes the benefits of a specific diet.
• 3 out of 8 of the residents of Roshar survive to age 70
on diet 1.
• 40 out of 90 of Roshar residents survive on diet 2.
• 60 out of 92 of the residents of Tyrea survive to age 70
on diet 1.
• 7 out of 10 of Tyrea residents survive on diet 2.
• 63% of people on diet 1 survive, vs. 47% on diet 2.
• This is not enough information to extol the benefits of
diet 1!
44
Simpson’s Paradox
• 38% of the residents of Roshar survive to age 70
on diet 1.
• 44% of Roshar residents survive on the new diet
(diet 2).
• 65% of the residents of Tyrea survive to age 70 on
diet 1.
• 70% of Tyrea residents survive on the new diet.
• It looks like diet 2 is the better diet! The natural
longevity of Tyreans made diet 1 look better than
it was.
45
BAYE'S THEOREM
46
A motivating problem
• There are two boxes.
• Box 1 contains 2 gold coins and 7 cardinal coins
• Box 2 contains 4 gold coins and 3 cardinal coins
• You choose a box u.a.r.
• From your box, you choose a coin u.a.r.
• You draw a cardinal coin
• What is the probability the coin came from the first box?
47
A motivating problem
• E is the event that you draw a cardinal coin.
• F is the event that you draw from box 1.
• Calculating p(E|F) is easy (7Τ9)
• We want to calculate p(F|E) (much harder!)
48
Bayes Theorem
• Consider:
𝑝(𝐸∩𝐹) 𝑝(𝐹∩𝐸)
–𝑝 𝐹𝐸 = but also 𝑝 𝐸 𝐹 =
𝑝(𝐸) 𝑝(𝐹)
– 𝑝 𝐹 𝐸 ∙𝑝 𝐸 =𝑝 𝐸∩𝐹 =𝑝 𝐸 𝐹 ∙𝑝 𝐹
𝑝(𝐸|𝐹)∙𝑝(𝐹)
–𝑝 𝐹𝐸 =
𝑝(𝐸)
• Bayes’ Theorem:
𝑝(𝐸|𝐹)∙𝑝(𝐹)
–𝑝 𝐹𝐸 =
𝑝(𝐸)
Practice 9
• Say that 10% of the population has coronavirus.
• 85% of those infected display a fever.
• 5% of those who are not infected display a fever
(from other causes)
• You display a fever. What is the probability you
have coronavirus?
• E = you display a fever. F = you have coronavirus.
• p E F = , 𝑝 𝐸 𝐹ത = ,𝑝 𝐹 =
• 𝑝 𝐹𝐸 =
51
Practice 9 Solution
• Say that 10% of the population has coronavirus.
• 85% of those infected display a fever.
• 5% of those who are not infected display a fever
(from other causes)
• You display a fever. What is the probability you
have coronavirus?
• E = you display a fever. F = you have coronavirus.
• p E F = 85%, 𝑝 𝐸 𝐹ത = 5%, 𝑝 𝐹 = 10%
85%∙10%
• 𝑝 𝐹𝐸 = = 65%
85%∙10%+5%∙90%
52
XKCD #1132
Frequentists vs.
Bayesians
54
• A simpler version:
𝑝(𝐸|𝐹)∙𝑝(𝐹)
• 𝑝 𝐹𝐸 =
𝑝(𝐸)
• A more complex version, for any partition of
the sample space
into distinct sets F1, …, Fk :
𝑝(𝐸|𝐹)∙𝑝(𝐹)
• 𝑝 𝐹𝐸 =
𝑝(𝐸|𝐹1)∙𝑝 𝐹1 + … +𝑝(𝐸|𝐹𝑘)∙𝑝 𝐹𝑘
55
Definitions
• A Random Variable is a mapping from the sample space to the set of real
numbers.
• That is, every single outcome is assigned a number.
• If your trial is to flip 3 coins, there are 8 possible outcomes. You could
have a random variable X that calculates the number of heads for each
outcome: X(HHT) = 2, for example
• The distribution of a random variable is the probability of each possible
number.
• So for the above trial:
• 𝑝 𝑋 = 0 = 1Τ8 = 𝑝 X = 3
• 𝑝 X = 1 = 3Τ8 = 𝑝(X = 2)
58
A Dice Problem
• You roll two fair dice. X(t) is a random variable that
outputs the sum of the dice. What is the distribution
of X?
• 𝑝 2 = 1Τ36 = 𝑝(12)
• 𝑝 3 = 2Τ36 = 𝑝 11
• 𝑝 4 = 3Τ36 = 𝑝(10)
• 𝑝 5 = 4Τ36 = 𝑝 9
• 𝑝 6 = 5Τ36 = 𝑝 8
• 𝑝 7 = 6Τ36
59
Expectation
• The Expected Value E(X) of a random variable X is the
average value outputted by X. That is:
➢ 𝐸 𝑋 = σ𝑠∈𝑆 𝑝(𝑠) ∙ 𝑋(𝑠)
• What is the expected value of a fair die roll?
Linearity of Expectations
• 𝐸 𝑋1 + ⋯ + 𝑋𝑛 = 𝐸 𝑋1 + ⋯ + 𝐸(𝑋𝑛)
• 𝐸 𝑎∙𝑋+𝑏 =𝑎∙𝐸 𝑋 +𝑏
• That is, if you want to calculate the expected number of successes
over n trials, you can calculate the expected number of successes
for the 1st trial, and the 2nd trial, and the 3rd trial, etc, and add
them all up.
• What is the expected value of the sum of 3 fair dice?
➢ 3 ∙ 3.5 = 10.5
• Professor Slacker hates grading, and just assigned each student a
grade (A, B, C, or D) u.a.r. If he had actually bothered to grade, he
would have given 25% of students each grade. What is the
expected percentage of students that got the correct grade?
➢ 25%
62
Practice 10
• The ordered pair i,j is an inversion in a permutation of the
first n positive integers if i < j, but j precedes i in the
permutation.
• There are 6 inversions in 3, 5, 1, 4, 2
• 1,3, 1,5, 2,3, 2,4, 2,5, 4,5
• What is the max number of inversions in a list of n positive
integers?
𝑛∙(𝑛−1)
• 𝑛2 =
2
• What is the expected number of inversions in a random
permutation of the first n positive integers?
𝑛∙(𝑛−1)
•
4
63
Insertion Sort
• What is the expected number of comparisons made by Insertion
Sort?
• Let Xi be the number of comparisons to insert the i-th element.
• We want to calculate E(𝑋1 + … + 𝑋𝑛 )
• By Linearity of Expectations, we can just calculate E(𝑋1 ), …, E(𝑋𝑛 )
• E(𝑋1 ) = 0, because the first item is already in the correct position.
• 𝑋2 will always output 1, because we need to compare a1 and a2.
E(𝑋2 ) = 1
• 𝑋3 will always output at least 1.
– If we find it to be the largest element so far, it will only output 1.
– Otherwise we will do another comparison with the smallest element,
and it will output 2.
– There are 2 cases where we do 2 comparisons (smallest and 2nd
smallest)
– E(𝑋3 ) = 2Τ3 ∙ 2 + 1Τ3 ∙ 1 = 5Τ3
65
k∙ k+1 −2
• 𝐸 𝑋𝑘 =
2k
𝑛 k+1 1
• σ𝑛k=1 𝐸(𝑋𝑘 ) = σk=1 − = 𝜃(𝑛2 )
2 2k
66
Hirings
• n applicants are interviewed for a single job
opening, 1 applicant per day.
• The first applicant is automatically hired.
• For every day thereafter, if the current
applicant is better than the current employee,
then the applicant is hired and the employee
is fired.
• What is the expected number of hirings?
67
Hirings Solution
• Let 𝐼𝑘 return 1 if the kth arriving person is hired, and 0
otherwise. We want:
• 𝐸(σ𝑛𝑘=1 𝐼𝑘 ) = σ𝑛𝑘=1 𝐸(𝐼𝑘 )
• E(𝐼1 ) = ___ (the first person is _____________).
• E(𝐼2 ) = ____ (there are __ Ways to (relatively) order the first
2 arrivers and only ____ of them has the best arriving
second)
• E(𝐼3 ) = ___ (there are ___ Ways to (relatively) order the first
3 arrivers and only __ of them have the best one last )
• …
1
• σ𝑛𝑘=1 𝐸(𝐼𝑘 ) = σ𝑛𝑘=1 = (log 𝑛)
𝑘
68
Hirings Solution
• Let 𝐼𝑘 return 1 if the kth arriving person is hired, and 0
otherwise. We want:
• 𝐸(σ𝑛𝑘=1 𝐼𝑘) = σ𝑛𝑘=1 𝐸(𝐼𝑘 )
• E(𝐼1 ) = 1 (the first person is always hired).
1
• E(𝐼2 ) = (there are 2! Ways to (relatively) order the first 2
2
arrivers and only one of them has the best arriving second)
1
• E(𝐼3 ) = (there are 3! Ways to (relatively) order the first 3
3
arrivers and only 2! of them have the best one last )
• …
1
• σ𝑛𝑘=1 𝐸(𝐼𝑘 ) = σ𝑛𝑘=1 = (log 𝑛)
𝑘
69
Hash Tables
• A hash table has k buckets and n items.
• Each item is distributed to buckets u.a.r., and independently from
each other.
• What is the expected number of empty buckets?
• We can figure this out by determining the probability a specific
bucket is empty.
• Let Bi be the event where bucket i is empty.
𝑘−1 𝑛
• p(Bi) = E(Bi) =
𝑘
• We want E(B1 + … + Bk)
𝑘−1 𝑛
• By Linearity of Expectations, this is k ∙
𝑘
• If n = k = 1000, this is about 368. If n =1000 and k = 10000, this is
about 9048.
70
Multiplying Expectations
• If X and Y are independent, then E(X ∙ Y) = E(X) ∙ E(Y).
• If we roll two fair dice and multiply their values, what is
the expected result?
• 3.52 = 12.25
• If we roll one fair die, and square its value, what is the
expected result?
• E(X ∙ X) = E(𝑋 2 ) E(X) ∙ E(X), because X is not
independent from X.
1 2 1 2 1 2 1 2 1 2 1 2
• ∙1 + ∙2 + ∙3 + ∙4 + ∙5 + ∙6 15.17
6 6 6 6 6 6
73
Variance
• The expected value of a random variable tells us the average, but
nothing about how widely its values are distributed.
• If the midterm has an average of 33, it’s possible that everyone got
33, and it’s also possible that half the class got 50 while the other
half got 16. Variance is a metric that measures how widely values
are distributed.
• The variance of X is
2
𝑉 𝑋 = 𝑋 𝑠 −𝐸 𝑋 ∙ 𝑝(𝑠)
𝑠∈𝑆
• 𝑋 𝑠 − 𝐸 𝑋 measures how much individual values vary from the
average.
• Squaring it heavily weights outliers: a large value will be produced if
there are a lot of scores very far from the average.
• An easier way to calculate variance is V(X) = E(X2) - E(X)2
74
Practice 11
• A gambler’s coin has heads on both sides. What is the
variance on the number of heads after n flips?
• X is always n, X2 is always n2, so E(X2) – E(X)2 = n2 – n2 =
0
• That’s what you’d expect.
• What is the variance on the number of successes for a
single Bernoulli trial?
• pr(X = 1) = p
• E(X) = p ∙ 1 + (1 - p) ∙ 0 = p
• E(X2) = p ∙ 12 + (1 - p) ∙ 02 = p
• V(X) = E(X2) – E(X)2 = p - p2 = p ∙ (1 - p) = p ∙ q
75
Practice 12
• What is the variance on the result of a fair die roll?
𝐸 𝑋 = 3.5
1
𝐸 𝑋 = ∙ (12 +22 +32 +42 +52 +62 ) 15.17
2
6
V(X) = 15.17 − 3.52 2.92
Bienayme’s Formula
• If X1, …, Xn are pairwise independent random
variables, then:
•
V(X1 + … + Xn) = V(X1) + … + V(Xn)
• npq
77
Standard Deviation
• The standard deviation of a random variable is
the square root of its variance.
• This is used for test statistics quite frequently.
• If you assume that test scores follow a specific
type of distribution known as the bell curve
(which is often the case for well-constructed
tests), then the standard deviation tells you how
many students fall within a specific range of
scores.
• 94% will fall within +/- 2 standard deviations
• 68% will fall within +/- 1 standard deviations
78
XKCD #221
79
BACKUP
80
Hirings
• Let 𝐼𝑘 return 1 if the kth best employee is hired, and 0
otherwise. We want:
• 𝐸(σ𝑛𝑘=1 𝐼𝑘) = σ𝑛𝑘=1 𝐸(𝐼𝑘 )
• E(𝐼1 ) = ___ (the best employee is always hired).
• E(𝐼2 ) = ____ (there is a ___% chance the best employee
shows up before the 2nd best employee)
• E(𝐼3 ) = ___ (there is a ___% chance the 3rd best
employee shows up
before the best two employees)
• σ𝑛𝑘=1 𝐸(𝐼𝑘 ) =
81
Hirings Solution
• Let 𝐼𝑘 return 1 if the kth best employee is hired, and 0
otherwise. We want:
• 𝐸(σ𝑛𝑘=1 𝐼𝑘) = σ𝑛𝑘=1 𝐸(𝐼𝑘 )
• E(𝐼1 ) = 1 (the best employee is always hired).
1
• E(𝐼2 ) = (there is a 50% chance the best employee
2
shows up before the 2nd best employee)
1
• E(𝐼3 ) = (there is a 33% chance the 3rd best employee
3
shows up
before the best two employees)
1
• σ𝑛𝑘=1 𝐸(𝐼𝑘 ) = 𝑛
σ𝑘=1 = (log 𝑛)
𝑘