Tikalon Header Blog Logo

The Monty Hall Problem

August 28, 2023

Gort, the humanoid robot from the film, The Day the Earth Stood StillMy wife and I recently watched the classic 1951 science fiction film, The Day the Earth Stood Still.[1] There's a scene in that film in which the robot, Gort, carries the principal female character, played by Patricia Neal (1926-2010), into the flying saucer spacecraft.

This film was directed by Robert Wise (1914-2005), and what's interesting about that particular scene is that Gort's lifting of Neal in order to carry her is hidden by foreground fencing. This is likely because the robot-suited human could carry Neal, but not lift her; so, Wise decided to shoot the scene as he did.

A replica of Gort at the Carnegie Science Center, Pittsburgh, Pennsylvania, via Wikimedia Commons

Directors need to make decisions such as this, and they also need to make decisions to reduce the expense of shooting a scene. When you carefully watch an action television show, you can spot when such decisions have been made, and you're well on your way to your independent film directorial debut. If you've wondered about the overabundance of television game shows, the reason is likewise related to expense. These are inexpensive to produce, and their return on investment is often better than a quality drama. This could be called Gresham's law for media.

Few of my readers will have heard of the television game show, "Let's Make a Deal," hosted by Monty Hall (1921-2017). There's a mathematics problem, the Monty Hall problem, expressed in about fifty words, that was inspired by that show. This problem was succinctly stated by computer scientist, Brian Hayes (b. 1949), as follows:
"You are shown three doors and told that exactly one of them has a prize behind it. After you choose a door, Monty Hall (who knows where the prize is) opens one of the two unchosen doors, showing that the prize is not there. You are then offered a choice: Stick with your original door or switch to the remaining unopened door."[2]

Does your chance of winning increase if you change your choice from your selected door to the other available door? This is a probability problem. Mathematical probability theory has its origins in the very human pastime of gambling. The mathematicians, Blaise Pascal (1623-1662) and Pierre de Fermat (1607-1665), started the study of probabilities in an exchange of letters in 1654. The field was fairly well established in 1713 when the Ars Conjectandi (The Art of Conjecturing) was published in 1713 by Jacob Bernoulli (1655-1654), followed shortly thereafter by the 1718 Doctrine of Chances by Abraham de Moivre (1667-1754).

Pompeian tavern wall painting of dice-players quarreling

Pompeian tavern wall painting of dice-players quarreling.

The eruption of Vesuvius that buried Pompeii occurred in 79 AD, but dice are known to have been used in prehistoric times.

(Wikimedia Commons image, Inventory number 111482 of the Museo Archeologico Nazionale, Naples, Italy. Click for larger image.)

Without Monty's intervention and the opening of one non-prize door, your probability of success is one chance out of three, or 1/3. Does this change after the door is opened and you switch doors? As it turns out, it's always best to switch your choice to the other door, and the reason resides in Bayes' theorem of posterior probabilities. Bayes' theorem allows a revised calculation of probability based on observation. The observation in the Monty Hall case being the fact that the game host was required to open a door, but it must be a door without the prize.[2] Those who change doors increase their probability of winning to two chances out of three, or 2/3.[2-3]

Much has been written about this problem in both the popular and academic press; and, even professional mathematicians, but likely not those with a background in probability theory, thought that the probability was unchanged.[3] Hayes did what any computer scientist would do - he simulated the game. This is something that I did, also, since I'm likewise no expert in probability. No supercomputer is required for this, the simulation program is quite simple, and it gives an answer in mere seconds on my Linux desktop computer.

One such Monte Carlo simulation of a million trials gave 332,418 wins for the steadfast strategy, 667,582 wins for the switching strategy, and a ratio of 2.0083 for switch/stay. I generally use PHP for simple simulations such as this, but Python has become a popular language for beginners. For that reason, I've released source code for both PHP and Python in this zip file. The PHP code runs more than twice as fast, but each language has its little annoyances. I prefer the curly brackets of PHP over the indentation style of Python, but I dislike those PHP dollar signs in variable names.

Sleeping Beauty and her handsome prince

Sleeping Beauty is a fairy tale about a princess cursed to sleep for a hundred years, only then to be awakened by a handsome prince.

An early version of this tale is found in the 14th century chivalric romance, Perceforest.

(The Sleeping Beauty (1876), by Walter Crane (1845–1915), via Wikimedia Commons. Click for larger image.)

There's a similar probability problem, albeit with a very contrived backstory, called the Sleeping Beauty problem, and its solution continues to be debated. The problem is stated as follows:[4]
• A test volunteer, our Sleeping Beauty, agrees to the following experiment:
• On Sunday she will be put into a sleep state.
• Once, or twice, during the experiment, she will be awakened, interviewed, and put back into a sleep state with an amnesia-inducing drug that makes her forget that awakening.
• A coin toss will determine one of two experimental procedures:
   • If the coin toss shows heads, she will be awakened and interviewed on Monday only.
   • If the coin toss shows tails, she will be awakened and interviewed on Monday and Tuesday.
• In either case, she will be awakened on Wednesday, and the experiment ends.
Because of the amnesia drug, our Sleeping Beauty can't tell whether a current awakening is the one after the coin came up heads, or one of the two after the coin came up tails.[4] When interviewed, she's asked her opinion of the probability that the coin toss was heads.

There are two main competing viewpoints on this problem, one called the thirders and the other the halfers.[4] The thirders argue that it's twice as likely she will be asked if the coin comes up tails, and she should answer 1/3 every time she's asked.[4-5] The halfers argue for a probability of 1/2, since our Sleeping Beauty should reason that the probability of the coin flip is 50:50, and her answer should always be 1/2.[4-5] The Sleeping Beauty problem appears to a topic in philosophy rather than mathematics; so, I can't just jump to my computer keyboard to bang out a simulation as I did for the Monty Hall problem.

In a 2020 paper, Michel Janssen of the University of Minnesota (Minneapolis, Minnesota) and Sergio Pernice of the Universidad del Cema (Buenos Aires, Argentina) claim a solution to the Sleeping Beauty problem by casting it in terms of the Monty Hall problem.[5] Unfortunately, they write that both the halfers and the thirders are right, because of the ambiguity of the question that our Sleeping Beauty is being asked.[5] They cite an equivalence between Monty's opening of one door and our Sleeping Beauty's being told at the start of the experiment how the coin-tossing decisions are made.[5]


  1. The Day the Earth Stood Still (1951), Robert Wise, Director, on the Internet Movie Database.
  2. Brian Hayes, "Programs and Probabilities," American Scientist, vol. 96, no. 4 (July-August, 2008), p. 334.
  3. Brian Hayes, "Monty Hall Redux," American Scientist, vol. 96, no. 5 (September-October, 2008), p. 434.
  4. André Luiz Barbosa, "A Little Reflection about the Sleeping Beauty Problem," arXiv, July 11, 2023.
  5. Michel Janssen and Sergio Pernice, "Sleeping Beauty on Monty Hall," Philosophies, vol. 5, no. 3 (August 13, 2020). PDF files appear here and here.

Linked Keywords: Wife; classic; science fiction film; The Day the Earth Stood Still; robot; Gort; female; character (arts); Patricia Neal (1926-2010); flying saucer spacecraft; Robert Wise (1914-2005); scene (film); lifting; carry; hidden; fence; costume; robot-suit; human; photo shoot; replica; Carnegie Science Center; Pittsburgh, Pennsylvania; Wikimedia Commons; expense; contemplation; careful; action fiction; television program; television show; independent film; debut; game show; video production; produce; return on investment; quality (business); drama; Gresham's law; mass media; Let's Make a Deal; television presenter; host; Monty Hall (1921-2017); mathematics; Monty Hall problem; word; artistic inspiration; inspired; computer scientist; Brian Hayes (b. 1949); door; prize; probability; probability theory; pastime; gambling; mathematician; Blaise Pascal (1623-1662); Pierre de Fermat (1607-1665); letter (message); Ars Conjectandi (The Art of Conjecturing); Jacob Bernoulli (1655-1654); Abraham de Moivre (1667-1754); Pompeian tavern wall painting of dice-players quarreling; Pompeii; tavern; wall painting; dice-player; disagreement; quarrel; eruption of Mount Vesuvius in 79 AD; bury; buried; prehistory; prehistoric times; National Archaeological Museum, Naples; Museo Archeologico Nazionale, Naples, Italy; intervention; Bayes' theorem of posterior probabilities; calculation; observation; victory; win; popular press; academic press; profession; professional; computer simulation; simulate; supercomputer; Linux; desktop computer; Monte Carlo method; Monte Carlo simulation; strategy; PHP; Python (programming language; annoyance; curly bracket; indentation style; dollar sign; variable (computer science); name; Sleeping Beauty; fairy tale; princess; curse; cursed; sleep; century; hundred years; physical attractiveness; handsome; prince; 14th century; chivalric romance; Perceforest; Walter Crane (1845–1915); Wikimedia Commons; backstory; Sleeping Beauty problem; debate; human research subject; test volunteer; experiment; Sunday; amnesia; fair coin; coin toss; coin heads; Monday; coin tails; Tuesday; Wednesday; philosophy; computer keyboard; Michel Janssen; University of Minnesota (Minneapolis, Minnesota); Sergio Pernice; Universidad del Cema (Buenos Aires, Argentina); ambiguity; logical equivalence.