A coin-tossing decision problem

You have two coins, one of which comes up heads one-third of the time (coin A) and one of which comes up heads one-half of the time (coin B).

You pick one of these coins uniformly at random. Then you flip it twelve times, and it comes up heads five times. Which of the two coins is it?

The first instinct is to say that coin A is expected to come up heads four times, and coin B is expected to come up heads six times… five is halfway between those, so we don’t know anything.

But the standard deviation of the number of heads from A is \sqrt{12 \times 1/3 \times 2/3} = 1.63 and the standard deviation of the number of heads from B is \sqrt{12\times 1/2 \times 1/2} = 1.73; so in standardized terms, maybe B is more likely?

So let’s use maximum likelihood. The probability of getting 5 heads in 12 flips from coin A is

{12 \choose 5} \left( {1 \over 3} \right)^5 \left( {2 \over 3} \right)^7 = {11264 \over 59049} = 0.1907568

and the probability of getting 5 heads in 12 flips from coin B is

{12 \choose 5} \left( {1 \over 2} \right)^5 \left( {1 \over 2} \right)^7 = {99 \over 512} = 0.1933594

The likelihood of coin B is larger, so we choose B.

Alternatively, this is equivalent to using Bayes’ theorem with a uniform prior. Say P(A) = P(B) = 1/2. Then we can find the posterior probability of having picked coin B, given 5 heads:

P(B|5 H, 7 T) = {P(5 H, 7 T|B) \over P(5 H, 7 T|A) P(5 H, 7 T |B)}

and this is 0.5033877; the evidence from five coin flips is very weak. The probability of having picked coin B given k heads in n tosses can be computed similarly, and it’s

{{n \choose k} (1/2)^k (1/2)^{n-k} \over {n \choose k} (1/2)^k (1/2)^{n-k} + {n \choose k} (1/3)^k (2/3){n-k}}.

After some cancellation, this is

f(n,k) = {1 \over 1 + (2/3)^k (4/3)^{n-k}}

and in the n = 12 case this is

k 0 1 2 3 4 5
f(n,k) 0.0307 0.0596 0.1125 0.2022 0.3364 0.5034
k 6 7 8 9 10 11 12
f(n,k) 0.6697 0.8022 0.8902 0.9419 0.9700 0.9848 0.9924

We might ask: is there a general decision rule? Fix n; when is f(n,k) = 1/2? If k is less than that number then guess coin A was used; if k was greater than that number then guess that coin B was used. To get f(n,k) = 1/2 we must have (2/3)^k (4/3)^{n-k} = 1; rearranging this is (4/3)^n = 2^k. Taking logs we get n \log (4/3) = k \log 2 and so k = n (\log 4/3)/(\log 2) = 0.41503575, slightly less than /12 = 0.41\bar{6}. If the proportion of heads is greater than 0.41503575 then guess coin B; if it’s smaller than guess coin A.

This was inspired by an exercise from Freedman, Pisani, and Purves, Statistics, fourth edition (Chapter 24, exercise B1), with the language regularized: a thumbtack is thrown in the air. It lands either point up or point down. Someone suggests that the point comes up half the time; someone else, one-third of the time. How could you decide which model is correct? The answer given in the text is to toss the thumbtack many times and see whether the percentage of point-up times is closer to one-half or one-third. This is in spirit correct, but it turns out that 5/12 is not the optimal splitting point.

2 thoughts on “A coin-tossing decision problem

  1. It’s been a while since I’ve done probability in school and I can’t quite see how you got to “The probability of getting 5 heads in 12 flips from coin A = 0.1907568”. I can get there using Pascal’s triangle where I find 792 and then multiply that by (1/3)^5 x (2/3)^7, but I don’t see how you got there above (it looks like you multiply it by {12/5} but I don’t see how that works). Maybe I’m missing something obvious but if so please let me know.

    Also, you don’t need to know the 792 to get the right answer here as it cancels out in Bayes formula, which might save some time on the GMAT.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s