Loading...
Random Pearls Random Pearls New Menu
  • All Pearls
    • Random Pearls
  • Tools
    • Tools  (parent page)
    • Reference  (parent page of Tools)
  • New Menu
  • Authors
  •  
  • Contact Us
  • Sign up
  • Login
    Forgot Password?
  • Follow us on
Image Back to Top Back to top
Language Preference
This website has language specific content. Here you can set the language(s) of your preference.

This setting does not affect the current page. It is used only for filtering pages in menus, preview tiles and search results.

It can be changed any time by using the login menu (if you are logged in) or by clicking the Language button on the left bottom of the page.
Log in to save your preference permanently.



If you do not set this preference, you may see a header like This page has 'language_name' content in page preview tiles.
Search
  • Navigation
  • Similar
  • Author
  • More...
You are here:
All Content / Reference / Tools / Monty Hall Paradox Test Tool
Table of Contents

Subscribe to Our Newsletter
Follow us by subscribing to our newsletter and navigate to the newly added content on this website directly from your inbox!
Login to subscribe to this page.
Categories  
Tags  
Author  
manisar
Author's Display Image

"Whenever you can, share. You never know who all will be able to see far away standing upon your shoulders!"

I write mainly on topics related to science and technology.

Sometimes, I create tools and animation.


Monty Hall Paradox Test Tool

Oct. 25, 2020

Author - manisar



Monty Hall Doors

Though generally described for 3 doors, the more generalized version as explained in this page can help us understand why it works.

In the tool given on here, we can modify the total number of doors (n), the doors selected by the host (y), then the doors opened from those selected doors (x), and the total number of winning doors (t).

The Monty Hall problem is a very simple yet very interesting paradoxical question. I gave the wrong answer when I came across it for the first time.

I decided to dive deeper, and came up with this generalized tool that makes the computer play against itself thousands of times, and visually shows its results for different number of doors and the different strategies. By tweaking the number of total, opened and winning doors below and looking at the doors and the results, we get both the proof and a feel of why it must be true. If you want to look at the equations first, check The Monty Hall Paradox Probability Equations.

A quick recap from Wikipedia...

The Monty Hall problem is a brain teaser, in the form of a probability puzzle, loosely based on the American television game show Let's Make a Deal and named after its original host, Monty Hall.

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, 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?

So, basically there are three strategies for the player to select from (have a look at The General Case on this page).

  1. Strategy 1: The player sticks with his choice (the door that he had earlier selected).
  2. Strategy 2: He takes it as a new game from this point onward, i.e. he forgets what has happened hitherto (including the choice he had made), and now randomly selects a door from the two remaining closed doors.
  3. Strategy 2: He selects the other door.

If you hit the Play button below, the background python service plays this game applying all the three strategies separately. It does 100 runs of 1000 iterations each, and shows the winning frequency according to all the three strategies. Try it!

Run it for different numbers of doors as well. After a few runs and comparing the results between the three strategies in each run, we start to see a pattern in their relative strengths (e.g. strategy 3 winning probability is directly proportional to the size of the y-group (brown doors) as a whole - the bigger the y-group, the more are its winning chances).
See if you can start predicting the relative ratio of wins in the three strategies. It's even possible to generalize the formulae to include multiple winning doors (t). Elsewhere on this page, you'll find the formulae for finding this ratio for any n, y, x and t.

You can manipulate y and x sets by clicking on the doors below as well. Modifying t makes a trivial difference - all probabilities get inflated by t. Lastly, I'm not using a goat for showing losing, it may as much be a prize for Salim as a car (ref: You Don't Mess with the Zohan)!
Description of Doors
Door Opened by Host Door Selected by Host Door Selected by Player Door not Selected by Host or Player
Strategy 1 Wins:Strategy 2 Wins:Strategy 3 Wins

Strategy 1: Bet on a door from green or red ones (i.e. from n-y doors) - shown above
Strategy 2: Bet on a door from all the closed ones (i.e. from n-x doors)
Strategy 3: Bet on a door from the closed brown doors (i.e. from y-x doors)
Strategy 1 Wins

Strategy 2 Wins

Strategy 3 Wins


Iterations
Strategy 1 Wins:Strategy 2 Wins:Strategy 3 Wins
Note: Because of server-load issues, please do not fire multiple repeated requests, especially, of those with n greater than 20. Such requests will be rejected after being served a few times.
Credits: I took clues from css-tricks.com for making the chart and increment-decrement buttons, and codepen.io for door open-close mechanism. Long live the giants! I'll always need their shoulders.
Advertisement
Advertisement
Close ad Ad

What Actually Makes the Difference?

The key is to identify the fact that the non-winning door is not opened from all the doors at random, instead it is opened (and thus removed) from a specific proper subset of two doors that excludes the player's initial choice. This gives that set an unfair advantage, and that is what this is all about.

For more insight, read the If You are still Confused section in The Monty Hall Paradox Probability Equations.

The General Case

By generalizing this problem for the number of doors, we'll see how we can get a feel of how it works.

If, instead of 3 doors, let's say we have n doors. And the player selects one door. Now, before opening this door, the host selects a subset of doors from n (say, y) and then opens x doors from these y doors. Now the question for the player, in the general form, would be to select one from the following three strategies:

  1. Strategy 1: The player sticks with his choice, or makes a selection from n-y doors.
  2. Strategy 2: He forgets what has happened hitherto (including the choice he had made), and now randomly selects a door from (n-y) + (y-x) = n-x, i.e. from all the currently remaining unopened doors.
  3. Strategy 3: He selects a door from y-x (and not n-x) unopened doors.

By looking at 2 and 3 above, it becomes quite clear why 3 is better than 2. It's simply because y-x is a smaller number than n-x, and hence selecting a door from y-x doors will have greater chance of winning.

But why is 1 the poorest choice?

The answer is that a group of doors (here, y) has a bigger probability of winning than a single door. The group y has a winning chance of y/n, as compared to 1/n for a single door. Now, if no door has been opened in y, within y, a single door within y has a winning probability of 1/y. So, the combined winning probability of a door in y becomes y/n * 1/y = 1/n. So far so good.

But if x doors have been opened from y doors with no prizes behind them, all the winning probability of the y group now comes to the remaining y-x doors in y. So, now, the winning probability of a single door in y becomes y/n * 1/(y-x) = (y/(y-x)) * 1/n. We see that this number is bigger than 1/n. Hence, strategy 3 is better than 1.

Finally, if the user just randomly bets on a door from all the remaining unopened doors (strategy 2), his chances are simply 1/n-x. A little algebra between (y/(y-x)) * 1/n, 1/n-x and 1/n shows the relative magnitude of each, which is : Strategy 1 < Strategy 2 < Strategy 3. In fact, I'm leaving this as an exercise for the reader to verify that the actual winning ratio among the three strategies as shown by the tool is same as 1/n : 1/n-x : (y/(y-x)) * 1/n (for number of winning doors t > 1, t replaces 1 in the numerator of each of these). Or, if you are in a hurry, have a quick look here.

If you make n = 10 and y = 9, and x = 8 (with t = 1) in the tool on this page, you'll clearly see why selecting a door from the y subset is the smartest choice! And then hit Play to seal the deal.

Advertisement
Close ad Ad
Open this page

Deriving the Equations

The Monty Hall Paradox Probability Equations LearnMathematics

Let's derive the probability equations that govern the predictions of the famous Monty Hall problem. Doing it for generalized number of total, closed and open doors gives us a better understanding and deeper satisfaction!

Location: All Content / Science and Technology / Mathematics
From the page
Page Preview Image

Advertisement
Close ad Ad

Return to Tools

Tell us what you think (select text for formatting, or click )

Copyright © randompearls.com 2020

Privacy Policy