From Lupyan Lab
Jump to: navigation, search

Monty Hall Problem


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 No. 1 [but the door is not opened], and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice?

  1. Write a numeric simulation of the monty hall problem and calculate the probabilities of winning if you switch and if you stay.

Solution to the monty hall simulation

The birthday paradox

What is the probability that of n people in a room, some pair will have the same birthday?


Write code to find a numerical approximation to the Birthday Problem through simulation of n people walking into a room.

  1. What is the probability that in a room of n people, at least two share a birthday?
    • You'll want to write a function or several functions which when given n, output the likelihood that any two people in the group share a birthday.
    • Hint: start with thinking about two people walking into a room…
  2. What is the least number of people necessary for the probability to reach 50%?

Solution to the birthday problem

Personal tools
Download and Install
Notes for each class - will be updated ~week before each class.
Programming Exercises
Quick reference