23

To allow new users to solve this puzzle and earn reputation points, I encourage all users whose reputation is 200 or more to not post an answer until 48 hours after this question is posted. Thank you!


You are at a crossroads with five roads leading away from it, and you don't know which direction to go. You would like to choose randomly, with equal probability for each road.

5 roads intersecting at a center point

If your only way of making random choices is to flip a fair coin (one that could come up heads or tails with equal probability), you could assign one of the roads to each of the sequences HHH, HHT, HTH, HTT, and THH. Those outcomes are all equally likely, so you know that if you flip three times and choose the corresponding option, each one of them will have an equal chance. The problem is that there are three outcomes that are not assigned to any road, so if one of those three comes up you will have to try again. Therefore, it could take you arbitrarily long to make your decision, if you are unlucky and keep getting one of the unassigned outcomes.

You don't have all day to stand around, so you'd like a better method. But it turns out that people have proved there is no process with a single fair coin that is guaranteed to finish in a finite amount of time and choose one of five options with equal probability.

Now suppose you are allowed to have more than one type of coin, each one marked with the probability that it comes up heads. What's the fewest flips you would need to choose your direction? How many coins do you need, and what's a set of probabilities for the coins that lets you do it in that minimal number of flips?

Bonus question: Can you do it with just one coin?

Clarification of bonus question: In other words, does there exist a single coin with a certain fixed probability (you can pick the probability) of landing heads when randomly flipped such that there is a process that is guaranteed to allow you to select one of the roads randomly (each with probability 1/5) with a finite number of coin flips?


This puzzle comes from THE PRISON MATHEMATICS PROJECT NEWSLETTER FALL 2023 - ITERATION 7

I created the roadway diagram.

Will Octagon Gibson
  • 9,220
  • 1
  • 19
  • 98
  • 3
    That's not a crossroad – Richard Dec 31 '23 at 14:40
  • Regarding the bonus question: Can do what with just one coin? Choosing 1/5 with minimal coin flips, with any limited number of n coin flips or do it at all? the latter is already given in the question. – Helena Dec 31 '23 at 15:50
  • @Richard According to the online dictionary at https://www.merriam-webster.com/dictionary/crossroad, one definition of crossroads is, “the place of intersection of two or more roads.” – Will Octagon Gibson Dec 31 '23 at 20:28
  • @WillOctagonGibson - But these roads aren't crossing each other. – Richard Dec 31 '23 at 20:32
  • 3
    @Richard For the purposes of this question, let’s define crossroads as the meeting place of the 5 roads in the diagram I provided. By the way, I didn’t pick the word crossroads, it was chosen by the person that originally made this question. I don’t like changing the wording of other people’s questions. – Will Octagon Gibson Dec 31 '23 at 20:38
  • 1
    @Helena I have added a clarification to the bonus question. Does it make sense now? – Will Octagon Gibson Dec 31 '23 at 20:56
  • 7
    Draw an arrow on each side of the coin. Spin the coin. Eventually it will fall flat with the arrow pointing at one of the roads. (Or at least at one of five 72 degree sectors representing the roads.) – Neil Jan 01 '24 at 00:35
  • 5
    Presumably I reached the crossroads via one of the five roads. Retracing my steps seems futile, as I already know what was there. So I flip once for left/right, and again for acute/obtuse angle. And I'm done. – Paul_Pedant Jan 02 '24 at 10:08
  • 4
    @Paul_Pedant you were obviously dropped from the sky in this scenario. – Falco Jan 02 '24 at 12:00

7 Answers7

23

I can do it in

three flips of two coins by

Have one coin that shows heads with probability $\frac 15$ and one that shows heads with probability $\frac 12$. Flip the first coin. If it shows heads you choose the first road. If the first coin shows tails two flips of the fair coin selects between the other four.

To show we can't do it in less

With only two flips you have a coin that you flip first. It can give only two results. For each result you must choose a coin for the second flip but that gives no information. You flip that one and have only four possible results at most, so you can't choose from five roads.

Ross Millikan
  • 8,419
  • 30
  • 47
22

Bonus question

What if there is a single coin? There is a simple way to prove that to obtain 5 equally probable choices is...

possible. As it is possible for any number of choices.

And here is why

With $N$ flips you get $2^N$ outcomes.

The probability of each outcome depends on the number of heads. The probability $p_h$ to get get one specific outcome with $h$ heads is
$p_h = (P^h (1-P)^{N-h}$, where $P$ is the probability to get heads in a single flip.


The number of outcomes with $h$ heads is given by the binomial coefficients.
$a_h = C(N,h)$.
For $N=6$ the number of outcomes by heads count is
$a_h = [1, 6, 15, 20, 15, 6, 1]$.

The trick is to distribute the outcomes evenly not in 5 groups but in 4. We can make 4 equivalent groups by taking the following counts: $b_h = [0, 1, 3, 5, 3, 1, 0]$.
This means take 1 outcomes with 1 heads, 3 outcomes with 2 heads, 5 with 3 heads, etc.
With four such groups you use up most but not all of the outcomes. The remaining counts are as follows.
$c_h = a_h - 4 b_h = [1, 2, 3, 0, 3, 2, 1]$
One outcome with no heads, 2 outcomes with 1 heads, etc... From this you form the 5th group.

The four groups with counts $b_h$ sum up to the same probability. But what about the probability of the last group with counts $c_h$? You can adjust that probability by adjusting $P$. You just need to solve the following.
$\sum p_h c_h = 0.2$ (i.e. 1/nb. of choices)

This might not solve if N is too small. $N=6$ is just large enough.

This amounts to solving a polynomial of degree 6. I am not sure whether there is a way to solve it analytically given the symmetry. Anyway, I solved it numerically.
$P = 0.567363422297041...$

With this $P$ the probability of an outcome in the 5th group is 20%. And since the first four groups are identically composed, their probability is ${1 \over 4} 80\% = 20\%$.

This works for any number of choices. The size of the remainder group grows linearly with N while the total number of outcomes grows exponentially. As soon as the size of the last group is below $2^n \over choices$ there is a solution to the equation.

With a computer I can improve this result.

enter image description here

With five flips and a coin bias at $P = 0.7236067977499784$ you can group the outcomes in five groups that sum up to exactly 20%.

In the table, h is the number of heads, p_h the probabiliy of one outcome with h heads, b_hg are the number of outcomes of each heads count by group, each row is a group, and the value at the right is $\sum p_h b_{gh}$ which is the total probability of each group. It always sums to $0.2$. The bottom row is the sum, it matches the binomial coefficients of the distribution of the outcomes.

The value of P is the solution of $P^5 + (1-P)^5 = 0.2$.

Wolfram alpha solves it as $5 + \sqrt{5} \over 10$

Florian F
  • 29,623
  • 4
  • 63
  • 138
  • 3
    Well done. I was looking for a specific value for $P$ and think I ruled out all rationals plus $\phi$, the golden ratio. Using continuity to prove existence is a better approach. – Ross Millikan Jan 01 '24 at 04:29
  • 2
    Actually, the $p_h$ increase with a factor $\phi+1$. You were on the right track. – Florian F Jan 01 '24 at 20:41
  • So, your coin getting HHHHH or TTTTT is one road. This is obvious. What about the rest? HHHHT and many other combinations is second road, HHHTH + etc is third and so on? – Zizy Archer Jan 03 '24 at 09:52
9

A solution is:

I pick a 5-sided coin like this one. I let it land vertically on one side (between two plates or other surfaces, or inside a string bag maybe) with equal probability and choose the road based on that.

Will Octagon Gibson
  • 9,220
  • 1
  • 19
  • 98
  • 3
    This doesn’t match the description given in the problem. – Sneftel Dec 31 '23 at 17:24
  • 2
    That's a dice, not a coin. – Someone Dec 31 '23 at 18:19
  • 7
    @Someone - It's quite clearly a coin. – Richard Dec 31 '23 at 20:43
  • +1 Cool answer! Welcome to PSE (Puzzling Stack Exchange). Here in Canada we have an eleven-sided coin: https://en.wikipedia.org/wiki/Loonie – Will Octagon Gibson Dec 31 '23 at 21:09
  • 5
    @Sneftel I agree with you that this imaginative answer does not match the intention of my puzzle but I see nothing in the wording of my puzzle that would disallow this solution. – Will Octagon Gibson Dec 31 '23 at 21:23
  • 4
    @LamarLatrell I like everything about this answer (and the user’s reputation) but I will hold off before accepting an answer since this question is generating a lot of answers. – Will Octagon Gibson Dec 31 '23 at 21:43
  • 1
    One could argue that flipping this coin to land on the edge instead of the side could take an arbitrary number of tries. – Falco Jan 02 '24 at 12:01
  • 1
    Well, if we're allowed to modify the coins as desired, why not just go for one that's shaped like a d10 dice? – Vilx- Jan 02 '24 at 12:30
  • 3
    Creative, but this requires that all 5 edges are equiprobable, which I don't think we can guarantee. I think this unfairly extrapolates the ability to pick a coin with specified binary probability to the ability to have a specified 5-way probability. How do you know each edge comes up 20% of the time? That is not a defined feature of the coin you're choosing to flip, only the probability of heads is defined. This erroneously concludes that since there are 5 edges on the coin, they must each come up equally often, despite nothing actually requiring that – Nuclear Hoagie Jan 02 '24 at 14:26
  • 1
    @Falco the answer already explains how to get the coins to land only on its edges: throwing it between two plates – justhalf Jan 02 '24 at 23:38
  • Oh, I misinterpreted the statement… – Someone Jan 03 '24 at 00:23
  • 2
    This is a good answer, but I don't think it should be the accepted one. It's kind of a trick, unlike the more theoretical answers. – Dmitry Kamenetsky Jan 03 '24 at 07:38
  • 1
    @DmitryKamenetsky I like this answer because it so elegantly simple. – Will Octagon Gibson Jan 03 '24 at 08:29
  • Ok well it's your call. – Dmitry Kamenetsky Jan 03 '24 at 11:08
  • @justhalf how does one "flip" a coin (spinning chaotically in the air to create sufficient randomness) and guarantee it will land in the small gap between two "plates" (which are not even defined to exist by the question) ? I would expect the coin to jump out from the gap or land a few mm to one side or roll off and tumble over... it's not even likely you will get it right on the first try. – Falco Jan 04 '24 at 11:50
  • I imagined something like closing it in a string bag (which, true, wasn't mentioned in the question) and shaking. You could also shake and land it between your hands on the floor. – Kombajn zbożowy Jan 04 '24 at 12:55
  • 3
    Thank you for all the comments and warm welcome. The question grabbed my attention displaying in "hot network posts" page and that's how I got here. This solution was first thing that came to my mind and I posted it with intent to be fun and without expecting it will ever land anywhere near "accepted". – Kombajn zbożowy Jan 04 '24 at 13:01
  • 1
    @Falco One possibility to ensure that the coin lands between the plates is to have them close together at the bottom to force the coin to land on its edge and have them increasingly further apart at the top to catch the falling coin. The cross section of the two plates could resemble the letter Y. – Will Octagon Gibson Jan 04 '24 at 20:35
6

Sitting in the middle of the road and spinning a round coin and going down road above the heads or below the tails that way the direction is always pointing the same whether heads or tails.

AnimeNate
  • 83
  • 12
  • this won't be completely random because it'll be affected by the ripple affect... due to a slightly larger amount in traffic one way that direction could be influenced to be chosen more often due to warps and ruts in the road... but to be honest if you are in this saturation it's probably because you're lost and need to find civilization so... – AnimeNate Dec 31 '23 at 22:03
3

This is not an original answer. It only adds how to derive @Florian F's 5-toss answer analytically.

Let $B = P - \frac 1 2$ be the coin's bias.

We'll reference the 5 groups of outcomes by the numbers of outcomes with 5,4,3,2,1 and 0 heads, respectively. The groups are then 1-0-0-0-0-1, 0-1-3-3-1-0 (2x), 0-2-0-4-1-0 and 0-1-4-0-2-0.

To get the right probability for the 1-0-0-0-0-1 group we need to solve $\left (\frac 1 2 + B\right )^5 +\left (\frac 1 2 - B\right )^5=\frac 1 5$. Because odd powers of $B$ cancel this simplifies to $\frac 1 {2^4} + \frac {10} {2^2} B^2 + 5 B^4 = \frac 1 5$. Substituting $b=B^2$ yields a quadratic equation $b^2 + \frac 1 2 b = \frac 1 {25} - \frac 1 {80}$ with solutions $b=-\frac 1 4 \pm \frac 3 {10}$ of which only the positive one $b=\frac 1 {20}$ is usable because we need to take its square root to obtain $B=\frac 1 {2\sqrt 5}$

It remains to show that the four other groups all have the same probability. The difference between 0-1-3-3-1-0 and 0-2-0-4-1-0 is $P^4Q-3P^3Q^2+P^2Q^3 = P^2Q (P^2-3PQ+Q^2)$ where $Q=1-P$. The difference between 0-1-3-3-1-0 and 0-1-4-0-2-0 is $P^3Q^2-3P^2Q^3+PQ^4 = PQ^2 (P^2-3PQ+Q^2)$. It will suffice to establish $P^2-3PQ+Q^2=0$. Substituting $P,Q$ using $B$: $\left(\frac 1 2 + B\right)^2 - 3 \left(\frac 1 2 + B\right)\left(\frac 1 2 - B\right)+\left(\frac 1 2 - B\right)^2 = -\frac 1 4 + 5B^2 = -\frac 1 4 + 5b = 0$.

A biased coin with probabilities $\frac 1 2 \pm \frac 1 {2\sqrt 5}$ therefore "works".

Albert.Lang
  • 5,237
  • 9
  • 40
-1

I believe it can be done with a single unbiased coin

Stand on the first road. Throw a coin. If it lands heads then move 2 roads clockwise, otherwise if it lands tails then move 3 roads clockwise. Repeat this $N$ times to obtain your final road. In other words we are computing $(2H+3T) \mod 5$, where $H$ is the number of heads and $T$ is the number of tails thrown with $N=H+T$. I chose $2$ and $3$, because they are small and relatively prime to each other giving you a uniform distribution over final results. Now we just need to find a good value for $N$. I found that $N=50$ is the smallest value that works well. I wrote some code that simulates the above and ran it for 1 million simulations. Here are the counts for each result: 0: 199725, 1: 199580, 2: 200235, 3: 200088, 4: 200372. The average deviation from the expected 200000 is only 278, which is just 0.1% from 200000.

UPDATE:

Will Octagon Gibson has kindly pointed out that this procedure works with 0/1 steps too, which makes it even simpler. So if the coin lands tails then move by 1 road, otherwise stay where you are.

An alternative solution

is to use an unbiased coin to simulate any biased coin. This way we can choose any solution posted here and simulate it with a single unbiased coin. If there are multiple coins involved then just repeat the simulation for each coin.

Dmitry Kamenetsky
  • 35,897
  • 5
  • 66
  • 276
  • 1
    Your first procedure with a single unbiased coin is virtually perfect for randomly selecting a road. For N=50, moving 0 or 1 roads gives EXACTLY the same results as moving 2 or 3 roads because at each step the 2/3 method will move exactly two roads further than the 0/1 method; in total moving exactly 50x2=100 roads further which is exactly 20 extra laps around the five roads. – Will Octagon Gibson Jan 03 '24 at 20:28
  • Nice observation. Ok let's go with the 0/1 moves - even simpler. I believe this answers the puzzle, including the bonus question. – Dmitry Kamenetsky Jan 03 '24 at 23:11
  • Why the minuses? Please explain. My answer solves the problem. – Dmitry Kamenetsky Jan 04 '24 at 11:44
  • Dmitry, I upvoted your answer. – Will Octagon Gibson Jan 04 '24 at 11:47
  • yep I know you did and I thank you for that. I don't understand why others have downvoted me :( – Dmitry Kamenetsky Jan 04 '24 at 12:44
-2

1 coin, 1 flip

Number the roads, then flip a single coin over soft mud or sand. Assign a range of possible 'angles of entry' to one each of the five roads.

  • Flat - Road 1
  • Almost flat - Road 2
  • About 45 degrees - Road 3
  • Mostly upright - Road 4
  • Upright - Road 5

As you can see from the example below, the coin has landed 'mostly upright', so you would take Road #4.

enter image description here

Richard
  • 5,320
  • 2
  • 17
  • 28
  • 2
    It might take you a while to work out precisely what angles represent a totally random 1:5 chance... – Richard Dec 31 '23 at 20:41
  • 2
    +1 Cool answer despite it being challenging to implement. – Will Octagon Gibson Dec 31 '23 at 21:00
  • "You would like to choose randomly, with equal probability* for each road."* is not satisfied here. – Nij Dec 31 '23 at 21:47
  • 2
    @nij - As I've said, you'd need to work out precisely what range of angles would meet the requirement for random chance. – Richard Dec 31 '23 at 21:53
  • 3
    "Mostly upright" is not an angle though, it's a subjective observation. Unless you are allowing other equipment for their random determination, in which case you just create RNG devices and also flip a coin for no reason. – Nij Jan 01 '24 at 03:13