Discussion 2: Calculating probabilities#
A coincidence?#
Probabilistically model a coincidence from your own life.
- Does the experiment model the coincidence well? 
- Does this remind you of any of the coincidences we studied in class? 
Monty Hall#

Rules of the Monty Hall game:
- There are three doors, two of them hide goats, one hides a prize. 
- The player picks a door. 
- The game show host opens one of the other doors to reveal a goat. 
- The player has to decide if they stay or switch. 
Class poll: what is the optimal strategy, stay or switch? Or, does it not matter?
Which strategy is best?#
We’ll do an experiment to evaluate whether it is a better strategy to switch. Let’s check if switching wins significantly more than 1/2 of the games.
Each pair of students has three cards:



How could these cards be used to simulate the probability of winning if you switch?
goat
car
goat
- With your partner, designate one person as the contestant and the other as Monty. 
- Monty fans the cards, contestant picks one, Monty reveals one of the others as a “goat”. 
- Contestant switches to the other card. What prize do they win? 
- Swap roles and repeat, playing at least 12 games. 
Data entry#
How many games did you play? How many games did the player win?

Data analysis#
What is the probability that the player won \(\ge \frac{7}{12}\) of the games, if switching is no better than staying?
If switching is no better than staying, then the probability of winning each game is \(\frac{1}{2}\).
If \(n\) games were played in total, then the number of wins is modeled by the number of heads you get when you flip a coin with heads probability \(\frac{1}{2}\) a total of \(n\) times.
We can use the computation from class yesterday to compute the probability of the event \(A\) that the number of heads is \(\ge \frac{7}{12} \cdot n\). We have that $\( \Pr[A] = \Pr[\text{ # heads }\ge \frac{7}{12} \cdot n] \)$
import math
for n in range(12,160,12):
    m = n * 7 // 12 # divide and round to nearest integer
    s = sum([ math.comb(n,k) * (1/2)**n for k in range(m,n)])
    print("in ", n, "games, probability of winning >= 7/12 of games is", s)
in  12 games, probability of winning >= 7/12 of games is 0.386962890625
in  24 games, probability of winning >= 7/12 of games is 0.27062803506851196
in  36 games, probability of winning >= 7/12 of games is 0.20251612305582967
in  48 games, probability of winning >= 7/12 of games is 0.15616340373663107
in  60 games, probability of winning >= 7/12 of games is 0.12253041651147285
in  72 games, probability of winning >= 7/12 of games is 0.09725258293369954
in  84 games, probability of winning >= 7/12 of games is 0.07782823185699857
in  96 games, probability of winning >= 7/12 of games is 0.06267284859424625
in  108 games, probability of winning >= 7/12 of games is 0.05071636752055249
in  120 games, probability of winning >= 7/12 of games is 0.04120373966376328
in  132 games, probability of winning >= 7/12 of games is 0.03358518527445267
in  144 games, probability of winning >= 7/12 of games is 0.027450936248664178
in  156 games, probability of winning >= 7/12 of games is 0.022490082094521916
Given what we observed, does it seem likely that switching is better?
Why is switching better?#
Claim: The probability of winning if you switch is \(\frac{2}{3}\).
TA and class work through the mathematical analysis of Monty Hall.
