Wednesday, 28 May 2014

probability - How to get a uniform 1 out of 7 chance, using only a coin and a 6-sided die


There are seven days in a week. Let's say you want to pick one at random, such that each day has an equal chance of being picked as each other day. In other words, the goal is to obtain a uniform random 1/7 chance of picking any of the seven days.


But all you have is a coin and a six-sided die (not dice, you don't have 2 dice, you have only 1 die). What procedure of coin-flipping and/or die-rolling should you use to get a 1/7 chance?


I know of two ways to do this, but they're slightly out-of-the-box solutions. I consider them valid solutions but want to see what you guys think. Of course, I'll let people try to answer first before revealing my solutions.


Hint: don't try anything like trying to pick a random number in your head. The only things you can use are the coin and die.


EDIT: I'm going to post the three answers I know of in the most compact and simple way (in my humble opinion). Everyone who answered so far has given the equivalent of one of these answers:


Method 1.



Roll the die and flip the coin. This gives 12 possibilities: 1T, 2T, 3T, 4T, 5T, 6T, 7T, 1H, 2H, 3H, 4H, 5H, 6H. Assign seven days of the week to seven of those values. If the result is one of the remaining five, just repeat the process until you get a valid value. This has a 5/12 (41.67%) chance of repeating.




Method 2.



Flip the coin three times (and be sure to record it in order of course). This gives 8 possibilities: HHH, HHT, HTH, HTT, THH, THT, TTH, TTT. Assign seven days of the week to the first seven of those values. If your result is the eighth value, repeat the process until you get a valid value. This has a 1/8 (12.5%) chance of repeating.



Method 3.



Roll the die twice (and be sure to record them in order because a 2 and 5 is not the same thing as a 5 and 2 in the sample space!). This gives 36 possibilities: 1&1, 1&2, 1&3, 1&4, 1&5, 1&6, 2&1, 2&2, 2&3, 2&4, 2&5, 2&6, 3&1, 3&2, 3&3, 3&4, 3&5, 3&6, 4&1, 4&2, 4&3, 4&4, 4&5, 4&6, 5&1, 5&2, 5&3, 5&4, 5&5, 5&6, 6&1, 6&2, 6&3, 6&4, 6&5, 6&6. Assigned 7 days of the week, but do that 5 times. This uses up 35 values. If your two rolls results in the 36th value, just repeat the process until you get a valid value. This has a 1/36 (2.78%) chance of repeating, which is much smaller than the previous two methods.



Some concluding thoughts...




Now that I think about it, you could extend the multiple rolls/tosses. If you flipped the coin 6 times, that's 64 possibilities, and 63 is evenly divisible by 7 so you can assign days of the week to that, and just repeat if u get the 64th value (1 out of 64 chance = 1.56%!). You could roll the die 4 times for 1,296 possibilites. 1,295 is divisible by 7, so assign days of the week evenly to all those values, and just repeat if u get the 1,296th value (1 out of 1,296 chance = 0.08%!!!). You can probably go even further with them, but it's a trade off of doing more rolls/tosses, which takes a longer time and might take longer to compute the result, than just taking the 1/36 chance of having to repeat via the 2 roll method, for example.





No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...