Go Down

### Topic: Urgent help needed with bar puzzle (Read 14906 times)previous topic - next topic

#15
##### Aug 12, 2013, 08:00 pm
Quote
you have 2 ashtrays, there is a coin under one of the ashtrays.  You have one ashtray under your hand and the other is not.  The location of the ashtrays has no bearing on the odds.  They are still 50:50.  The current odds are not dependent on previous odds.

Wrong @flyboy - want to bet on it  \$) ?

If we started with 2 ashtrays the odds of the coin being under the ashtray under my hand are 50:50.
However we started with 3 ashtrays so the odds of the coin being under the other ashtray are 2:3, I have twice as much chance of winning if I change.

There is no trick here just maths, but it is very counter intuitive.

#### robtillaart

#16
##### Aug 12, 2013, 08:19 pmLast Edit: Aug 12, 2013, 08:29 pm by robtillaart Reason: 1
Think you must view it from the barman point of view.

scenario 1: the coin is under the ashtray selected.
=> the barman has two trays to choose from to turn
=> which leaves you with a 50% chance

scenario 2: the coin is not under the ashtray selected.
=> The barman must turn the other ashtray without the coin. He has no choice left (this is essential!)
=> in this scenario you must select the other ashtray. 100% sure

The chance of scenario 1 to happen is 1 in 3
The chance of scenario 2 to happen is 2 in 3

so by selecting the other ashtray your total chance becomes 1/3 * 50% + 2/3 * 100% => 83.3 %

( no math expert, as my final number differs from the wikipedia? )
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

#17
##### Aug 12, 2013, 09:03 pm
@robtillart - nope!

The odds that the krugerrand is under the ashtray I chose first is always 1:3 or 33.333%.
The odds that the krugerrand is under the other ashtray is always 2:3 or 66.666%.

Try and think of this way;

Before any ashtrays are turned over the odds of the krugerrand being under each ashtray is 1:3.
Therefore when I choose an ashtray the chance of the krugerrand being under my chosen ashtray is 1:3.
The chance that it is under the other two ashtrays is 2:3.

Everybody must agree on the above - yes?

Now the barman knows which ashtray the krugerrand is under (which may be the one I have chosen it may not, it does not matter).
The barman always turns over an ashtray which does not have the krugerrand under it.

Here is the difficult bit; For me the barman turning one of the pair over has not changed the probability that the krugerrand is under one of that pair, that probability remains 2:3. However, clearly, I can see that the kruggerand is not under the ashtray he turned. As a result the entire 2:3 probability now resides in the unturned ashtray which I have not chosen.

The barman always gives me the chance to change my choice.
I should always accept because I always double my odds of getting the coin.

#### wizdum

#18
##### Aug 13, 2013, 12:11 am
Here's a video explanation: http://testtube.com/scamschool/scamschool-108/

#19
##### Aug 13, 2013, 03:39 amLast Edit: Aug 14, 2013, 06:07 pm by Coding Badly Reason: 1
The odds that the krugerrand is under the ashtray I chose first is always 1:3 or 33.333%.

Unless I made a coding mistake, Monte Carlo says you have that backwards correct...

State.h
Code: [Select]
`#ifndef States_h#define States_htypedef enum {  sStart            = 0b00000000,  sKrugerrand       = 0b00000001,  sBarmanFlipped    = 0b00000010,  sFirstGuess       = 0b00000100,  sSecondGuess      = 0b00001000,  sChangedMind      = 0b00010000,} state_t;#endif`

Krugerrand.ino
Code: [Select]
`#include "States.h"void setup( void ){  Serial.begin( 115200 );}static void SetState( state_t & set, state_t element ){  set = (state_t)(set | element);}static void PrintState( state_t set ){  if ( set & sKrugerrand ) Serial.write('K'); else Serial.write(' ');  if ( set & sBarmanFlipped ) Serial.write('B'); else Serial.write(' ');  if ( set & sFirstGuess ) Serial.write('1'); else Serial.write(' ');  if ( set & sSecondGuess ) Serial.write('2'); else Serial.write(' ');  if ( set & sChangedMind ) Serial.write('C'); else Serial.write(' ');}static uint32_t Same;static uint32_t Change;static uint32_t Total;static uint32_t Paydirt;void loop( void ){  state_t Ashtray[3];  uint8_t FirstGuess;  uint8_t SecondGuess;  uint8_t i;    Ashtray[0] = sStart;  Ashtray[1] = sStart;  Ashtray[2] = sStart;    SetState( Ashtray[random(0,3)], sKrugerrand );  FirstGuess = random(0,3);  SetState( Ashtray[FirstGuess], sFirstGuess );    do  {    i = random(0,3);  }  while ( Ashtray[i] != sStart );    SetState( Ashtray[i], sBarmanFlipped );/*  if ( random(0,2) == 0 )  {    ++Same;    SecondGuess = FirstGuess;    SetState( Ashtray[SecondGuess], sSecondGuess );  }  else*/  {    ++Change;    for ( int8_t i=0; i < 3; ++i )    {      if ( (Ashtray[i] & (sBarmanFlipped | sFirstGuess)) == 0 )      {        SecondGuess = i;        SetState( Ashtray[SecondGuess], sSecondGuess );        SetState( Ashtray[SecondGuess], sChangedMind );        break;      }    }  }    for ( int8_t i=0; i < 3; ++i )  {    if ( (Ashtray[i] & (sKrugerrand | sSecondGuess | sChangedMind)) == (sKrugerrand | sSecondGuess | sChangedMind) )    {      ++Paydirt;      break;    }  }  ++Total;/*  for ( int8_t i=0; i < 3; ++i )  {    PrintState( Ashtray[i] );    Serial.write( '\t' );  }*/  if ( (Total & 0x000000FF) == 0 )  {/*    Serial.print( (Same * 1000) / Total );    Serial.write( '\t' );*/    Serial.print( (Paydirt * 1000) / Total );    Serial.println();  }}`

#### flyboy

#20
##### Aug 13, 2013, 06:15 pm
I still have to disagree.  The previous conditions have no bearing on the new odds.  The odds are 50:50 because you now only have 2 ashtrays and only 1 of them has the coin under it.  The fact that the bar man will always offer for you to change your selection means that he has no bearing on the odds.  Yes, in the previous test, you had a 1 in 3 chance.  In the current test, you have a 1 in 2 chance.  The removal of the ashtray changes the conditions and starts a new test.  The current test is not dependent on previous odds, unless the bar man turned over an ashtray with the coin.  Since he did not, the odds are now 50:50.  There is nothing counter-intuitive here.  The doubt in your own mind is the problem, not the odds of finding the coin.

#21
##### Aug 13, 2013, 08:00 pm
@flyboy

Try an alternative way of looking at the same thing;

From a pack of playing cards take 9 face cards and 1 ace.
Shuffle the 10 cards and spread them randomly, face down, on a table.

Chose 1 card without looking at and push it to one side.

You now have two piles of cards on the table.
One pile has just 1 card in it, the other has 9.

It is quite obvious that every individual card has a 1:10 chance of being the ace.
It is equally obvious that the ace is far more likely to be in the big pile, in fact a 9:10 chance.

Now start picking cards from the big pile one at a time and turn them over.
With every card you turn which is a face card, the odds of the next card you turn being the ace grow they don't diminish.

It took me ages to get my head round this. I book I am reading reminded me of the problem so I threw it into Bar Sport to provoke a brawl because it goes so against common sense that people find it hard to accept. Consider that even if you turn the last card over and it is not the ace the probability of it being in that pile was still 9:10 and on average will prove to be so.

This is not like tossing a coin. As soon as you decide on the total number of cards the odds become fixed. Probability is a weird thing.

#22
##### Aug 13, 2013, 08:16 pm
@wizdum your video explains things quite well and they are in a bar!
I was able to fast forward through the ads.

I like the statistic that 10,000 people wrote to a magazine, including 1,000 PhDs, incorrectly saying the saying the answer was wrong.
So, if somebody thinks the odds are 50:50, don't worry you are in good company.

#23
##### Aug 13, 2013, 09:36 pm
Thinking about the video one point it makes is very good.

When you choose your ashtray you know that the the probability is that you have not chosen the coin.
You know mathematically that the chances are the coin is under the other ashtrays.

When you are shown that one of the other ashtrays does not have the coin under it, if you were completely logical and rational, then it should be clear that the ashtray you have not chosen is now twice as likely to cover the coin as the one you have chosen - but the human mind is not wired like a Vulcan. Mr Spock would not make this error.

#24
##### Aug 14, 2013, 10:59 am
Below are three Truth Tables which I hope will convince any remaining sceptics that you are always better change from your first choice.

If you stick with your first choice then to win you must select the coin first time and you have only a 1:3 chance of doing that. Changing position takes advantage of information provided after the first choice was made and doubles your chance of winning.

 OO\$ One of three places the coin could be hidden F?? ?F? ??F All possible first choices FO? OF? O?F Reveal an empty location FOS OFS OSF Show second choice S S F WINNER - Second choice wins 2 out of 3 times

 O\$O Two of three places the coin could be hidden F?? ?F? ??F All possible first choices F?O OF? O?F Reveal an empty location FSO OFS OSF Show second choice S F S WINNER - Second choice wins 2 out of 3 times

 \$OO Three of three places the coin could be hidden F?? ?F? ??F All possible first choices F?O ?FO ?OF Reveal an empty location FSO SFO SOF Show second choice F S S WINNER - Second choice wins 2 out of 3 times

#25
##### Aug 14, 2013, 11:04 am

"Reveal an empty location" is incomplete.  There is one other possibility for each table.

#26
##### Aug 14, 2013, 11:38 am
Quote
"Reveal an empty location" is incomplete.  There is one other possibility for each table.

Well spotted @CodingBadly. That annoyed me but I could not figure an easy and tidy way of representing that in the tables. However it does not affect the outcome.

If the person correctly guesses the location of the coin first time and does not change his choice then he will win, but if he changes his choice he will lose. Only one of the empty locations is revealed and, whichever it is, the outcome is always the same.

Below are a couple of sub-tables showing that which empty location is revealed has no impact.

 O\$O ?F? OF? Reveal one of the two possible empty locations OFS F WINNER

 O\$O ?F? ?FO Reveal the other of the two possible empty locations SFO F WINNER

#### John_Smith

#27
##### Aug 19, 2013, 05:35 pmLast Edit: Aug 19, 2013, 07:23 pm by Boffin1 Reason: 1
Hmm    are they glass ashtrays ?

And anyone offering you a 50% or 33% or 66% chance of a free Kruger Rand in a bar, ain't going to play fair :-)

Having read a bit about it, I can see how it works  ( from Popular Solution on http://en.wikipedia.org/wiki/User:Rick_Block/Monty_Hall_problem_%28draft%29 ).

It is the interference of the barman in removing a choice that changes it from being a 50/50 guess.
45 years of editing projects with a knife and soldering iron, then I found Arduino !

#28
##### Aug 19, 2013, 09:36 pm
Quote
Having read a bit about it, I can see how it works

It is very hard to see though, and many a long argument has been had about it.

#### John_Smith

#29
##### Aug 19, 2013, 11:48 pm
It certainly goes against instinctive logic, but the table below shows it clearly ( assumes you picked door 1 )

( its doors not ashtrays, and a car for kruger rand, and goat booby prize )

Door 1     Door 2    Door 3    result if switching    result if staying
Car          Goat            Goat        Goat                     Car
Goat         Car            Goat          Car                            Goat
Goat         Goat        Car            Car                            Goat

So you win twice as often if you switch.

If your first guess was right, you will lose by switching.
Or, if your first guess is wrong, you will always win if you switch, and always lose if you don't ( see table )
45 years of editing projects with a knife and soldering iron, then I found Arduino !

Go Up