The
original noding is correct in the
terms of the
problem.
If I have a one in three
chance of picking the
car then one time in three if I open the original
door I get the car (Regardless of what is done to other doors). If I opened both the doors that I did not pick then I have a two in three chance of finding the car. Therefore if one of the doors I did not choose is opened (and definitely did not have a car behind it) then there is a two thirds chance that the car is behind the other (there is still a two in three chance that opening both doors will reveal the car). It is not a new
probablility unless the information about which door I chose originally is removed (and I have to chose again from the pair of remaining doors) otherwise the original probablilities stand.
This is easier to see from the point of view of different possibilities. I shall just consider the cases for having selected door 1 because although there are three times as many options they do not change the proportion of wins/losses just the absolute counts.
There are three possible situations corresponding to the car being behind door 1, door 2, and door 3. Each of these is equally likely with a probablility of 1/3
[A] >CAR< goat goat
--Door1---Door2---Door3-- 1/3
[B] goat >CAR< goat
--Door1---Door2---Door3-- 1/3
[C] goat goat >CAR<
--Door1---Door2---Door3-- 1/3
If
Monty Hall then opens one of the doors that I didn't
select (but which has a
goat behind it) then in cases [B] and [C] he only has one door to open. However in case [A] he could open either door 2 or door 3 so there are two possiblities ([A1] and [A2]). However the probability of each of these is only 1/6 as each has half the chance of the
original possiblity [A] of occurring (because they
share that 1/3
evenly between them).
[A1] >CAR< goat goat
--Door1--- ---Door3-- 1/6 LOSE on Switch
[A2] >CAR< goat goat
--Door1---Door2--- -- 1/6 LOSE on Switch
[B] goat >CAR< goat
--Door1---Door2--- -- 1/3 WIN on Switch
[C] goat goat >CAR<
--Door1--- ---Door3-- 1/3 WIN on Switch
If I switch then in cases [A1] and [A2] I lose and in cases [B] and [C] I win. But despite the fact that there are two possiblities in each case their probabilities are different.
- The Switch and Lose probablility is 1/6 + 1/6 = 1/3.
- The Switch and Win probability is 1/3 + 1/3 = 2/3.
- So you are twice as likely to win if you switch.
The confusion normally arises because you can either count all four possibilities as having the same probablility or forget that cases [B] and [C] are different (and so think there are only two possiblities). In either of the cases the probabilities would come out as 1/2 for each case and no advantage.
Obviously in the full case (of choosing any door) the probabilities are 1/18 and 1/9 but they still sum up to give the same 1/3 and 2/3.
I have created a Visual Basic program to simulate the Monty Hall situtation and to show the effects of switching or not switching. The results shown below are for a one million cycle simulation (using VB6 doesn't make them automatically suspect -
honest).
Win Lose TOTALS
-----------------
Switch | 332779 | 166772 | 499551
|-----------------|
NoSwitch | 166970 | 333479 | 500449
-----------------
TOTALS 499749 500251 1000000
As can be seen the results show a roughly 2:1 predominance for winning when switching guesses. The totals are to show that the program did randomly switch about half the time. The logic of the simulation is shown below and below that the core simulation routine.
Pseudo Logic of Simulation
- [Door] := Random(1, 2, 3)
- [Guess] := Random(1, 2, 3)
- Generate [Other] Door Choice
- Does [Door] = [Guess] ?
- YES: [Other] := random choice between non-[Door] values
- NO: [Other] := [Door] (as the door without the car behind is eliminated)
- [Choice] := Random(Switch, NoSwitch)
- Change the [Guess] if decided to switch
- Is [Choice] = Switch ?
- YES: [Guess] := [Other]
- NO: [Guess] remains unchanged
- Determine whether the car was won
- Is [Guess] = [Door] ?
- YES: [Result] := Win
- NO: [Result] := Lose
Then use the values of Choice and Result to increment the count in one of the cells of the results matrix
The variables in the pseudo logic and their values ranges are:
- Door (1, 2, 3) - The number of the door which the car is behind
- Guess (1, 2, 3) - The program's current guess as to where the car is
- Other (1, 2, 3) - The door we could switch to (the number that is not Guess and not Other is the one that Monty opened)
- Choice (Switch, NoSwitch) - Whether the choice was switched or not
- Result (Win, Lose) - Whether the car was won or not
In the Pseudo logic variable names are in square brackets and := means assign the value on the right to the variable named on the left.
The source code of the core Simulation Routine
' Perform a single increment of the Monty Hall Problem
' The value in the relevant cell of the 2 x 2 array
' lResCount(Result, Choice) is incremented
' The constants: NO_SWITCH, DID_SWITCH, NO_CAR, GOT_CAR
' are used to select the correct cell
'
' A false return indicates a problem occurred
Public Function DoMontyHallCycle(lResCount() As Long) As Boolean
' Enable error handling
On Error GoTo ERR_DoMontyHallCycle
Dim bResVal As Boolean
Dim lDoor As Long ' The door behind which the car is
Dim lGuess As Long ' The programs guess where the car is
Dim lOther As Long ' The other door offered after elimination
Dim bChoice As Boolean ' Whether the program switched choice (True = Switch)
Dim bResult As Boolean ' Whether the program found the car (True = Win)
' Initialise the return value
bResVal = True
' Put the car behind a door
lDoor = GenRand3
' Guess where the car is
lGuess = GenRand3
' Get the other door to offer
If (lDoor = lGuess) Then
' Have guessed correctly so randomly choose a door other than Guess
lOther = 1 + ((GenRand2 + lGuess - 1) Mod 3)
Else
' Have not guessed correctly so the other choice will be the correct door
lOther = lDoor
End If
' Decide whether to switch
bChoice = (GenRand2 = 1)
' Change the Guess if necessary
If bChoice Then lGuess = lOther
' Did we get the car
bResult = (lDoor = lGuess)
' Update count in the relevant cell of the results matrix
If bResult Then
If bChoice Then
' Switched Choice and found the car
lResCount(GOT_CAR, DID_SWITCH) = lResCount(GOT_CAR, DID_SWITCH) + 1
Else
' Did not switch Choice and found car
lResCount(GOT_CAR, NO_SWITCH) = lResCount(GOT_CAR, NO_SWITCH) + 1
End If
Else
If bChoice Then
' Switched choice and did not find car
lResCount(NO_CAR, DID_SWITCH) = lResCount(NO_CAR, DID_SWITCH) + 1
Else
' Did not switch choice and did not find car
lResCount(NO_CAR, NO_SWITCH) = lResCount(NO_CAR, NO_SWITCH) + 1
End If
End If
EXIT_DoMontyHallCycle:
' Return the final value
DoMontyHallCycle = bResVal
Exit Function
' Error Handler
ERR_DoMontyHallCycle:
' Return Failure Flag
bResVal = False
Resume EXIT_DoMontyHallCycle
End Function