## View Poll Results: Do you think the player should switch?

Voters
48. You may not vote on this poll
• Yes

20 41.67%
• No

13 27.08%
• Don't know

4 8.33%
• No difference

11 22.92%

# Thread: Problem on Mathematics - Probability

1. Please consider another view which is similar to what I posted 2 posts ago.

If you are the player. You already know how the host will conduct the game because you have seen it before.

You want to make a decision before you go on stage as to whether you are going to make the switch when offered, and stick to your decision.

Would you decide on switching or not switching as you strategy?

Does that change your perspective now?

Because you know that your chances of choosing the box with the key the first time is only 1/3, you will have a 2/3 chance of winning if you switch, and a 1/3 chance of winning if you do not switch. So does switching sounds like a better strategy to improve your chances of winning?

There is a subtle difference between making the switch from the initial choice, versus making a random choice the second time.

What I have been trying to show is that they are different, and those who believe that there is no difference whether or not the player switch base their conclusion on the notion that the second decision is a random choice between the 2 boxes versus a calculated decision on whether or not to make the switch.

2. Frankly, this discussion to me has a "zi3 san4 tan2 bi1" feel. Someone can frankly write a simulation on this and find out. I mean, with such a significant difference in probabilities (0.5 vs 0.667), it will be obvious in the simulation if you run it a 1000 times.

3. Here's a pseudo program that I came up with:

<BEGIN>

Strategy = switch or no_switch?
(programmer sets the strategy before starting the simulation)

<LOOP>

Win = 0
Count = 1

Actual = random integer between 1, 2, and 3

(Game organizer picks a box to place the key randomly)

Choice = random integer between 1, 2, and 3
(player makes initial choice randomly)

If Choice <> Actual, then Open = 6 - Actual - Choice
(if the initial choice did not hit the prize, the host will open the empty box from the 2 that were not chosen. Since I use numbers 1, 2, and 3 to represent the 3 boxes, and 1 + 2 + 3 = 6, then 6 - Choice - Actual will give the box number that the host will open in this case)

If Choice = Actual = 1, then Open = random between 2 and 3
If Choice = Actual = 2, then Open = random between 1 and 3
If Choice = Actual = 3, then Open = random between 1 and 2

(If the player picks the right box initially, the remaining boxes are both empty, and the host can open either one and his choice is random.)

If (Stragety = no_switch and Choice = Actual) then Win = Win + 1
(if the player does not switch, he wins if he has picked the right box initially)

If (Strategy = switch and Choice <> Actual) then Win = Win + 1
(If the player switches, he wins if he has not picked the right box initially)

Count = Count + 1

If Count < 1000 then goto <LOOP>

<END>

I will do a simulation in Excel to try this out.

- Roy

4. Originally posted by roygoh
Here's a pseudo program that I came up with:

<BEGIN>

Strategy = switch or no_switch?
(programmer sets the strategy before starting the simulation)

<LOOP>

Win = 0
Count = 1

Actual = random integer between 1, 2, and 3

(Game organizer picks a box to place the key randomly)

Choice = random integer between 1, 2, and 3
(player makes initial choice randomly)

If Choice <> Actual, then Open = 6 - Actual - Choice
(if the initial choice did not hit the prize, the host will open the empty box from the 2 that were not chosen. Since I use numbers 1, 2, and 3 to represent the 3 boxes, and 1 + 2 + 3 = 6, then 6 - Choice - Actual will give the box number that the host will open in this case)

If Choice = Actual = 1, then Open = random between 2 and 3
If Choice = Actual = 2, then Open = random between 1 and 3
If Choice = Actual = 3, then Open = random between 1 and 2

(If the player picks the right box initially, the remaining boxes are both empty, and the host can open either one and his choice is random.)

If (Stragety = no_switch and Choice = Actual) then Win = Win + 1
(if the player does not switch, he wins if he has picked the right box initially)

If (Strategy = switch and Choice <> Actual) then Win = Win + 1
(If the player switches, he wins if he has not picked the right box initially)

Count = Count + 1

If Count < 1000 then goto <LOOP>

<END>

I will do a simulation in Excel to try this out.

- Roy
Cool! [Drum roll await the answer...]

5. Your pseudo code looks alright. But make that 1000000 iterations. 1000 might not be enough to balance the result, CPU power is cheap anyway nowadays.

6. Originally posted by Zerstorer
Your pseudo code looks alright. But make that 1000000 iterations. 1000 might not be enough to balance the result, CPU power is cheap anyway nowadays.
If you agree with my pseudo code, then I would like to draw your attention to the part where it computes the win or lose for each game.

If the strategy is not to switch, the player wins only if he picks the right box the first time, and it does not matter which box the host opens because he is not going to switch anyway.

So holistically, his chances of winning is only 1/3.

If his strategy is to switch, the player wins if he picks the wrong box initially, and the host will only open the empty box, thus his chances of winning is 2/3.

Hope you don't feel like I have tricked you in any way.

When working on the pseudo code, I realised that the part on the win or loose calculation demonstrates pretty well that the option to switch is not a random choice for the player, thus it cannot be considered an independent event. So one has to look at the entire game holistically to determine the odds of winning for both strategies.

The only possible way to make the second decision totally independent from the first is to take the remaining 2 boxes and shuffle them randomly and the let the player choose again. Then will the chances of winning be 50-50.

- Roy

7. Ok, I see what you mean.

It would be fun to see the resultant output though.

8. Originally posted by Zerstorer
Ok, I see what you mean.

It would be fun to see the resultant output though.

I enetered the formulars for each statge in a different column, and duplicated the row of formulars into 5000 rows, simluating playing the game 5000 times.

I then accumulated the numer of wins for each strategy.

I also opened the worksheet a few times to generate different simulations of 5000 games each.

You want to know my findings? Would you believe if I tell you that the number of winnings over the total number of games played if the player does not switch averages out to be 1/3.

If he switches, he wins 2/3 of the time.

I would be greatly honoured if I have finally convinced you.

Please run the simulation yourself if you are curious enough.

- Roy

9. Lost track of the original question which was whether to "switch" rather than to choose again. That made the crucial difference.

10. Originally posted by Zerstorer
Lost track of the original question which was whether to "switch" rather than to choose again. That made the crucial difference.
Switch or choose again is the same, as long as the 2 boxes are not scrambled before the player makes his second decision.

As long as the location of the key does not change randomly between the first and second decisions, the second decision should be to switch to increase the odds of winning from 1/3 to 2/3.

11. Roygoh, if the program is written in FORTRAN 77 and you need parallel programming to run the code due to its many iterations, let me know as I may be able to help. I have access to 32 processors.

Regards,
TM

12. Originally posted by trendmatrix
Roygoh, if the program is written in FORTRAN 77 and you need parallel programming to run the code due to its many iterations, let me know as I may be able to help. I have access to 32 processors.

Regards,
TM

In the program coding itself already shown that the strategy to switch has higher odds of winning even before running it.

Thanks for the offer anyway. I will keep that in miind in case I really need such processing power in future.

By the way, FORTRAN 77? Have not been doing software. Is this language still in use and not taken over by C? Please pardon my ignorance.

What kind of processors do you have?

13. Originally posted by roygoh

In the program coding itself already shown that the strategy to switch has higher odds of winning even before running it.

Thanks for the offer anyway. I will keep that in miind in case I really need such processing power in future.

By the way, FORTRAN 77? Have not been doing software. Is this language still in use and not taken over by C? Please pardon my ignorance.

What kind of processors do you have?
Yeah... Fortran 77 cos I am only good at that... I am a total nerd in C... hahaha..

Erm... I have access to Origin 3000 (32 processors), Origin 2000 (32 processors) and Sun (32 processors). But I am not so familiar with Sun systems as the message passing interface to be used is a bit different. The Origin 2000 however, is slower than Origin 3000, hence I use the later more often...

14. Originally posted by roygoh
Say the player is allowed to pick 2 out of 3 chests. What is his chances of winning?

2/3, right?
this is ambiguious - are you saying,
1) 3 chests - and 2 chests each have, say, a key and a spare key, so that you must choose both chests correctly before you get the prize?

OR

2) 3 chests, 2 chests have each the main key and the spare key, and you need to choose any 2 chests, if one gives you the key and the other is empty, you still get the prize?

if in 2), your probablilty is 2/3 x 1. but in 1), your probablity would be 1/3 x 1/3 = 1/9, since you can have permutations, or lesser, since we need the combinations only.

but pertaining to the original situation, i'll still say it's 1/2.

15. Although I can't believe it, it seems that based on simulation, the probably of winning is really 2/3. I've written an indpt program different from Roy (didn't use his pseudo code), but it ended up with the same conclusion.

Code:
```switch = 1

totalLoops = 100000
wins = 0
choice = 1

FOR x = 1 TO totalLoops
prize = INT(RND(1) * 3 + 1)

IF choice = prize THEN
IF switch = 0 THEN win = win + 1
ELSE
IF switch = 1 THEN win = win + 1
END IF

LOCATE 1, 1
PRINT x; win
NEXT x```

16. Originally posted by darkness
Although I can't believe it, it seems that based on simulation, the probably of winning is really 2/3. I've written an indpt program different from Roy (didn't use his pseudo code), but it ended up with the same conclusion.

Code:
```switch = 1

totalLoops = 100000
wins = 0
choice = 1

FOR x = 1 TO totalLoops
prize = INT(RND(1) * 3 + 1)

IF choice = prize THEN
IF switch = 0 THEN win = win + 1
ELSE
IF switch = 1 THEN win = win + 1
END IF

LOCATE 1, 1
PRINT x; win
NEXT x```
Hi,

Thanks for doing the simulation.

From your code, it is also obvious that the win-or-lose is dependent entirely on "If choice = prize", which has a probability of 1/3. If the player does not switch, then his chances of winning is 1/3, if he switches, then it becomes 2/3.

- Roy

17. i non computer/maths guy but....

Should the code incorporate the fact that 1 of out 3 times, the simulation has to be discarded because the host actually opened the chest with prize?

Or is there an assumption that the host knows which chest has the prize and only opens chests without prizes?

If the code already incorporates this then sorreee lah....

18. ## New twist to the problem!

First a few comments to Roy's QBasic codes:

The prg is correct but it's coding the wrong logics, i.e. it doesn't take care of the situation that an empty box was opened by the host. Naturally the result will be 1/3 and 2/3. If you change
prize = INT(RND(1) * 3 + 1) to
prize = INT(RND(1) * 2 + 1) , the answer will be 1/2 and 1/2 because the third box can't contain the prize.

Now please allow me to give a new twist to the problem.
We still have three boxes, A, B and C but we now have 2
players X and Y. Let's say X chooses A, and Y chooses B. Supposed the host opens box C which happens to be empty (if it contains the prize, both players lose - no need for advice).

What does the "switching camp" advise our players now? X to switch to B but Y to switch to A? We have a paradox here:
1) Switch for both players mean that both will have 2/3 probability which add up to >1, obviously not allowed.
2) Prob(box to contain a prize) changes depending on who chooses it.

For box A, it is 1/3 for X but 2/3 for Y
for box B, it is 2/3 for X but 1/3 for Y
we would expect probability to be at least impartial!

How now

19. Originally posted by roygoh

I would be greatly honoured if I have finally convinced you.
- Roy
After much deliberation, i realised my arguments were conceptually flawed. I believe the answer is like what you have said.

Great work there...

20. Originally posted by erwinx
i non computer/maths guy but....

Should the code incorporate the fact that 1 of out 3 times, the simulation has to be discarded because the host actually opened the chest with prize?

Or is there an assumption that the host knows which chest has the prize and only opens chests without prizes?

If the code already incorporates this then sorreee lah....
Hiyah...I stressed so many time already...the host KNOWS which box contains the key, so he will never open that. Hie sole purpose of opening the empty one and offering the trade is to tease the player...

Page 4 of 6 First ... 23456 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•