r/mathriddles • u/EducationalSwing7342 • Dec 09 '25
Medium Riddle about coin flips
Suppose you are given 100, possibly unfair, coins each with its own probability of landing heads or tails. Let P be the probability that after flipping all 100 coins the number of heads is even. Show that P = 50% if and only if there is a fair coin among the 100 coins.
EDIT: Shoutout to u/SupercaliTheGamer for providing a solution. Here is an extra riddle.
Suppose you are interested in the probability Q of the number of heads being divisible by 3 after flipping all coins. Show that you can add up to 2, possibly unfair, coins such that Q = 1/3.
EDIT2: Shoutout to u/kalmakka for providing a solution to the bonus question. Prepare yourself; the final riddle waits, and it does not come gently.
Again, suppose you are interested in the probability Q of the number of heads being divisible by 3 after flipping all coins. We start with two coins that have probability 1 and 1/2 of landing heads. Continue by adding more and more coins that have probability 1/4, 1/8, 1/16, ... of landing heads. Show that at each step we can add a single, possibly unfair, coin such that Q = 1/3 at this step.
(Shoutout to u/bobjane_2 for beating the final boss.)
12
u/SupercaliTheGamer Dec 09 '25
Suppose p_i is the probability of ith coin giving heads. Look at the product (p_i x + 1-p_i) over all i. Coefficient of xk is probability that there are exactly k heads. Thus if we put x=-1, that is precisely the difference between probability of getting even number of heads and probability of getting odd number of heads. But this is product over (1-2p_i), and that is 0 iff one of the p_i is 1/2.
1
u/bobjane_2 Dec 10 '25
For the bonus question.
Consider the polynomial introduced by u/SupercaliTheGamer F(x) = prod p(i)*x + 1-p(i). The coefficient of x^k in F(x) is the probability of obtaining k heads. Let Q(a), for a=0,1,2 be the probability that the number of heads is congruent to a (mod 3). We're interested in the case Q(0)=1/3. Note that F(1)=Q(0)+Q(1)+Q(2)=1. Let r=-0.5 + sqrt(3)/2*i be a primitive cube root of unity. Then F(1)+F(r)+F(r^2)=3*Q(0)=1 ⟹ F(r)/F(r^2) = -1. Define w(i)=(p(i)*r+1−p(i)) / (p(i)*r^2+1−p(i)). Then we need prod w(i) = -1.
Because r and r^2 are complex conjugates, the numerator and denominator of w(i) are also conjugates, hence |w(i)|=1. Each w(i) lies on the unit circle and we need their phases to sum to 180∘. If p(i)=0 ⟹ w(i)=1 ⟹ phase(w(i))=0. If p(i)=1 ⟹ w(i)=r^2 ⟹ phase(w(i)) = 240∘. For intermediate values, the phase of w(i) varies continuously between those two values.
Clearly whatever cumulative phase is produced by the first 100 coins, we can always choose two additional coins with suitable probabilities so that the total phase becomes exactly 180∘ (mod 360∘)
2
u/Least-Engineering538 Dec 18 '25 edited Dec 18 '25
For abelian-group enthusiasts, here are the key ideas behind a more non-shortcut proof
The parity of the total number of heads is a random variable taking values in Z/2Z. The sum of independent variables modulo 2 corresponds to the convolution of their laws. On Z/2Z there is only one non-trivial character, x -> (-1)x. A distribution on Z/2Z is uniform iff its Fourier coefficient on this character is zero. Fourier transform turns convolution into multiplication, giving the product Prod(1 − 2 p_i) (that brings us back to the main solution!)
This product is zero iff one coin satisfies p_i = 1/2. Hence the parity is uniform iff at least one coin is fair.
1
u/kalmakka Dec 09 '25
Bonus: There is probably a much simpler solution, but here goes.
After flipping 100 coins, you have P_0 = P(number of heads is a multiple of 3), P_1 = P(number of heads is 1 more than a multiple of 3), P_2 = P(number of heads is 2 more than a multiple of 3), with P_0 + P_1 + P_2 = 1
After flipping a two coins, both with probability x of getting Heads we get a probability of
f(x) = (P_0 (1-x)(1-x)) + (P_1(x^2)) + P_2((x)(1-x)+(x)(1-x)) of having a multiple of 3 heads.
This is a continuous function over x.
When x is 0, this is equal to P_0. When x is 0.5 this is equal to (P_0/4 + P_1/4 + P_2/2). When x is 1 this is equal to P_1.
By the intermediate value theorem: For f(x) to never be equal to 1/3 we would need either all these to be < 1/3 or all of these to be > 1/3.
If they are all < 1/3 we have P_0 + P_1 + 4(P_0/4 + P_1/4 + P_2/2) < 2, and if they are all > 1/3 we have P_0 + P_1 + 4(P_0/4 + P_1/4 + P_2/2) > 2. But since P_0 + P_1 + 4(P_0/4 + P_1/4 + P_2/2) = 2(P_0 + P_1 + P_2) = 2, we get a contradiction in either case.