Tag: hacking

Understanding Monty Hall dilemma with hacker statistics

Published on: 01.09.2018

With help of hacker statistics, the proof will be provided that in Monty Hall game you should always switch doors because you are doubling (from 33% to 66%) your success rate.

What is hacker statistics

In hacker statistics, you run simulations to calculate the probability of some event.

For example, the probability of the coin toss game is 50% heads, 50% tails.

Let say, for the sake of argument that you do not believe it.

Believe me, there are people who do not believe.

You could calculate the probability and after calculating you would get 50% for heads and 50% for the tails.

But you still do not believe or you think that maybe your calculation is wrong.

Then you can test it in practice.

Take a coin flip it a 100 times(or even a million) divide number of heads with the number of coin flips and the probability of heads is calculated.

As you can see, this is very time-consuming, especially if you want to run the experiment again.

An alternative to the manual coin toss is to write a computer program that will run the simulations and calculate the probabilities.

This is a much wiser approach because you can run it multiple times and it is faster (an average computer can do million of coin toss simulation per second).

Monty Hall game

I heard of Monty Hall game a few years ago in movie 21.

Here is the scene from the movie 21 with Monty Hall described.

Basic idea is that you have 3 doors, behind one door is a car, and behind other 2 doors is a goat.

You can choose only one door of three.

If you chose a door that has a car you get a car if you choose a door with a goat you get nothing (not even a goat).

The goal of the game is to choose a door with a car, but you do not know behind which door is the car.

So you choose some door, and probability for your success is 33%.

Monty Hall dilemma

After you have chosen one door, the game host will open one of the other two doors and goat will be shown.

The dilemma is the following: Is it in your interest to switch door?

The important thing to understand is that the game host will always open one door where is a goat.

Every single time, this will be done even when you choose a door with the prize or if you do not choose.

If the game host was only opening another door when you chose the door with the prize, then the best solution is not to switch the door.

If the game host was only opening another door when you chose the door with the goat, then the best solution is to switch the door.

Point is that every time game host will open another door where is a goat.

The answer to the puzzle is that if you switch door you will win 66% of the time.

This was counterintuitive to my understanding.

The best explanation, that I was able to understand I have found at https://www.youtube.com/watch?v=4Lb-6rxZxx0.

Monty Hall solution with hacker statistics

Altho I understood the math and logic why switching doors provide 66% probability of the win, I still did not believe that it is correct.

So I decided to make the computer program to simulate the game and solve this conundrum once and for all.

I did two simulations with a million iterations each.

The first simulation calculated the probability of win if you did not switch door.

No surprises there, the probability was 33%.

The second simulation calculated the probability of win if you did switch door.

To my amazement at that time, simulation shoved that probability of win if you switch door is really 66%.

Dou to my disbelief, I run it few dozens time, but each time probability of a win was at 66%.

I understood the math behind it, I did the simulation that proved math, but still, I had a hard time accepting that it is correct to switch door because it was counterintuitive to my own(false) reason.

Interesting to mention is that I needed few weeks to accept results of my own simulation.

Some interesting facts on Monty Hall

Wikipedia entry on Monty Hall is extensive.

A lot of interesting facts can be found.

Even experts have a hard time understand it:
“After the problem appeared in Parade, approximately 10,000 readers, including nearly 1,000 with PhDs, wrote to the magazine, most of them claiming vos Savant was wrong (Tierney 1991). Even when given explanations, simulations, and formal mathematical proofs, many people still do not accept that switching is the best strategy (vos Savant 1991a). Paul ErdÅ‘s, one of the most prolific mathematicians in history, remained unconvinced until he was shown a computer simulation demonstrating the predicted result (Vazsonyi 1999).”

One striking sentence is
“Pigeons repeatedly exposed to the problem show that they rapidly learn always to switch, unlike humans”

Are pigeons smarter than humans?

Interactive Monty Hall Game

If you still do not believe that switching door is the best strategy you can play it online.

Just do not switch tab, you will need to wait a few minutes.


In Monty Hall game you should always switch doors because you are doubling (from 33% to 66%) your success rate.