# Coin Flip Problem: a competition based on the probability of flipping heads

I encountered a difficult coin problem and I wasn't sure how to solve the problem.

A has 30 coins and B has 20 coins. Each coin is only flipped once, and the winner is the individual which received the most amount of heads. If both individuals receive the same amount of heads, A wins. What is the probability that B wins?

I tried searching online but was unable to find any questions of this type. Given my lack of mathematical background, I tried to rely on my intuition. Because both individuals have the same probability of flipping heads when it comes to the first 20 choices, we should only consider the possibility of flipping a head for coins 21-30 for A. However, I believe this to be incorrect, so I would love to hear what the community thinks on this question.

Thank you very much for your help!

• $P(B>A)=\sum_{n=1}^{20}P(B=n)P(A<n)$ – Daniel Mathias Apr 25 '20 at 20:09
• Using Daniel’s suggestion, we get a nested sum: $$\left(\frac 12 \right)^{50} \cdot \sum_{i=1}^{20} \left [ {20 \choose i} \sum_{j=0}^{i-1} {30 \choose j} \right ] \approx 0.05946$$ – Tavish Apr 25 '20 at 21:03
• Thanks for your help guys! I should specify: this question was asked in a job interview, as a 'brainteaser' type of question. You also weren't allowed to use a calculator - hence, is there a more intuitive/less intricate way to solve this problem? – qwerty2019 Apr 26 '20 at 7:30

For the job interview, one can probably approximate throwing $$50$$ coins as a normal (Gaussian) distribution. Let the score be

$$X = B - A = C_1 + C_2 + \dots + C_{50}$$

where $$C_j$$ is the $$j$$th coin. The first thirty coins are uniform $$\{0, -1\}$$ (since they help A) and the last twenty coins are uniform $$\{0, +1\}$$ (since they help B). The mean is $$E[X] = -5$$ and the variance is $$Var(X) = 50/4$$ so the standard deviation is $$\sigma \approx 3.5$$.

B wins if $$X \ge 1$$ and loses if $$X \le 0$$, so you want the threshold to be $$X = 0.5$$, which means you are looking at the one-sided tail at $${5.5 \over 3.5} \approx 1.5 \sigma$$.

At this point, it depends on what you remember from the z-score tables... :) Perhaps you remember that the area within $$\pm 1 \sigma$$ is about $$2/3$$? That means the one-sided tail at $$1 \sigma$$ is about $$1/6 = 16\%$$. Then perhaps you remember that $$\pm 2 \sigma$$ is about $$95\%$$? Which means the one-sided tail at $$2 \sigma$$ is about $$2.5\%$$. This question calls for the one-sided tail at $$\approx 1.5 \sigma$$, which is a number between $$16\%$$ and $$2.5\%$$, and if you remember how the curve drops off dramatically (after $$1 \sigma$$) you might have guessed about $$6$$ or $$7\%$$.

Incidentally if you actually look up the z-score table for $$5.5 / \sqrt{12.5} \approx 1.55563491861$$ you get a probability of $$0.059897$$ which is very close to the combinatorially exact answer as calculated by @Tavish in the comments.

Because both individuals have the same probability of flipping heads when it comes to the first 20 choices, we should only consider the possibility of flipping a head for coins 21-30 for A. However, I believe this to be incorrect...

That would be vastly incorrect. First of all, A wins ties, so this wrong logic would say A wins all the time (since A wins even if A flips $$0$$ heads in coins 21-30). Even if A loses ties, the logic is still bad. E.g. imagine A is flipping $$10000$$ coins and B is flipping $$9990$$. Intuitively you would think B has less than half, but still pretty good chance, to win. Whereas with the wrong logic B wins iff A's $$10$$ extra coins all tails (probability $$1/1024$$).

• Thank you very much for your help. I appreciate you taking the time! I've never heard of a Gaussian distribution in my life (yes, I am super weak at maths), but if I ever do cover it in my future university courses, I will come back and re-read your answer. Have a good day! – qwerty2019 May 4 '20 at 16:58
• Gaussian is the fancy name. Another name is the Normal distribution. Even if you've not heard of either name, the same thing is also informally called "The Bell Curve". Maybe you've seen pictures of that? :) – antkam May 6 '20 at 5:32