Probability Challenge

Started by
14 comments, last by Timkin 19 years, 5 months ago
I have run into a probability problem that I cannot seem to grapple with. Put plainly: You are on a game show. There are three doors, two have goats behind them and one has a BMW behind it. You pick one door. The game show host shows you one of the doors (NOT the door you picked) with a goat behind it. So you are left with two doors, one with a goat and one with a BMW. The game show host then says that if you want, you can switch to the other door to try and get the car. Are your odds of winning better if you switch doors? Is the probability of winning if you stay with your guess 1/2 or 1/3? Please explain why. I even wrote this computer program to test this (source code below), but it seems to reaffirm the probability of 1/3. Thanks
[SOURCE]
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

#define GOAT 0
#define BMW 1

int _tmain(int argc, _TCHAR* argv[])
{
	long lTests;
	long lRight = 0;									// The number of times staying made you right
	long lWrong = 0;									// The number of times staying makes you wrong
	srand(time(NULL));		// Set the seed for our random number generator to the current time.
	printf("How many test runs would you like to do?\n");
	scanf("%li", &lTests);
	for(long i=0; i<lTests; i++) {
		char pDoors[3];
		memset(pDoors, GOAT, sizeof(char)*3);			// Set's the 3 doors to goats
		int iIndex = rand() % 3;						// Get a random number, either 0, 1, or 2
		pDoors[iIndex] = BMW;							// Set one of the doors to have a BMW
		printf("Door order: ");
		for(int j=0; j<3; j++) {
			if(pDoors[j]==GOAT)
				printf("Goat ");
			else if(pDoors[j]==BMW)
				printf("BMW ");
			else
				printf("System Error ");
		}
		printf("\n");
		int iSelection = 2 - rand() % 3;
		printf("You originally selected door number %d.\n", iSelection);
		int iGiveAway;
		for(;;) {
			iGiveAway = rand() % 3;
			if(iGiveAway!=iSelection && iGiveAway!=iIndex)
				break;
		}
		printf("The host tells you that door %d is a goat.\n", iGiveAway+1);
		for(int i=0; i<3; i++) {
			if(i==iGiveAway) 
				printf("Goat ");
			else
				printf("???? ");
		}
		if(iSelection==iIndex)
			lRight++;
		else
			lWrong++;
		printf("\n");
		printf("\n");
	}
	printf("The number of times staying with your first guess made you right: %li\n", lRight);
	printf("The number of times staying with your first guess made you wrong: %li\n", lWrong);
	return 0;
}


[/SOURCE]
OpenGL Revolutions http://students.hightechhigh.org/~jjensen/
Advertisement
Google for the Monty Hall Problem. This has been debated into the ground. I think this is a good example, although you have to scroll down about half a page before it gets to the actual problem.

CM
your original guess is going to be right 1/3 of the time ... PERIOD.

so if a game show was set up so that is ALWAYS showed you a wrong door and then let you pick between the 2 remaining ... then you should switch ... because then it is like saying ... if their was a 2/3 chance you picked wrong, and then they remove a wrong answer from the equation. In the 2/3 of cases where you picked wrong, switching is 100% going to be right ... so in 2/3 of the original cases, you should switch.

Now if it was a FAIR revelation, they would randomly reveal a door - which would be the BMW some of the time (and hence remove the possibility of you changing those losses to wins) ...
And here is another thread adequately discussing the problem.
Formulate the question like this:

"Would you like to choose one door, or the union of the two other doors?"
enum Bool { True, False, FileNotFound };
Agreed... please don't post any more in this thread unless after reading the ample solutions to this problem within the archives of GD.net you still don't understand... which is unlikely, because I KNOW there are clear explanations in those archived threads...

Happy hunting,

Timkin
Quote:Original post by hplus0603
Formulate the question like this:

"Would you like to choose one door, or the union of the two other doors?"
That's how I originally solved it, in less...mathematical words.

Essentially, you had a 1/3 chance to choose the right door. After being told one of the others is not it, the chance that your pick was right is STILL 1/3... and probability always adds up to 1.

I liked statistics, too bad the teacher was a dick.
Ahhh, good ole' Monty Hall.

I once pepped up a presentation on Bayesian Statistics with a few brief interludes for statistical swindles (Monty Hall, the St Petersberg Paradox (although strictly speaking this isn't a swindle), some postal swindles I have come across). This was a presentation to a group of medical folks (doctors, professors, some PhDs).

The discussion of this particular topic got particularly heated. There were one or two folks who just would not accept that switching doors was a good idea.

I'm not sure how much of the Bayes stuff they took away, but that was sure fun!!!

Regards,
Jim.
It seems by this logic if I flip a coin and get heads then I should bet the next flip is going to be tails. How is the game after he shows you what is behind one door differant than a game where there are just two doors and he only shows you whether you won or lost? Oh, and personally, I have no preferance for a door that might be a winner plus one I know is a loser over just a just door that might be the winner. There is no longer a 1/3 chance that the door they showed me is the winner. There is a 0/3 chance of that.

[Edited by - LilBudyWizer on October 25, 2004 3:05:33 AM]
Keys to success: Ability, ambition and opportunity.
Quote:Original post by LilBudyWizer
It seems by this logic if I flip a coin and get heads then I should bet the next flip is going to be tails.


Not quite thje same thing.

If you don't switch choices, your chance of winning is always 1/3.

But if you do your chance of winning become 2/3 * 1 = 2/3. That is 2/3 chance of choosing a door with goat behind it in the beginning, host removes a losing door thereby leaving one door with the car and one door with goat (this is the one you chose), switching at this point gives 100% of winning the car, hence the 1.

The events are not independent like in your coin example.
Just because it is not nice, doesn''t mean it is not miraculous.

This topic is closed to new replies.

Advertisement