Monty Hall - The True picture with Simulation

Many of you might have come across the Monty Hall problem . Here is the wikipedia definition of the problem

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. 2, which has a goat. He then says to you, "Do you want to pick door No. 3?" Is it to your advantage to switch your choice? - Wikipedia

Although it's relatively easy to have an intuitive idea of the solution at times its hard to break it down into its more probabilistic form. This problem primarily arises in our inability to grasp the underlying constraints the problem has to adhere to. Here is my humble effort to explain the Monty Hall problem using Bayes theorem followed by a simulation of the same.

Let the variable denote the door behind which the prize (the car) might be present.  Since each of the door is equally likely to contain the prize hence where denotes the probability of the prize(car) behind the door number .

Similarly, let the random variable denote the host's choice of the door and hence denotes the probability of the host choosing the door number We are given that the contestant chooses the door 1. Since the contestant chooses the door 1 the host is restricted to open either of the door 2 or 3 with equal probability. Hence the probability of host choosing different doors are as below  Now if the actual prize is behind door 2, in that case the host will always open 3 since the host will open a door that doesn’t reveal the prize. This gives us the conditional probabilities  Similarly, if the prize is behind door 3, the conditional probabilities we would have are as below  Also, if the actual prize is behind door 1, the host can choose either 2 or 3 with equal probability unless the host has any bias towards any door. The conditional probabilities would be given by Now given that the host has opened door 2, we would have to evaluate the contestant's winning probability in sticking to door 1 (initial door) and in switching to door 3. The probability that the actual door that holds the prize is door 1 given that the host has opened door 2 is given by   So, we see that if the contestant sticks to door 1 he/she has a chance of winning.

Now let’s calculate the probability of the actual door being 3 given the host has chosen door 2   So, given the host has opened door 2, the probability of the door 1 hiding the prize is while that for door 3 is . Hence the contestant has a better chance of winning the car by deciding to switch to the other closed door.

Below is the simulation of the Monty Hall problem with the Contestant holding on to the original door followed by Monty Hall Simulation where the contestant do chose to switch to the other door.

We can see from the above simulations also the chances of winning is almost double if one chooses to switch to the other door instead of holding on to the original door.