Door 2 now has a 2/3 chance
This post “Monty Hall Solution” continues on from my previous post Monty Hall Problem – Can You Solve This Maths Puzzle? If you haven’t read that post, then read it now before reading this. Because I will now show you even more Monty Hall Solution coolness! We saw that you could increase (double) your chances of winning a car by understanding some maths, so let’s delve further into it and who knows, you might win something big (then again you might not, but hey!).
So what happens, if there are 4 doors instead of 3 doors? And what happens if there are 5 doors, 6 doors, hmmm, more code required – cool!
Checkout the code here Alan Cowap GitHub.
Does The Monty Hall Solution Hold True For 4 or More Doors?
For 4 doors we would expect that the odds would be 1/4 (25%) for not changing Vs 1.5/4 (37.5%) for changing. “How did you get those figures?” I hear you ask. Well, with 4 doors, each door has a 25% chance of being correct. Our 1st chosen door has a 25% chance – the other 3 doors have a combined 75% chance. When Monty removes one of those 3 doors by opening it -the remaining 2 doors still have a combined 75% chance – which is now divided by the 2 remaining doors i.e. 37.50% chance each. Once again the figures from the 70 million simulations are very precise.
Doors in Game: 4
Unchanged Wins: 2498993, Changed Wins: 3750566
Unchanged Wins: 24.99%, Changed Wins: 37.51%
Unchanged Wins: 2498720, Changed Wins: 3750419
Unchanged Wins: 24.99%, Changed Wins: 37.50%
Unchanged Wins: 2500812, Changed Wins: 3748980
Unchanged Wins: 25.01%, Changed Wins: 37.49%
Unchanged Wins: 2499171, Changed Wins: 3747829
Unchanged Wins: 24.99%, Changed Wins: 37.48%
Unchanged Wins: 2499602, Changed Wins: 3749207
Unchanged Wins: 25.00%, Changed Wins: 37.49%
Unchanged Wins: 2497548, Changed Wins: 3748332
Unchanged Wins: 24.98%, Changed Wins: 37.48%
Unchanged Wins: 2499206, Changed Wins: 3749860
Unchanged Wins: 24.99%, Changed Wins: 37.50%
Monty Hall Solution with 5 Doors?
The Monty Hall Problem
The Monty Hall Problem is an interesting Maths Puzzle – with a hotly disputed answer. Monty Hall is a well known American TV Show presenter, and this particular maths puzzle gained some notoriety on his TV Show – hence the name “Monty Hall Problem”. The puzzle is quite simple to understand, but as is so often the case it is a little more tricky (and fun) to figure out the answer.
World famous mathematicians have gone to their grave disputing the answer. But I’ll explain it in easy to understand language, and demonstrate a proof using a computer simulation I wrote which played no less than 70 million games. The source code for the simulation is available here Alan Cowap GitHub so you can review it yourself 🙂
Show Me The Monty Hall Problem Puzzle!
Monty shows you 3 doors which are closed. You are told that behind one of the doors is a car, behind the other 2 doors lies a Goat. If you choose the correct door you win the car. The doors are labelled 1, 2, and 3. Let’s say you choose Door 1. In an unexpected twist Monty opens say Door 3 – behind which stands a goat! Monty then asks you “Do you want to stick with Door 1, or do you want to choose Door 2 instead?”.
So do you stick or twist? You can stick with Door 1 or try your luck with Door 2. Monty is waiting. Your heart is racing. The crowd are shouting in equal measure “Door 1” and “Door 2”, some jokers are even shouting “Door 3” ]:> 😀
Show Me The Monty Hall Problem Answer.
Not so fast. The fun is figuring out the correct answer – if there is a correct answer. What I’m going to do is put forward an answer and explanation, then I’ll write a software program to simulate this scenario 70,000,000 (70 million) times and see if it agrees with my proposed answer. Is it better to stick or to twist – or does it make any difference? I’ll share the results (and the code) of this simulation with you. In the meantime, you can try to solve the puzzle by yourself. But before that, I’ll propose an answer – spoiler alert – don’t read the next paragraph if you don’t want to see the proposed answer.
The Monty Hall Problem Answer (SPOILER ALERT)
Ok then, you’ve racked your brains and thought through all sorts of statistical slight-of-hand and complex combinations and permutations and convinced yourself you have the correct answer. Stick or twist? Well , it turns out you should have … Continue reading
Can you solve the Snake Puzzle?
Maths Puzzles may not be everyones cup of tea, but I love puzzles and I love maths (and cups of tea). You can already see where this is going, right. Anyway I came across this simple enough puzzle and inevitably I started thinking about how to solve it. I say it’s simple because it only involves the numbers 1 to 9 with addition, subtraction, multiplication, and division. So, how hard can it be? Well…
Rules of the Puzzle
- You must use the numbers 1 to 9 inclusive
- Each number can only be used once
- Note that : symbolises division
This type of puzzle is one of my less favoured types of puzzle because it’s solved mostly through trial and error, with just a sprinkling of inspiration. I prefer puzzles that are solved through some (optionally mind-bending) inspirational insight. Eureka moments, I like them, they’re a natural high. But what can make this simple type of puzzle more interesting is to take it to another level. How? First, you can calculate how many permutations there are, i.e. how many different ways can 9 numbers be uniquely ordered. The answer is there are 362,880 permutations for 9 numbers (where there is no repetition, and order is important). Suddenly this simple puzzle doesn’t seem so simple. Another interesting twist is to calculate how many possible solutions there are, you didn’t assume there was just one possible answer did you? Oh dear, never assume! Hint: There is more than one solution, a lot more. I found 128 solutions.
You’re probably wondering how I found that many solutions and how long it took me to find them. It took less than 200 milliseconds to find all 128 solutions. That’s the power of writing software to do the donkey work for you 🙂 Writing the code took an hour or so and that was a much more enjoyable puzzle to solve, than manually solving the puzzle.
Get the Sourcecode
You can view and use the sourcecode which I have provided on GitHub under the GPLv2. Comments welcome, especially if you can see and errors or improvements. Enjoy!
View the Solutions
Below are a list of all 128 valid solutions. First number goes in the top-leftmost square and insert the numbers in order. Easy peasy.
I have also created a Google Sheet with the answers and formula on so you can check your answers. You can view and download the Answer sheet too.