# Monty Hall/Game Show problem

jacobkoshRegistered User regular
edited July 2008
For you to explain this to me, I figure you should probably already be familiar with it, so I won't go into detail. However I'll give a short synopsis (and yes I became interested in the problem because of the scene in the movie 21 but I have researched it beyond that and it still makes my head hurt).

You're on a game show. Before you are three doors. Behind one of the doors is a car and behind the other two: goats. You're asked to select a door. [I want to add here that I fully understand that whatever choice you make at this point, your chance of being correct is 33.3 percent.] Now, you've made your choice, It is at this point that you realize a new condition: the game show host is cognizant of the car's location. He decides to open one of the doors that houses a goat. So, there were three options, one winning and two losing. However the host has eliminated one of the losing options. You now have one winning and one losing selection left.

The 'solution' to the problem is now that the host has revealed the location of one of the losing selections, it's in your interest to switch (e.g. if you pick door 1, he reveals door 3 to be a goat, it's in your interest to switch from 1 to 2). This is what I don't understand. According to Wikipedia a lot of people were flabbergasted like me that you had a better chance by switching (as apparently switching increases your odds to 66.7 percent). I understand that I'm wrong but not how I'm wrong.

I had a 33.3 percent chance. One of the wrong choices was eliminated, so there's now one winning and one losing proposition. Why is it not 50 percent regardless of whether or not I switch?

My brain is so fried right now. I've read the Wiki page a couple of times now and my mind is just numb. I'm going to go take a walk or something.D:

Organichu on
«13

## Posts

• Registered User regular
edited July 2008
You're asked to choose a door:

There are 3 choices each with 2 possible outcomes:

(after your initial choice one goat door is revealed, you then change or stick)

- You choose a goat:
Stick = goat
Change = car

- You choose a goat:
Stick = goat
Change = car

- You choose a car:
Stick = car
Change = goat

As you can easily see, 2 out of 3 times changing gives you a car, where as only 1 time in 3 does sticking give you the car.

Rami on
Steam / Xbox Live: WSDX NNID: W-S-D-X 3DS FC: 2637-9461-8549

• jacobkosh Registered User regular
edited July 2008
It's sooooooooooooooooo counter intuitive, it hurts my head.

I mean, I get it when you explain it like that but honestly if you asked me the question in another form I'd probably still answer in the negative if I didn't write it out like that.

God ingrained thinking sucks.

Organichu on
• Registered User regular
edited July 2008
This is why you should cast aside your intuition and feelings and operate only on cold, hard logic.

Rami on
Steam / Xbox Live: WSDX NNID: W-S-D-X 3DS FC: 2637-9461-8549

• Registered User, __BANNED USERS regular
edited July 2008
Still doesn't make sense to me, it should still be 50/50 since now 1 goat is gone there are two doors, one win and one lose. How is that not 50/50? I don't understand this part

- You choose a car:
Stick = car
Change = stick

If you chose the car and you change you get the goat.

Fizban140 on
• Registered User regular
edited July 2008
It has to do with the fact that Monty's choice isn't blind - he always eliminates a bad choice. Part of the problem is that most people think that Monty has cut down the scenarios to two, which he hasn't - there are still three in play:

(* - door picked by contestant, ! - door opened by Monty.)
*P  G1   G2  -> *P   G1  !G2
P *G1  G2  ->   P  *G1  !G2
P  G1 *G2  ->  P  !G1  *G2


So while on the face of it, it seems like it's a 50/50 shot, it's actually to your advantage tp switch because in two out of the three scenarios, you'll win.

Seems counterintuitive, I know.

AngelHedgie on
XBL: Nox Aeternum / PSN: NoxAeternum / NN:NoxAeternum / Steam: noxaeternum
• Registered User regular
edited July 2008
Fizban140 wrote: »
Still doesn't make sense to me, it should still be 50/50 since now 1 goat is gone there are two doors, one win and one lose. How is that not 50/50? I don't understand this part

- You choose a car:
Stick = car
Change = stick

If you chose the car and you change you get the goat.

The thing is that there are still three doors - just one is removed from contention. (It helps if you uniquely identify the goats.)

AngelHedgie on
XBL: Nox Aeternum / PSN: NoxAeternum / NN:NoxAeternum / Steam: noxaeternum
• Registered User
edited July 2008
Rami wrote: »
You're asked to choose a door:

There are 3 choices each with 2 possible outcomes:

(after your initial choice one goat door is revealed, you then change or stick)

- You choose a goat:
Stick = goat
Change = car

- You choose a goat:
Stick = goat
Change = car

- You choose a car:
Stick = car
Change = goat

As you can easily see, 2 out of 3 times changing gives you a car, where as only 1 time in 3 does sticking give you the car.

why are there 3 choices when one door is already open and shown to be a wrong answer? (goat)
how would this work given 4 doors to begin with?

ApexMirage on
I'd love to be the one disappoint you when I don't fall down
• I don't... what... hnnng Registered User regular
edited July 2008
I didn't get it at first either until I saw an image.

If you still don't get it read The Curious Incident of the Dog in the Night Time. Good book about both math, autism, and mysteries involving murdered poodles.

Quid on
• Registered User regular
edited July 2008

3.

Just because one has now been removed, the probability is still worked out on 3 doors. Think about it, there is a 66.6% chance you picked a goat initially, which means you have the same odds of getting the car if you switch.

Rami on
Steam / Xbox Live: WSDX NNID: W-S-D-X 3DS FC: 2637-9461-8549

• Registered User regular
edited July 2008
ApexMirage wrote: »
Rami wrote: »
You're asked to choose a door:

There are 3 choices each with 2 possible outcomes:

(after your initial choice one goat door is revealed, you then change or stick)

- You choose a goat:
Stick = goat
Change = car

- You choose a goat:
Stick = goat
Change = car

- You choose a car:
Stick = car
Change = goat

As you can easily see, 2 out of 3 times changing gives you a car, where as only 1 time in 3 does sticking give you the car.

why are there 3 choices when one door is already open and shown to be a wrong answer? (goat)
how would this work given 4 doors to begin with?

Because the two goats aren't the same.

Again, the matrix of possibilities:
*P  G1   G2  -> *P   G1  !G2
P *G1  G2  ->   P  *G1  !G2
P  G1 *G2  ->  P  !G1  *G2


As you can see, just because Monty eliminates a bad choice from contention doesn't change that there are three underlying possibilities, not two.

AngelHedgie on
XBL: Nox Aeternum / PSN: NoxAeternum / NN:NoxAeternum / Steam: noxaeternum
• Registered User, __BANNED USERS regular
edited July 2008
I think I might understand it, since you can chose wrong twice so you are more likely to chose wrong, is that right?

Fizban140 on
• Registered User regular
edited July 2008
Fizban140 wrote: »
Still doesn't make sense to me, it should still be 50/50 since now 1 goat is gone there are two doors, one win and one lose. How is that not 50/50? I don't understand this part

- You choose a car:
Stick = car
Change = stick

If you chose the car and you change you get the goat.

I'm really just retreading the ground laid down by Rami here, but basically:

Originally, you chose either a goat or a car. There are three doors. Three possible decisions. You either chose Goat A, Goat B, or a car.

Remember the host knows where everything is, and will always remove one goat after you have made your first choice.

You chose Goat A originally, the host removes Goat B, and switching will get you the car. If you stick, you get a goat.
You chose Goat B originally, the host removes Goat A, and switching will get you the car. If you stick, you get a goat.
You chose the car originally, the host removes a goat, and switching will get you a goat. If you stick, you get a car.

Two of these will get you a car if you switch. This means that switching will give you a 66.6% chance of getting a car.

Note that this is only true because we know that the host knows the position of the car, and will not remove it.

This confused the fuck out of me the first time I saw it, too

Willeth on
@vgreminders - Don't miss out on timed events in gaming!
@gamefacts - Totally and utterly true gaming facts on the regular!
• Have you ever questioned the nature of your reality? Registered User regular
edited July 2008
I think the best way to think about this is imagine that there were 100 doors, 99 goats and one car.

You choose one, he opens 98 doors and reveals 98 goats.

There are two doors left. Do you switch?

Apothe0sis on
• Registered User, ClubPA regular
edited July 2008
Up it to 100 doors and the reasoning becomes a lot more obvious.

99 doors out of 100 have a goat, 1 has a car. You make your selection, and the game host reveals 98 of the other doors to have goats behind them, leaving your selection and one other door closed. Do you switch?

Doc on
• Registered User, ClubPA regular
edited July 2008
Apothe0sis wrote: »
I think the best way to think about this is imagine that there were 100 doors, 99 goats and one car.

You choose one, he opens 98 doors and reveals 98 goats.

There are two doors left. Do you switch?

DAMMIT

Doc on
• Registered User, __BANNED USERS regular
edited July 2008
Apothe0sis wrote: »
I think the best way to think about this is imagine that there were 100 doors, 99 goats and one car.

You choose one, he opens 98 doors and reveals 98 goats.

There are two doors left. Do you switch?
Yes because your chance of picking a goat door was higher than picking a prize door.

Am I doing this right?

Fizban140 on
• And they will tremble again at the sound of our silence.Registered User regular
edited July 2008
http://en.wikipedia.org/wiki/Monty_hall_problem also has an explanation with pictures.

ASimPerson on

SE++ Forum Battle Archive | PDT is not PST | DRUNKSTUCK: A Homestuck recap
• Registered User regular
edited July 2008
Fizban140 wrote: »
Apothe0sis wrote: »
I think the best way to think about this is imagine that there were 100 doors, 99 goats and one car.

You choose one, he opens 98 doors and reveals 98 goats.

There are two doors left. Do you switch?
Yes because your chance of picking a goat door was higher than picking a prize door.

Am I doing this right?

Yes that's a good way to understand why it's correct, then you can actually look at the maths and really understand it.

Rami on
Steam / Xbox Live: WSDX NNID: W-S-D-X 3DS FC: 2637-9461-8549

• Registered User
edited July 2008
Doc wrote: »
Up it to 100 doors and the reasoning becomes a lot more obvious.

99 doors out of 100 have a goat, 1 has a car. You make your selection, and the game host reveals 98 of the other doors to have goats behind them, leaving your selection and one other door closed. Do you switch?

Whats happening after the host removes a goat door and there are 99 left? You get to switch? Switch to what? Door of your choice? Your odds at that point of switching to a goat are huge, but they get smaller as each door is removed, right? but at the end of it you'll get to 4 doors left, 75% chance of a goat, 66.7% chance you'll have a goat after a goat door is removed, beacuse obviously you cant pick or switch to a door that was removed. Then you still get to "3 doors left, odds your door is a goat is 66.7%" same thing happens: you know a goat door is going to be removed and the odds that your door is a goat after that happens is 50%
Sure your odds of having a goat are 99% when you start, but you've got too many door choices to switch to at that point. you're not getting an option to magically reverse your odds from 1% to 99% at 100 doors left, and you're not getting it at 3 doors left either. Maybe you've got a goat, maybe you dont. The beauty of it at that point is you cant switch from a goat to a goat, because you only get to choice to switch once two doors are left, at which point anything that happened before you got to 2 doors left is irrelevant. You've got two doors left, you either already have the car, in which case you'll switch to a goat and cry, or you've got the stupid goat already and you switch to the car. It's 50/50

The host isnt part of the odds, he's not a machine removing doors in a specific pattern or way, but he cant fuck with you. He removes a goat door each and evertime without fail, because those are the rules of the game. The only way this whole switching to get 66.7% chance thing works is if you're not revealed the contents of the door that is removed when there are 3 left, and you assume it was a goat. Clearly you do assume so, since removing the car would be fairly mean spirited of the host. If you're the one picking the door to remove on the other hand, your odds of getting the car could just as easily be 0%

And lets not forget these are still just odds, you dont instantly fucking win -_-

ApexMirage on
I'd love to be the one disappoint you when I don't fall down
• Registered User
edited July 2008
It may be easier to appreciate the solution by considering the same problem with 1,000,000 doors instead of just three (vos Savant 1990). In this case there are 999,999 doors with goats behind them and one door with a prize. The player picks a door. The game host then opens 999,998 of the other doors revealing 999,998 goats—imagine the host starting with the first door and going down a line of 1,000,000 doors, opening each one, skipping over only the player's door and one other door. The host then offers the player the chance to switch to the only other unopened door. On average, in 999,999 out of 1,000,000 times the other door will contain the prize, as 999,999 out of 1,000,000 times the player first picked a door with a goat. A rational player should switch

This entails the host opening all but two doors in one shot after the contestant picks a door though, and not one at a time with something happening after each one as I'd depicted earlier. At the end you're faced with 2 doors that are closed, and a ton that are (supposedly) open, revealing goats. Out of the original pool your odds of picking a goat are huge, and those odds carry over once you're down to a minimal number of doors (2), assuming you didnt get the option to switch at anytime beforehand. Since there are only two options left, the other door is forcibly the prize, unless you got incredibly lucky with your first pick, hence the better odds on the switch.

It makes sense now, you're just led to assume that the odds are 50/50 once you've got two doors left because the odds you picked the prize door to begin with are not astronomical. If you had 2 doors to begin with Switching would change nothing, but if you've got a shitton of doors to pick from at the start, what are the odds that you picked the prize? Pretty damn shitty. Then the host tells you that he's eliminating 99% of the wrong doors and offering you a switch? Yes please.

ApexMirage on
I'd love to be the one disappoint you when I don't fall down
• Registered User
edited July 2008
I didn't really catch it until I pictured the scenario from the Game Show host, maybe that'll help?

lordswing on
D2:LoD East -> *FlipPaulHewitt
• Registered User, ClubPA regular
edited July 2008
ApexMirage wrote: »
Doc wrote: »
Up it to 100 doors and the reasoning becomes a lot more obvious.

99 doors out of 100 have a goat, 1 has a car. You make your selection, and the game host reveals 98 of the other doors to have goats behind them, leaving your selection and one other door closed. Do you switch?

Whats happening after the host removes a goat door and there are 99 left? You get to switch? Switch to what? Door of your choice? Your odds at that point of switching to a goat are huge, but they get smaller as each door is removed, right? but at the end of it you'll get to 4 doors left, 75% chance of a goat, 66.7% chance you'll have a goat after a goat door is removed, beacuse obviously you cant pick or switch to a door that was removed. Then you still get to "3 doors left, odds your door is a goat is 66.7%" same thing happens: you know a goat door is going to be removed and the odds that your door is a goat after that happens is 50%
Sure your odds of having a goat are 99% when you start, but you've got too many door choices to switch to at that point. you're not getting an option to magically reverse your odds from 1% to 99% at 100 doors left, and you're not getting it at 3 doors left either. Maybe you've got a goat, maybe you dont. The beauty of it at that point is you cant switch from a goat to a goat, because you only get to choice to switch once two doors are left, at which point anything that happened before you got to 2 doors left is irrelevant. You've got two doors left, you either already have the car, in which case you'll switch to a goat and cry, or you've got the stupid goat already and you switch to the car. It's 50/50

The host isnt part of the odds, he's not a machine removing doors in a specific pattern or way, but he cant fuck with you. He removes a goat door each and evertime without fail, because those are the rules of the game. The only way this whole switching to get 66.7% chance thing works is if you're not revealed the contents of the door that is removed when there are 3 left, and you assume it was a goat. Clearly you do assume so, since removing the car would be fairly mean spirited of the host. If you're the one picking the door to remove on the other hand, your odds of getting the car could just as easily be 0%

And lets not forget these are still just odds, you dont instantly fucking win -_-

You are wrong.

Doc on
• Registered User
edited July 2008
Doc wrote: »
You are wrong.

How was that necessary?. It's not like I myself admited to being wrong a few mere inches to the bottom of your screen or anything. -_-

ApexMirage on
I'd love to be the one disappoint you when I don't fall down
• Starting to get dizzy Registered User regular
edited July 2008
It's important to note a couple frequently unstated assumptions that are critical to the resolution of the problem.

First, as you mentioned in the OP, the host must know where the car is. If he doesn't know where the car is it's possible for him to open the door with the car behind it, which changes the possibilities people have enumerated already. If that's the case then the odds for switching are 50/50 after all.

Second, the host must always open a door with a goat and then offer the player the opportunity to switch doors. If the host is not required to do this, the odds of winning by switching can be anything at all depending on how he chooses when to offer the switch. If he only offers the switch when the player chose the car then switching will always lose; likewise if he only offers it when the player chose a goat (and the host knows where the car is so he can reveal the other goat) then switching will always win. Naturally he can make whatever ratio he wants by choosing the right mix of the two options.

Smasher on
• Registered User
edited July 2008
Think of it this way: if your first choice is a goat, and then you switch, you CANNOT LOSE.

There are two goats in play. You have selected one of them. Monty has to reveal one, so he will reveal the other goat. If you switch now, the door you switch to has the car.

Now remember, the probability of you picking a goat originally is 2 out of 3, so 66.7%. Therefore if you always switch, your probability of winning is 66.7%.

Now let's consider the situation if you NEVER switch. If you NEVER switch your choice, then the only way to win is to pick the correct door (the door with the car) right at the beginning. Because there is one car and two goats, you only have a 33% chance of doing that.

HiredGun on
• Registered User regular
edited July 2008
Yeah it took me ages for my Dad to admit that the odds are not 50/50 when you are asked to switch, but the thing that proved it to him was by using ten Dollar bills, one with a Quarter hidden under it then asking him to pick one, then removing all but the correct one and the one he had chosen. He quickly realised that the odds are not 50/50.

Ritchmeister on
• Registered User
edited July 2008
Fizban140 wrote: »
chance of picking a goat door was higher than picking a prize door.

Am I doing this right?

This is exactly the way I started to understand it, then I got into the maths involved and it made perfect sense.

If you are going to switch doors and LOSE you need to have picked the correct door initially. The odds of doing that is 1/3.

If you are going to switch door and WIN you need to have picked the wrong door initially. The odds of doing that is 2/3.

It is more likely that you picked the wrong door first, so you should always switch doors.

A great book on the subject with all sorts of real life probabilities explained to people who don't have a degree in maths. Struck By Lightning. Anyone who's found this problem interesting, or slightly vexing would enjoy it.

Everywhereasign on
"What are you dense? Are you retarded or something? Who the hell do you think I am? I'm the goddamn Batman!"
• Registered User regular
edited July 2008
Now that you have your head wrapped around it, go read The Straight Dope's take on the problem, which is one of the few times Cecil has been proven wrong. It's equal parts information, chaos, and hilarity.

whuppins on
• Registered User regular
edited July 2008
whuppins wrote: »
Now that you have your head wrapped around it, go read The Straight Dope's take on the problem, which is one of the few times Cecil has been proven wrong. It's equal parts information, chaos, and hilarity.

I remember reading something once that this was originally published in a maths journal, and a ton of respected mathematicians wrote in to argue that it was 50/50.

Willeth on
@vgreminders - Don't miss out on timed events in gaming!
@gamefacts - Totally and utterly true gaming facts on the regular!
• Have you ever questioned the nature of your reality? Registered User regular
edited July 2008
Smasher wrote: »
It's important to note a couple frequently unstated assumptions that are critical to the resolution of the problem.

First, as you mentioned in the OP, the host must know where the car is. If he doesn't know where the car is it's possible for him to open the door with the car behind it, which changes the possibilities people have enumerated already. If that's the case then the odds for switching are 50/50 after all.

Well, that's hardly an assumption, if you reveal the car, then the question of switching goes away, because you lose. It doesn't change the odds but completely breaks the game.
Second, the host must always open a door with a goat and then offer the player the opportunity to switch doors. If the host is not required to do this, the odds of winning by switching can be anything at all depending on how he chooses when to offer the switch. If he only offers the switch when the player chose the car then switching will always lose; likewise if he only offers it when the player chose a goat (and the host knows where the car is so he can reveal the other goat) then switching will always win. Naturally he can make whatever ratio he wants by choosing the right mix of the two options.

I'm not sure what you even mean by this, except that again you'd be breaking what the problem is actually demonstrating.

Apothe0sis on
• Starting to get dizzy Registered User regular
edited July 2008
Apothe0sis wrote: »
Smasher wrote: »
It's important to note a couple frequently unstated assumptions that are critical to the resolution of the problem.

First, as you mentioned in the OP, the host must know where the car is. If he doesn't know where the car is it's possible for him to open the door with the car behind it, which changes the possibilities people have enumerated already. If that's the case then the odds for switching are 50/50 after all.

Well, that's hardly an assumption, if you reveal the car, then the question of switching goes away, because you lose. It doesn't change the odds but completely breaks the game.
Second, the host must always open a door with a goat and then offer the player the opportunity to switch doors. If the host is not required to do this, the odds of winning by switching can be anything at all depending on how he chooses when to offer the switch. If he only offers the switch when the player chose the car then switching will always lose; likewise if he only offers it when the player chose a goat (and the host knows where the car is so he can reveal the other goat) then switching will always win. Naturally he can make whatever ratio he wants by choosing the right mix of the two options.
I'm not sure what you even mean by this, except that again you'd be breaking what the problem is actually demonstrating.

You're right that the game would be much less interesting if the host revealed the car, but the assumption that he never will is very important to the logic.

Let's suppose the host must open one of the other two doors, but doesn't know where the car is. There are 18 possible ways the game can play out, 6 for each of the three doors the car can be behind. Since the three doors are identical we'll only look at the situations where the car is behind door one, as the logic works out the same for the other two doors as well. Red is the door the contestant picks first, and yellow is the door the host opens. By elimination, white is the door the contestant can switch to.

cgg
cgg
cgg
cgg
cgg
cgg

Since the problem states the host reveals a goat we eliminate the two outcomes where the host reveals a car leaving us with

cgg
cgg
cgg
cgg

Thus, if the host doesn't have to always reveal a goat the fact that he did doesn't give any new information about the other unpicked door. This is in contrast to the intended problem, where 2/3 of the time the host is forced to reveal a particular door, thus giving us information about the door he didn't reveal.

Just to be clear, I'm not disputing the solution to the normal problem; I'm merely clarifying the conditions under which it holds.

Smasher on
• Have you ever questioned the nature of your reality? Registered User regular
edited July 2008
You're quite plainly wrong.

The only thing that changes if Monty doesn't know where the car and can thus reveal the car is that in some cases you don't get a chance to switch and then you lose straight up. But in the cases where the car isn't revealed by accident, switching remains the best decision.

If you increase the number of doors, from 3 to 100 and Monty reveals 98 goats are you seriously telling me that it's only if Monty knows where the car is, rather than a run of chance wherein he avoids opening the car door, that it's an even bet whether you switch or don't? Because if you are saying that, then you are wrong.

Apothe0sis on
• Registered User regular
edited July 2008
Saying 'Monty opens a door and it happens to be a goat' is not quite equivalent to 'Monty knows where the car is and opens a goat door'.

The fact that Monty will always open a goat door is what makes it the optimal solution to always switch. If we do not know that he will then you cannot arrive at the 2/3 - that's a bunch of maths that I don't have time for right now.

Willeth on
@vgreminders - Don't miss out on timed events in gaming!
@gamefacts - Totally and utterly true gaming facts on the regular!
• Have you ever questioned the nature of your reality? Registered User regular
edited July 2008
Willeth wrote: »
Saying 'Monty opens a door and it happens to be a goat' is not quite equivalent to 'Monty knows where the car is and opens a goat door'.

The fact that Monty will always open a goat door is what makes it the optimal solution to always switch. If we do not know that he will then you cannot arrive at the 2/3 - that's a bunch of maths that I don't have time for right now.

This is wrong.

If Monty does not open a door, or Monty opens a door and it happens to be the car, or any other situation where you have the option to switch and less doors in the game than when you made your choice then it is always beneficial to switch.

Any deviation from the "You choose from X doors, Monty reveals Y doors, there are now X-Y doors in play which may hide the car" where Y > 0 tells us nothing about whether or not switching is the optimal strategy.

Any case where the above conditions are upheld, switching is always the best strategy - it doesn't matter whether Monty knows where the car is, or does not, it doesn't matter whether Monty always opens doors or only sometimes opens doors. In the cases where the above holds true, you switch, unless you hate probability.

Apothe0sis on
• And they will tremble again at the sound of our silence.Registered User regular
edited July 2008
So I wrote a program.

This program is not optimized, but it illustrates the properties of the problem. The program always assumes the user picks door 0 and that the user will always switch.

I ran the scenarios a million times. In the first scenario, the host knows where the car is. In the second, he doesn't. These are the results with 3 doors:
Host knows: Wins: 665992 Losses 334008 Pct: 0.665992
Host doesn't know:
Revealed: 333820 Pct: 0.33382
Non-revealed: Wins: 333320 Losses: 332860 Pct: 0.500345

So about a third of the time, the host will show you where the car is. The other 2/3 times, you have a 50/50 shot of picking the car. This is also true with 50 doors. Or 100. The only thing that changes with more doors in scenario 2 is how often a car is revealed:
Host knows: Wins: 980005 Losses 19995 Pct: 0.980005
Host doesn't know:
Revealed: 960138 Pct: 0.960138
Non-revealed: Wins: 19731 Losses: 20131 Pct: 0.494983

Here's the code. Again, this is not optimized - there are obvious shortcuts that will get the same results. But I think this better illustrates the properties of the problem.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int get_door (int num_doors)
{
// yes, in new versions of glibc they fixed the thing were the low-order
// bits were not as random as the high order bits, so this is fine
return (rand() &#37; num_doors);
}

int get_nonuser_door (int num_doors)
{
return ((rand() % (num_doors - 1)) + 1);
}

// door 0 is always what the user picks

int switch_host_knows (int num_doors)
{
char *doors;
int car_door, i = 1;
int user_door = 0;
doors = calloc(num_doors, 1);
if(doors == NULL) {
// screw elegance, let's get out of here
exit(-1);
}

car_door = get_door(num_doors);
doors[car_door] = 1; // 1 is the "car" value

// "reveal" all non-car and non-zero doors
// since we "know" which door has a car, we will not open that one
// if the user is correct, we will leave door 1 closed
if(car_door == 0) {
i = 2;
}
for(; i < num_doors; i++) {
if(doors[i] != 1) {
doors[i] = 2; // 2 is the "revealed as a goat" value
}
}

// this seems absurd, but this highlights why the 2/3 answer is correct
// after the host reveals all but two doors, you can infer that:
// a) you most likely picked a goat
// b) the host has likely revealed all the other goats
// the only case where you can lose in the "always switch" scenario is
// if you picked the car initially - and what are the odds of that? 1/3 for
// 3 doors
if(car_door == 0) {
user_door = 1;
} else {
user_door = car_door;
}

if(doors[user_door] == 1) {
free(doors);
return 1; // car
} else {
free(doors);
return 0; // goat
}
}

int switch_no_host (int num_doors)
{
char *doors;
int car_door, i = 1;
int user_door = 0, closed_door;
doors = calloc(num_doors, 1);
if(doors == NULL) {
// screw elegance, let's get out of here
exit(-1);
}

car_door = get_door(num_doors);
doors[car_door] = 1;
closed_door = get_nonuser_door(num_doors);

for(; i < num_doors; i++) {
if(doors[i] == 1 && i != closed_door) {
// we opened the door with the car, return!
free(doors);
return -1;
} else if(doors[i] != 1) {
doors[i] = 2; // otherwise, bring out the goats
}
}

// switch
user_door = closed_door;

if(doors[user_door] == 1) {
free(doors);
return 1; // car
} else {
free(doors);
return 0; // goat
}
}

int main()
{
int i, result;
int wins = 0, losses = 0, revealed = 0;
srand(time(NULL));

for(i = 0; i < 1000000; i++) {
if(switch_host_knows(3)) {
wins++;
} else {
losses++;
}
}

printf("Host knows: Wins: %d Losses %d Pct: %g\n", wins, losses,
(double)wins/(wins+losses));

wins = 0;
losses = 0;

for(i = 0; i < 1000000; i++) {
result = switch_no_host(3);
if(result == -1) {
revealed++;
} else if(result == 0) {
losses++;
} else {
wins++;
}
}

printf("Host doesn't know: \n");
printf("Revealed: %d Pct: %g\n", revealed,
(double)revealed/(revealed+wins+losses));
printf("Non-revealed: Wins: %d Losses: %d Pct: %g\n", wins, losses,
(double)wins/(wins+losses));

return 0;
}


ASimPerson on

SE++ Forum Battle Archive | PDT is not PST | DRUNKSTUCK: A Homestuck recap
• Have you ever questioned the nature of your reality? Registered User regular
edited July 2008
EDIT: Wait I get you now.

Response forthcoming.

Most illustrations of the problem look like this. Where X's indicate revealed doors, and *'s indicate player choice, S indicates times switching is helpful. The question of which goat is revealed is irrelevant, hence why there are nine rather than twelve switch scenarios considered.
*P  G  G -> *P  X  G
*G  P  G -> *G  P  X    S
*G  G  P -> *G  X  P    S

P *G  G ->  P *G  X    S
G *P  G ->  X *P  G
G *G  P ->  X *G  P    S

P  G *G ->  P  X *G    S
G  P *G ->  X  P *G    S
G  G *P ->  X  G *P


Now, if we allow Monty to also reveal the car, then things remain the same, it's just that there is also a possibility that you don't get to switch.

Now, the way you make things 50/50 for switching is by deciding that the goat which it revealed does matter.

*P  G  G -> *P  G  X
G *P  G ->  G *P  X
G  G *P ->  G  X *P


And we get another three situations in which it is not advantageous to switch.

Now, the problem here, as with your program is that which goat you reveal doesn't matter, what matters is what is behind the door you've chosen. You'll note that if Monty knows, and thus does not reveal cars, that this issue still comes up, so it has nothing to do with whether or not Monty knows which door is which.

So, if you're arguing that it's 50/50 in the case that Monty doesn't know where the door is, then you're arguing that which goat is shown, rather than which door is opened is the relevant factor and that the way of modelling the solution that gives 2/3 is wrong.

Apothe0sis on
• Have you ever questioned the nature of your reality? Registered User regular
edited July 2008
Yeah it took me ages for my Dad to admit that the odds are not 50/50 when you are asked to switch, but the thing that proved it to him was by using ten Dollar bills, one with a Quarter hidden under it then asking him to pick one, then removing all but the correct one and the one he had chosen. He quickly realised that the odds are not 50/50.

This might be a good way to win monies.

Apothe0sis on
• Registered User regular
edited July 2008
This whole thing with "does Monty know where the car is?" is stupid - it is essential to the game that he reveal a door with the bad prize in it! Of course it's going to change to 50/50 if he reveals a door at random because out of the 66% of the chances where he would (in the original game) be FORCED to open one of the doors (since the contestant did not pick the car and Monty has to open a door with a bad prize) he would pick at random from the 2 remaining doors and open the one with the car 50% of the time. That throws out 1/2 of the instances where switching (in the original game) would win you the prize. If we allow Monty to pick the car to open, then it follows that the contestant will pick the car initially 33% of the time, Monty will pick the car 33% of the time (no switch allowed), and the contestant will switch to the car 33% of the time - so out of the instances where you COULD switch, you would lose 50% of the time.

It is ESSENTIAL to the problem that Monty knows where the car is and has to open a door which does not contain the car. If he just picks at random from the remaining doors, then the chances that the player will lose will go up to 66% (assuming you switch every time), since (like I said above) The player picks the car 33% of the time (lose), the player picks a goat and Monty shows the car 33% of the time (lose), and the player picks a goat and Monty shows a goat 33% of the time (win.)

I'm not saying it's an even bet if he shows the goat (you're better off switching,) but it's a stupid and pointless discussion given that the essential part of the game is that if one of the remaining prizes is the car, he CAN'T show it!

tsmvengy on
• Starting Defense Registered User regular
edited July 2008
The central issue in this problem is this:

The event you're making odds for is the game strategy of winning by switching

The event most people try to make odds for is act of opening a door with a car behind it.

You have a 2 in 3 chance of winning by switching even though you have have a 1 in 2 chance of choosing a door with a car behind it.

The initial odds you are wrong (66.6^%) are the odds you are right if you switch.

That doesn't change when more information is revealed - it just makes it in your favor to switch, since you are now looking at one choice that will be right 66% of the time. Had he not revealed a door, switching would be pointless - the odds of the payoff (1 in 3) would still be the same as the odds of the play. ( the other 66% chance of car would be split between the two unselected doors)

But with the door revealed, you're being offered a choice between the door you're on - 33% chance of car, since revealing the goat doesn't change the odds you selected at initially - and the other door. Which "holds" the rest of the chance of car. It's as though he flipped a card up in a game of poker.

JohnnyCache on
• Starting to get dizzy Registered User regular
edited July 2008
Apothe0sis wrote: »
Spoilered for size
EDIT: Wait I get you now.

Response forthcoming.

Most illustrations of the problem look like this. Where X's indicate revealed doors, and *'s indicate player choice, S indicates times switching is helpful. The question of which goat is revealed is irrelevant, hence why there are nine rather than twelve switch scenarios considered.
*P  G  G -> *P  X  G
*G  P  G -> *G  P  X    S
*G  G  P -> *G  X  P    S

P *G  G ->  P *G  X    S
G *P  G ->  X *P  G
G *G  P ->  X *G  P    S

P  G *G ->  P  X *G    S
G  P *G ->  X  P *G    S
G  G *P ->  X  G *P

Now, if we allow Monty to also reveal the car, then things remain the same, it's just that there is also a possibility that you don't get to switch.

Now, the way you make things 50/50 for switching is by deciding that the goat which it revealed does matter.

*P  G  G -> *P  G  X
G *P  G ->  G *P  X
G  G *P ->  G  X *P

And we get another three situations in which it is not advantageous to switch.

Now, the problem here, as with your program is that which goat you reveal doesn't matter, what matters is what is behind the door you've chosen. You'll note that if Monty knows, and thus does not reveal cars, that this issue still comes up, so it has nothing to do with whether or not Monty knows which door is which.

So, if you're arguing that it's 50/50 in the case that Monty doesn't know where the door is, then you're arguing that which goat is shown, rather than which door is opened is the relevant factor and that the way of modelling the solution that gives 2/3 is wrong.

For the sake of completeness I'll list out all the possible ways the game can play out, assuming the host must reveal a door other than the one the player chose and he doesn't know where the prize is. I'll append a p to the instances where the host reveals the prize.
*P  G  G -> *P  X  G
*P  G  G -> *P  G  X
*G  P  G -> *G  X  G    p
*G  P  G -> *G  P  X    S
*G  G  P -> *G  X  P    S
*G  G  P -> *G  G  X    p

P *G  G ->  X *G  G    p
P *G  G ->  P *G  X    S
G *P  G ->  X *P  G
G *P  G ->  G *P  X
G *G  P ->  X *G  P    S
G *G  P ->  G *G  X    p

P  G *G ->  X  G *G    p
P  G *G ->  P  X *G    S
G  P *G ->  X  P *G    S
G  P *G ->  G  X *G    p
G  G *P ->  X  G *P
G  G *P ->  G  X *P

Taking out the situations where the host reveals the prize, we get a 50/50 chance for switching (or staying).

In the case where the contestant initially picks the prize (the last three situations you mention), it's not that it matters which goat the host reveals but rather that he has two doors he can open in that situation just like he does for every other configuration. The only difference between them is that, assuming the player always switches, having two goats gives two ways the player can lose, while when the contestant doesn't pick the prize door he can only win if the host doesn't reveal the prize. That of course is balanced by there being twice as many configurations where the player doesn't pick the door with the prize behind it, giving an overall chance of 50/50 for switching.

Addressing one possible point of contention, looking at my chart above it might seem to support there being a 50/50 chance in the standard can't-reveal-the-car variation, and thus there being something wrong with it. However, consider each of the 9 starting configurations (prize door + contestant initial choice combination; each configuration is a pair of lines). Assuming the contestant choice is random each of the configurations is equally likely at 1/9. Now the host picks one of the two doors; let's say we had starting configuration 1. Lines 1 and 2 are the possible results, and each of them has 1/18 chance of happening.

By contrast, configuration 2 results in lines 3 and 4. Since this is the can't-reveal-the-car version, line 3 can't happen. That means that every time configuration 2 occurs, the result is line 4. Since configuration 2 has 1/9 chance of happening, so does line 4. Thus line 4 (as well as line 5) has the same weight as lines 1 and 2 combined, giving us the expected 2/3 chance when switching.

Smasher on