Hacker News new | ask | show | jobs
by jules 4550 days ago
When we pick the coin, we have 1 in 1000 chance of getting the double heads coin, and 999 in 1000 chance of getting a fair coin. Lets call this P(fair) = 0.001, and P(fake) = 0.999.

When we have the double heads coin, the probability of getting 10 heads is 1: P(10 heads|fake) = 1. When we have a normal coin, the probability of getting 10 heads is P(10 heads|fair) = 0.5^10.

The quantity we want to compute is

    P(heads|10 heads) = P(fair|10 heads)*0.5 + P(fake|10 heads)*1 
                      = P(fair|10 heads)*0.5 + (1-P(fair|10 heads)) 
                      = 1 - P(fair|10 heads)*0.5.
To compute P(fair|10 heads) we use Bayes' rule:

    P(fair|10 heads) = P(10 heads|fair) * P(fair)/P(10 heads)
Here

    P(10 heads) = P(10 heads|fake)*P(fake) + P(10 heads|fair)*P(fair) 
                = 1*0.001 + 0.5^10*0.999.
We fill in the formula we got by Bayes' rule:

    P(fair|10 heads) = 0.5^10 * 0.999 / (1*0.001 + 0.5^10*0.999)
Then we fill in the original formula:

    P(heads|10 heads) = 1 - 0.5^10 * 0.999 / (1*0.001 + 0.5^10*0.999) * 0.5 
                      = 0.75308947108