



 Great article, as always :)
The part about probability I found very refreshing, reminded me of Scott Adams' stuff from God's Debris.
Nice work 


 Oh.. and do I give out the solution of the honest man problem here?? 


 Thank you. For the solution, if you want, you can send me a mail. Not posting it here will result in a major enjoyment for the people who will be interested into solving it.
Cheers



 Here's another classic that I feel obligated to contribute:
You're watching Monty Phan's "Let's Make A Deal." A contestant is faced with three garages  one has a new car, the other two have Eskimo Pies. The contestant chooses Garage #1. First, Monty Phan opens Garage #3; it contains Eskimo Pies. The contestant then says, "Wait! Can I switch?"
Believe it or not, by switching to Garage #2, he's increased his chances of winning. WHY? 


 hehe monty hall problem. everyone should write a program to monte carlo test it. 


 

 I never heard of monty hall problem. Very nice I have to say. 


 i wrote a program to test it (monty hall) .
but it doesn't seem to show that he has more chance of winning with #1 or #2 . But maybe i misunderstood it .
the program makes about a 1000 runs in wich it randomly places the car in one of the boxes , and counts the number of times to car is in box #1 and #2 


 Monty Hall is usually stated like:
You pick one of the three doors. Then Monty opens one of the remaining doors to show that there is nothing behind it (or, an Eskimo Pie). Then you decide whether you should stick to your original door or switch to the last door. The important thing is that Monty always eliminates a bad door. 


 ah thx .
i was wondering about that 3rd door in the example 


 Well, it's a paradox but you can seize this problem with a statistical analysys. You have 1/3 of chances to pick the car and 2/3 of chance to pick a goat. If you don't switch, knowing where a goat is it's not helpful and you stick to your 1/3 of probability to win the car. But if you switch, in case you chose a goat, the other one gets showed to you, so then you choose the car.
E.G.
1 choose goat 1 > see goat 2 > switch to the car
2 choose goat 2 > see goat 1 > switch to the car
3 choose the car > see random goat > switch to the other goat
As you see, when you switch, you win the car 2 times out of 3, which means with 2/3 of probability. If you don't switch and stick to your first choice you win the car just when you're lucky enough to pick it at first, with 1/3 of probability.



 well , i made somechanges to my program , and it actually proves your right . 


 the Monty Hall problem was also mentioned in Marilyn vos savant's column... and even though she has the highest IQ, there is a logic problem. as in the Anonymous Goat examples, it is unfair to say that there is only one weight for item 3.
it should say:
3 choose the car > see goat 1 > switch to goat2
4 choose the car > see goat 2  switch to goat1
this way you are correctly back to 5050.
if you think about it, you are still choosing between 2 doors, even if you stay where you are, which is the point of the coin flip warning... 


 it's confusing for sure .
i wrote a program to try it out , and it shows that the sucess rate is higher when you switch it , than when you stick to the same . ( about 2x , though it varies )
but off course , i could have made a mistake somewhere , it wouldn't be the first time :)



 i put the source on my osidrive , so you can check if it's working correctly
http://www.osix.net/modules/folder/index.php?tid=12204&action=vf 


 Sorry about the omission. It's a little bit easier to understand if you use a deck of cards. Say you have to pick the Ace of Spades. You draw your card  a 1/52 chance of getting the ace. Then, someone throws away fifty of the other cards. Now it's clear that you should switch, because one of the two cards is an ace. Since the one you're holding has a 1/52 probability of being correct, the other must have a 51/52 probability of being correct, so it is better to switch. The Monty Hall problem is similar, but on a smaller scale, so it is more difficult to visualize. 


 jonoringading: no the odds actually are 2/3. splitting choice 3 into two different options is invalid, since the only difference between your 3 and 4 is the door monty opens, not the door you've chosen.
using your options, here is the full case list:
1  choose goat 1 (1/3) > see goat 2 (1/1) = switch to car (1/3 * 1/1) = 1/3
2  choose goat 2 (1/3) > see goat 1 (1/1) = switch to car (1/3 * 1/1) = 1/3
3  choose car (1/3) > see goat 1 (1/2  NOTE THE DIFFERENCE HERE) = switch to goat 2 (1/3 * 1/2) = 1/6
4  choose car (1/3) > see goat 2 (1/2  NOTE THE DIFFERENCE HERE) = switch to goat 1 (1/3 * 1/2) = 1/6
the coin flip warning only works for independent events, the two events of choosing a first door and switching are not independent, because monty is not picking his door to reveal at random. he will, with 100% odds open a losing door.
innocentius provides a nice example of a more extreme case.
and if you still don't believe us, then run kdemetter's code. 


 here's code (it hasn't been tested or compiled because I'm at work and my dev comp is being lame), it is nicely commented though
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#define NUM_ITER 10000
int main(int argc, char *argv[]) {
srand(time(NULL));
int winsWithSwitch = 0;
int winsWithoutSwitch = 0;
for(int q=0;q<NUM_ITER;q++) {
// Randomly pick the winner
int winner = rand()%3;
// And randomly pick the first choice
int firstChoice = rand()%3;
int opened;
for(int i=0;i<3;i++) {
// eliminate the door if it isn't the winner and isn't the first choice
if(i!=winner && i!=firstChoice) opened = i;
}
int secondChoice;
for(int i=0;i<3;i++) {
// second choice would be the door that isn't opened and isn't the first choice
if(i!=opened && i!=firstChoice) secondChoice = i;
}
if(firstChoice==winner) winsWithoutSwitch++;
if(secondChoice==winner) winsWithSwitch++;
// Note now that there are only two options, and firstChoice != secondChoice (see code above),
// and neither of the two equals opened (again, see code above). So either firstChoice or
// secondChoice will be the winner. Nothing has changed about firstChoice since it was
// initially chosen, so why would it automagically have better odds of winning once Monty
// opened a losing door?
//
// ANSWER: It wouldn't, but secondChoice would, because it is essentially the two nonfirstChoice
// doors collapsed into one choice by Monty's revealing of a losing door.
}
// Proof of my claim
printf("Wins without switching: %i\nWins with switching: %i\n", winsWithoutSwitch, winsWithSwitch);
return 0;
}



 

 All those ints strewn everywhere gives me the creeps 


 hooray for wikiality!
anyway that's a good wikipedia article. should make it easier for me to explain the solution to people in the future. 


 Sorry folks, I still don't beliee you
int secondChoice;
for(int i=0;i<3;i++) {
// second choice would be the door that isn't opened and isn't the first choice
if(i!=opened && i!=firstChoice) secondChoice = i;
}
is not correct
the second choice is simply another random choice between the 2 unchosen doors, you are building in bias by not including the choice of sticking with the first door. 


 it is correct: secondChoice is the door that you would pick when you switch, firstChoice the one that you picked first. 


 janus is right, secondChoice is used to count wins if you DO switch, firstChoice is used to count wins if you DON'T switch. my code doesn't make a random choice, it counts how often you'd win if you stuck with one or the other of the two strategies for every single time you got to play the contest and then compares the two. see:
if(firstChoice==winner) winsWithoutSwitch++;
if(secondChoice==winner) winsWithSwitch++;
.
.
.
// Proof of my claim
printf("Wins without switching: %i\nWins with switching: %i\n", winsWithoutSwitch, winsWithSwitch)



 jonoringading .
the are only 3 doors .
 the first is randomly chosen .
 the bad door is chosen taken a wrong door that isn't the first .
so there is only one left , and that's the second choice .
so second door is not random chosen .
If all these arguments don't convince you , nothing will.



 in my previous post :
"second door " should be "second choice " 


 it's pretty obvious..
before being revealed: the first door has 1/3 odds,
after being revealed, that door STILL has 1/3 odds, so obviously the remaining doors must share between them the remaining 2/3 odds.. you are given that one of them is 0/3, thus the 3rd door must be 2/3 odds... simple logic: forget all the induction and math :P 


 Understanding the problem is actually easier by flipping the premise of success, and extending the number of doors. If you have 50 doors, there is a 49/50 chance of picking a loser door, almost guaranteed. You are guaranteed to get to the final 2 doors, so stick with that door till the final 2. If you've managed to pick a LOSER at first, it gets inverted to a winner in the final 2. Well that is what changed my thinking on the issue, makes sense now. Assuming random chance *will* give you a 5050 chance, but the tactic will give you a slight advantage if you stick with your choice till the last 2 and swap. 


 The 0.999...=1 thing is easier to prove without involving any math whatsoever. For real numbers, if two numbers aren't equal, there are going to be more numbers between them. So, if 0.999... was less than 1, you should be able to find some other number in between them. However, whatever you choose as the number between them, it's intuitively true that 0.999... is going to be greater than that. So, since there are no numbers in between them, it means they must be equal. 


 Monty Hall problem is lovely. It's important to remember that probability always applies to a specific source of knowledge, in this case the placement of prize over the three doors is what's random. After Monty opens one door, that source doesn't change. It's not uniformly over the two doors now, the original source of probability is still the same  over the three doors.
Now, as Monty opens the door, you have been revealed new information about the original source of probability. This new knowledge is not merely "this door was wrong one", the information you receive is "if either of these two doors is the right one, it's the other one". This is because the information isn't independent from the original source of probability.
Your original choice had 1/3 chance, the other two had 1/3 each. Since Monty reveals which of the other two you should've picked if either of them was correct, that door now holds the probability for both of the doors. This is because, again, the probability is related to knowledge that existed before any door was opened.
Ofcourse, if you always pick the leftmost door as your first choice, then you cannot know what the probability distribution was for the original doors. For this reason, you should always pick the first door randomly, through a true source of randomness such as throwing a dice. After that, it no longer matters which door the prize was placed behind, the Monty's source of randomness is modulated by your dice's source of randomness so each door will have a perfect 1/3 chance at the beginning. Assuming you have a perfect dice, anyway.
Remember kids. There are no random choices, there are no random numbers. There are only sources of randomness, sources of unknown information. 


 Anyway, the flip a coin thing above is nasty one because it seems so obviously false, yet common people often fall for its variations. One particular example I remember from years ago, I was sitting in McDonalds and listening to other people chatting.
There had just been elections, and the votes were being counted, with one area having a delay. Two guys were arguing about how the delayed area is going to vote, and the logic was: "X is currently winning a little, but according to polls Y ends up winning a little, so a lot of people in that area are voting for Y. Really lot". I was amazed to think that anyone could do such a logical mistake.
Then again, I remember thinking like that about dice throwing when I was 8 or something. Throwing 6 three times in a row was unlikely, so OFCOURSE it must've been still equally unlikely to get 6 even if you threw it twice first. RPG games permanently fixed (most of) my misconceptions about probability, though. It's a good thing kids play a lot of games nowadays :) 


 Well, it can be proved in several ways. Another one is:
x=0.9
then 10 * x = 9.9
But 10xx=9x hence
9.9  0.9 = 9
And since 9x=9, x=1 (and therefore 1=0.9)
The reason why I chose to demonstrate it with maths is that I like that particular demonstration that leaves no room for questions or disagreement.
Cheers 


 sfabriz, your proof is wrong, 9x isn't 9, its 8.9 repeating.(9*0.999...) 


 37037037 times any multiple 3 thru 27 has interesting results 


 37037037 * 3 = 111111111
37037037 * 4 = 148148148
37037037 * 5 = 185185185
37037037 * 6 = 222222222
37037037 * 7 = 259259259
37037037 * 8 = 296296296
37037037 * 9 = 333333333
37037037 * 10 = 370370370
37037037 * 11 = 407407407
37037037 * 12 = 444444444
37037037 * 13 = 481481481
37037037 * 14 = 518518518
37037037 * 15 = 555555555
37037037 * 16 = 592592592
37037037 * 17 = 629629629
37037037 * 18 = 666666666
37037037 * 19 = 703703703
37037037 * 20 = 740740740
37037037 * 21 = 777777777
37037037 * 22 = 814814814
37037037 * 23 = 851851851
37037037 * 24 = 888888888
37037037 * 25 = 925925925
37037037 * 26 = 962962962
37037037 * 27 = 999999999 


 Hah, that is pretty cool. 


 37037037 * 28 = 1037037036 


 

 also noticed
37037037^2 * 3^2 = 12345678987654321
both a palendrome and is nearly pandigital, also when its squared and multiplied by a 81n^2 gives repeatyness37037037 * (81 * 1^2) = 111111110888888889
37037037 * (81 * 2^2) = 444444443555555556
37037037 * (81 * 3^2) = 999999998000000001
37037037 * (81 * 4^2) = 1777777774222222224
37037037 * (81 * 5^2) = 2777777772222222225
37037037 * (81 * 6^2) = 3999999992000000004
37037037 * (81 * 7^2) = 5444444433555555561
37037037 * (81 * 8^2) = 7111111096888888896
37037037 * (81 * 9^2) = 8999999982000000009
37037037 * (81 * 10^2) = 11111111088888888900
37037037 * (81 * 11^2) = 13444444417555555569
37037037 * (81 * 12^2) = 15999999968000000016
37037037 * (81 * 13^2) = 18777777740222222241
37037037 * (81 * 14^2) = 21777777734222222244
37037037 * (81 * 15^2) = 24999999950000000025
37037037 * (81 * 16^2) = 28444444387555555584
37037037 * (81 * 17^2) = 32111111046888888921
37037037 * (81 * 18^2) = 35999999928000000036
37037037 * (81 * 19^2) = 40111111030888888929
Then again doing anything with 9s of it tends to make something with repeaty qualities 


 



