Imagine standing in front of three doors, knowing that behind one of them is a car, and behind the other two, goats. This scenario, known as the **Monty Hall Problem**, has intrigued and confounded people for decades. The Monty Hall Problem, named after the host of the television game show “* Let’s Make a Deal*,” Monty Hall, introduces a fascinating aspect of probability that often defies intuition.

Table of Contents

Looking for comprehensive study materials on Python, Data Structures and Algorithms (DSA), Object-Oriented Programming (OOPs), Java, Software Testing, and more?

# Monty Hall Problem with Bayes Theorem

Imagine you’re invited into a game show for a chance to win a fancy new car. The rules are simple:

**Out of a given number of doors, choose correctly the one where the car stands behind it. In front of you, there are three doors.**

You begin by choosing one door. The host, Monty Hall, proceeds to open one of the remaining doors. Monty ***never* **opens a door where the car is, instead, he always opens a door and reveals that behind it is a goat. After doing so, you’re given the chance to choose from:

a) Open the originally selected door

b) Switch to the other unopened door

Our initial intuition is to think that these options are equiprobable — 50% chance of winning either way — since we are left with the two remaining unopened doors.

In this article, we’ll take a look at the demonstration of why the statement above is untrue and how to solve this problem.

# Conditional Probability

Conditional probability is a measure of the probability that an event occurs given that another event has also occurred.

It is often stated as the probability of *B *given *A* and is written as* P(B|A)*, where the probability of *B* depends on that of *A* happening, and it is given by the fraction of probability B that intersects with *A*:

If the two events are independent — knowledge about either event does not alter the likelihood of each other — then, the conditional probability of *B *given *A *is simply the probability of *B*, *P(B|A) = P(B)*.

# The Bayes’ Theorem

Bayes’ theorem **allows you to update the predicted probabilities of an event by incorporating new information.**

While conditional probabilities can provide extremely useful information, limited information is often supplied or at hand. Therefore, it can be useful to reverse a condition probability using Bayes’ theorem.

Note that *P(A∩B)* is the probability of both *A* and *B* occurring, which is the same as the probability of *A* occurring times the probability that *B* occurs given that *A* occurred. It is also the same as the probability of *B* occurring times the probability that *A* occurs given that *B* occurred.

If *{Bn: n = 1,2,3,…}* is a finite or countably infinite partition of Ω, i.e., a set of disjoint events whose union is Ω, then for any event *A *of the same probability space, the **Law of Total Probability** gives:

We can see in the image below, that *B1, B2, .., B6 *are disjoint events, and to access the probability of *A*, we can sum its intersects with each portion *Bn*.

Thus, Bayes’ Theorem gives us the **posterior probability **— after taking into consideration new information, i.e., the event *A* occurred — by updating the prior probability, and the denominator can be written using the Law of Total Probability.

# So, should we switch doors?

The Bayes’ Theorem describes the change in probability of a given **hypothesis** based on new information.

In this case, it’s the probability that our initial guess was the right choice (that is, the chosen door has a car behind it), given that the host showed another door with a goat behind it (that is, one of the remaining door was the wrong choice).

Suppose our initial guess was door number 1, and Monty Hall revealed that behind door number 3 there is a goat.

At first, all doors hold the same probability of having a car behind it, 1/3, as there are only one car and two goats.

Let *H *be the hypothesis “behind door 1 has a car”, and *E *be the evidence given by the host that behind door 3 there is a goat. Then, we can calculate the conditional probability *P(H|E)*.

*P(H)*: the prior probability that “behind door 1 has a car” = 1/3

*P(E|H)*: the probability that behind door 3 there is a goat, given that behind door 1 there is a car. The two events are independent, and the probability that behind door 3 there is a goat is equal to 1, as Monty always opens a door with a goat behind.

*P(E)*: can be written as the sum of the intersect *E∩H* and *E∩Hc*, as the union of *H *and* Hc* (complementary event) is 1, i.e., Ω.

*P(Hc)* = 1- *P(H)* = 1- 1/3 = 2/3

We now have our posterior probability that “behind door 1 has a car”. We used Bayes’ Theorem to update our prior probability using new information given by the host. We before had a 33.3% chance of winning a car by choosing door 1, and after Monty opened door 3, the chance was still 33.3% and not 50% as our intuition would have guided us! That means that our complementary event, “behind door 1 does not have a car”, i.e., “behind door 2 has a car” has a probability of 66.7%. The numbers are in favor of door number 2!

If you’re still on the fence about the choice, we can look at all the possible scenarios, shown in the table below:

The table shows that in all scenarios, switching to the door offered by the host gives us a 2/3 chance of winning, while staying at the originally selected door gives us a 1/3 chance of winning.

Another way to visualize this is to take the possible outcomes of door number 1 and the remaining pair (door 2, door 3).

There is a chance of 1/3 that door 1 has a car, and 2/3 there is a goat, so it’s more likely we’ll get a goat in the beginning. On the other hand, looking at the pair (door 2, door 3), the chance of the outcome (goat, car) is 2/3 and the outcome (goat, goat) is 1/3, so it’s more likely that the car is on either door 2 or door 3.

When Monty opens door number 3, those same probabilities remain true: door 1 has a car behind it with probability of 1/3, while one of (door 2, door 3) has a car behind it with a probability of 2/3, and since we know that the car is not behind door 3, this probability is now of door 2 alone.

# Conclusion

In conclusion, the Monty Hall Problem, coupled with the Bayes Theorem, serves as a captivating journey through probability, decision-making, and the intricacies of human cognition. Embracing the complexities of this scenario enriches our understanding of randomness and choice.

# FAQs

**Is the Monty Hall Problem applicable in real-life situations?**- Yes, the principles of the Monty Hall Problem can be applied to decision-making scenarios involving uncertainty.

**Why is the Monty Hall Problem considered counterintuitive?**- The counterintuitive nature arises from the surprising impact of Monty’s revelation on the initial probability.

**Are there variations of the Monty Hall Problem?**- Yes, theoretical variations explore different setups, adding depth to the problem.

**How does the Monty Hall Problem relate to cognitive science?**- The problem offers insights into decision psychology and cognitive biases.

**Where can I learn more about the Monty Hall Problem and Bayes Theorem?**- Explore reputable educational resources and textbooks for in-depth knowledge.