# Monty Hall Paradox and Excel

Unhappy are those people who cannot program at least at the Excel formula level! For example, they will always think that the paradoxes of probability theory are the quirks of mathematicians who are unable to understand real life. Meanwhile, probability theory just models real processes, while human thought often cannot fully understand what is happening.

Take the Monty Hall paradox, here is his wording from the Russian Wikipedia:
Imagine that you became a participant in a game in which you need to choose one of three doors. There is a car behind one of the doors, goats behind two other doors. You select one of the doors, for example, number 1, after which the host, who knows where the car is and where the goats are, opens one of the remaining doors, for example, number 3, behind which the goat is located. After that, he asks you if you would like to change your choice and choose door number 2. Will your chances of winning a car increase if you accept the host’s offer and change your choice?

(in this case, the participant of the game knows the following rules in advance:
1. the car is equally likely to be placed behind any of the 3 doors;
2. in any case, the leader must open the door with the goat (but not the one chosen by the player) and invite the player to change the choice;
3. if the presenter has a choice which of 2 doors to open, he chooses any of them with the same probability)

At first glance, the odds should not change (sorry, for me this is no longer a paradox, and I can no longer come up with the wrong explanation why the odds will not change, which at first glance would seem logical).

Usually, the narrators of this paradox begin to engage in complex reasoning or overwhelm the reader with formulas. But if you can even program a little, you don't need it. You can conduct modeling experiments, and see how often you win or lose with a particular strategy.

Indeed, what is probability? When they say "with this strategy, the probability of winning is 1/3" - this means that if you conduct 1000 experiments, then in about 333 of them you will win. That is, in another way, the chances of “1 out of 3” are literally one of three experiments. “2/3 probability” is exactly the same in two out of three cases.

So, let’s do a Monty Hall experiment. One experiment easily fits into one line of the Excel table: here it is (the file is worth downloading to see the formulas), I will give a description of the columns here:

A. Experiment number (for convenience)

B. Generate a random integer from 1 to 3. This will be the door behind which the

CE car is hidden . for clarity, I placed “goats” and “cars”

F in these cells . Now we select a random door (in fact, you can always choose the same door, because randomness in choosing a door for a car is already enough for the model - check!)

G. The host now selects the door from the two remaining to open it to you

H. And here the most important thing: he does not open the door, behind which the car, and if you initially showed the door with a goat, it opens the other only possible door with a goat! This is his tip for you.

I. Well, now let's calculate the odds. Until we change the door - i.e. let's count the cases when column B is equal to column F. Let it be “1” - won, and “0” - lost. Then the sum of the cells (cell I1003) is the number of wins. You should get a number close to 333 (we do 1000 experiments in total). Indeed, finding a car behind each of the three doors is an equally probable event, so choosing one door, the chance to guess is one of three.

J. It will be not enough! We change our choice.

K. Similarly: “1” is a win, “0” is a loss. And what in total? And in total we get a number equal to 1000 minus the number from cell I1003, i.e. close to 667. Does this surprise you? But could something else happen? After all, there are no other closed doors! If the originally selected door gives you a win in 333 cases out of 1000, then another door should give a win in all remaining cases!

Do you understand me now, why am I not seeing a paradox here? If there are two and only two mutually exclusive strategies, and one gives a gain with probability p, then the other should give a win with probability 1-p, what is this paradox?

If you liked this post, now try to build a similar file for the paradox of boys and girls in the following wording:
Mr. Smith is the father of two children. We met him walking along the street with a little boy whom he proudly introduced to us as his son. What is the likelihood that the other child of Mr. Smith is also a boy?

Greetings from sunny Vietnam! :) Come to work with us! :)