Flip $n$ coins on a circle. Assume a coin has been chosen from among those whose neighbors are both heads. What's the probability it is heads?

420 Views Asked by At

This is a generalization of the problem below (first appeared here)

I am particularly curious to know if there is a closed-form formula to calculate the probability for any $n$ and any probability of heads $p$.

note: One doesn't need to calculate the probability to show that it is not 50-50. If $n=3$, the exact probability can be calculated with few computational steps. For larger $n$, relatively simple algorithms can be used to calculate the probability; some are more efficient than others.

Coin Flips on a Circle

2

There are 2 best solutions below

3
On

The teacher is incorrect.

It turns out that there are $220$ cases (out of $2^{10}=1024$) where only one student steps forward because both neighbours flipped heads, and in $60$ of those cases the student stepping forwards also flipped heads. So the probability is $\frac3{11}\approx 27.3\%$

The reason that heads is biased against is that if that student flipped heads then neither of the people two away can also have flipped heads, as otherwise somebody else would also have stepped forward.

To illustrate the point, consider when only the third student steps forward (the second and fourth students must have flipped heads and the sixth and tenth must have flipped tails). In the following $6$ cases the third student could have flipped heads

. v . 
THHHTTTTTT
THHHTTHTTT
THHHTTTHTT
THHHTTHHTT
THHHTTTTHT
THHHTTTHHT
. ^ .

and in the similar $6$ cases the third student could have flipped tails

. v .
THTHTTTTTT
THTHTTHTTT
THTHTTTHTT
THTHTTHHTT
THTHTTTTHT
THTHTTTHHT
. ^ .

though in all those cases the first and fifth students flipped tails. But there are another $10$ cases where the first or fifth flipped heads so the third must have flipped tails, and this demonstrates the bias

. v .
THTHHTTTTT
THTHHTTHTT
THTHHTTTHT
THTHHTTHHT
HHTHTTTTTT
HHTHTTHTTT
HHTHTTTHTT
HHTHTTHHTT
HHTHHTTTTT
HHTHHTTHTT
. ^ .

Added The answer above deals with the case where only one student has two neighbours both with heads and so the answer is conditional on that position. Others have suggested that the question is different and that if there is more than one student with suitable neighbours then one of those steps forward, presumably randomly from those. Similar

In that case (now conditioned on there being at least one pair of suitable neighbours) there is still a bias towards tails for the student stepping forward. The calculations are now

Suitable     Number of   Probability heads  
neighbours     cases      if step forward
 0              121               -
 1              220              3/11
 2              210              8/21
 3              210             25/63
 4              125             29/50
 5               72              5/9
 6               45             19/27
 7               10              5/7
 8               10              7/8
 9                0               - 
10                1              1/1

A weighted average (ignoring $0$ or $9$ suitable pairs of neighbours as nobody will step forward) gives an overall probability that the student stepping forward has heads of $\frac{10763}{25284} \approx 42.6\%$, so the teacher is still wrong.

0
On

This isn't a solution, so much as a longer comment.

I've tried my hand at this puzzle a bit, and I do not think that there is a good reason to believe that there is a simple, closed-form solution.

Here are the first few values of the probability, calculated via brute force:

1: 1 : 1.000000
2: 1/3 : 0.333333
3: 1/4 : 0.250000
4: 3/7 : 0.428571
5: 4/9 : 0.444444
6: 13/32 : 0.406250
7: 1213/2970 : 0.408418
8: 1307/3105 : 0.420934
9: 6479/15260 : 0.424574
10: 10763/25284 : 0.425684
11: 998993/2329740 : 0.428800
12: 24461/56580 : 0.432326
13: 11567641/26580015 : 0.435201
14: 1122812/2564595 : 0.437813
15: 20767139/47153106 : 0.440419
16: 114861079/259324065 : 0.442925
17: 2557308958/5743282545 : 0.445270
18: 70667521/157922688 : 0.447482
19: 1418238764963/3154578106680 : 0.449581
20: 1443876177/3197485018 : 0.451566

As you can observe, there are a few, very quirky things happening here. As common with "not nice" but finite probability puzzles, it generates large, ugly fractions. Second, there seems to be some sort of periodicity with respect to small primes, like two and three. Numbers that have factors of two and three tend to be slightly depressed as compared to others. But 5 is very high, while 7 is very low.

There seems to be a lot going on here, with respect to prime factor periodic strings suppressing certain certain circular permutations, to various strange edge effects. I would be surprised to see a reasonably simple recursive form of some sort for this mess, let alone a closed form simply due to the connection with prime factorization. Even the counts of the valid arrangements (i.e. where at least one student can step forward) are not listed in OEIS, (1, 3, 4, 7, 21, 48, 99, 207, 436, ...). It's just a really ugly problem from any angle.

I hope and expect to be proven wrong in under 24 hours, because that's just the sort of luck I have. :D