# Randomly given a coin from an unfair set of 6 coins, how can I determine which coin I was given?

Suppose I have 6 different coins that have wildly different increasing chances of flipping a heads, and I know the chances of flipping a heads for each.

(ie. Coin 1: 1/280 chance of heads ... Coin 6: 1/120 chance of heads)

Without looking, if I choose one of these coins at random and flip it some limited number of times, how can I determine the probability it is each of the 6 coins in relation to each other from the results alone?

(ie. A result like [Coin1: 5%, Coin2: 7%, Coin3: 10%, Coin4: 14%, Coin5: 25%, Coin6: 39%])

My statistics knowledge is limited to what I learned in first year university, so I originally thought I could solve this problem using the chi-square test with the expected results of each of the 6 coins. The problem is this gives me the probability that the results were simply due to chance vs it not actually being that coin (possibly not even one of the original 6 coins, when I know it must be one of the 6 coins!).

So for example if I flipped a coin 10,000 times and (by some extreme chance) every result was a heads, I should be getting a result reporting the confidence of coin 6 as being something extremely high with a very tiny % chance of being coin 1 to 5. Instead the result I get is that there's a 0.000001% or so chance of it being any of the 6 coins at all.

Am I using the wrong approach to solving this problem?

• Is this homework or an example from a book? If so, please add the self-study tag. Feb 7, 2014 at 12:20
• I posted an answer, assuming since you mentioned that your stats knowledge was limited to your first year university that this is related to an actual problem you have and not self-study, but I guess I should let you clarify that. If it is not self-study, I'll undelete my post. Feb 7, 2014 at 12:50
• @spd You might as well undelete it: it's not our job to enforce academic honesty codes around the world. Moreover, you provide guidance and an approach rather than a complete answer and that's in the spirit of answering self-study questions anyway.
– whuber
Feb 7, 2014 at 15:47
• @spdickson I'm not a student anymore, it's related to an actual problem I'm trying to solve. Feb 7, 2014 at 18:11
• Great, then I hope the answer is useful to you. Let me know if you have any questions. Feb 7, 2014 at 18:24

Say you know the probabilities are $\left\{p_1,p_2,p_3,p_4,p_5,p_6\right\}$. If you flip a coin $n$ times and get $x$ heads you can calculate the probability of $x$ heads out of $n$ flips given $p_1$ probability of flipping heads using the binomial distribution: $$Pr(x|n,p_1)=\binom{n}{x}p_1^n\left(1-p_1\right)^{n-x}$$ Since you know that it can only be one of those 6 probabilities you can calculate the total probability as follows: $$\sum_{i=1}^{6}\binom{n}{x}p_i^n\left(1-p_i\right)^{n-x}$$ You can put these two probabilities together to get the probability that the coin you flipped has probability of success $p_1$: $$\frac{\binom{n}{x}p_1^n\left(1-p_1\right)^{n-x}}{\sum_{i=1}^{6}\binom{n}{x}p_i^n\left(1-p_i\right)^{n-x}}$$
With regards to large $n$, as is pointed out in the comments, large $n$ should not be a problem computationally because the above simplifies to $$\frac{p_1^n\left(1-p_1\right)^{n-x}}{\sum_{i=1}^{6}p_i^n\left(1-p_i\right)^{n-x}}$$
• @arcade See the PMF in binomial distribution. I don't see a typo, but that doesn't mean there isn't one. As for an approximation that might be quicker for large $n$, see my update. Feb 10, 2014 at 13:25
• Why do you need an approximation for large $n$? Because $\binom{n}{x}$ cancels in the fraction it doesn't really appear in the formula, leaving quantities that are easily computed even for enormous $n$.