Thursday, May 23, 2019

Published May 23, 2019 by with 11 comments

How Do You Know If You Have a Biased Coin?

Fun probability problems involving biased coins...

Problem

Imagine you have a bag of 10 coins. 9 of them are fair, and 1 is biased. The biased coin has a 75% chance of landing on heads. If you draw a coin from the bag, flip it 5 times, and get 5 heads in a row, how confident should you be that you have the biased coin?

Solution

Imagine you had all 10 coins and flipped them 5 times each. You repeat this thousands of times. You would get a bunch of outcomes. HHTHT, TTHTT, and so on where H = heads and T = tails. Some would also be HHHHH.

A fair coin has a 50% chance of landing on heads or tails. A fair coin flipped n times has a (0.5^n) chance of getting all heads. Likewise, our biased coin flipped n times has a (0.75^n) chance of getting all heads.

To find the probability of anything other than all heads, simply note that 'all heads + anything else = 1'. For the fair coin then, there's a 1 - (0.5^n) chance of getting anything other than all heads and that chance is 1 - (0.75^n) for the biased coin.

Imagine you flip all 10 coins 1000 times. You'll have 4 types of outcomes described by the following table:

fair coinsbiased coins
not HHHHH1000*9*(1 - 0.5^5)1000*(1 - 0.75^5)
HHHHH1000*9*(0.5^5)1000*(0.75^5)

Plugging that into a calculator, it's:
fair coinsbiased coins
not HHHHH8718.75762.70
HHHHH281.25237.30

Now...you take a random trial and find that it was all heads (HHHHH). Was that from a biased coin or a fair coin? There were 281.25 fair coins and 237.30 biased coins that yielded an HHHHH result. (237.30) / (281.25 + 237.30), or ~46% of the HHHHH results were from biased coins.

Knowing that outcome from a huge number of trials, you know that from 1 trial, getting HHHHH from a random coin means your confidence should be ~46% that it's the biased coin.

Walking back through where those numbers came from, the probability of the biased coin given n flips when you have m fair coins for every biased coin is:

probability of biased coin = (0.75^n)/(0.75^n + m*(0.5^n))


Related problems

How many heads in a row would you need to have 99% confidence? You know it has to be more than 5 since 5 only gave 46% confidence. Trying 10, that yields 86% confidence. Trying 15 yields 98%. 17 ends up being the first n that gives a result greater than 99%.

Even with the biased coin landing on heads 75% of the time, you still need 17 heads in a row to be 99% sure you have the biased coin.

What if there are only two coins in the bag...one fair and one biased? Doing the same analysis, you end up needing 12 heads in a row to be 99% confident that you have the biased coin.

Going back to the first one...imagine you grab a coin from the bag, flip it 5 times, and get HHHHH. Then you draw another coin from the bag. What are the odds that the second coin lands on heads when you flip it?

There are two possibilities:
  1. first coin was biased
  2. first coin was fair
If the first coin was biased, the next coin has to be fair since there was only one biased coin, so the probability of heads is 0.5. If the first coin was fair, there's a 8/9 chance of getting a fair coin next and a 1/9 chance of getting the biased coin since there are 9 coins left and 1 is biased. In that case, you have a (8/9)*(0.5) + (1/9)*(0.75) chance of getting heads.

From the initial problem, you know there's a 46% chance that the first coin was biased since you got HHHHH from it. That means there's a 46% chance first coin was biased and 54% chance it was fair. Combining all of that:

chance of heads on second coin = 0.46*0.5 + 0.54*((8/9)*(0.5) + (1/9)*(0.75))

Plugging that into a calculator, you get a ~51.5% chance of heads on the second coin's flip.



      edit

11 comments:

  1. Many sports brand companies opt for sports sponsorship because it is one of the most effective ways to get their brand the right amount of publicity and exposure. Sports sponsorship has become more than just collaboration between business corporations and sports leagues. outdoor dart board

    ReplyDelete
  2. Good website! I truly love how it is easy on my eyes it is. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which may do the trick? Have a great day! radiant diamond manufacturer

    ReplyDelete
  3. 🏆 คาสิโนสด ชั้นนำระดับโลก 🏆
    ✅ มีเพียง USER เดียว เล่นจบ ครบทุกอย่าง
    🎰สล็อต♥️คาสิโน♠️บาคาร่า
    ⚽️กีฬา💥ไฮโล🎲หวย🔢

    ReplyDelete
  4. I was just browsing through the internet looking for some information and came across your blog. I am impressed by the information that you have on this blog. It shows how well you understand this subject. Bookmarked this page, will come back for more. Coinex referral code

    ReplyDelete
  5. Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post. Visit Pocket Option here

    ReplyDelete
  6. Coin gathering can be an extremely intriguing and remunerating side interest. NFT Calendar

    ReplyDelete
  7. I don’t waste my free time that’s why I read the informative things when I got this blog I really enjoyed reading this.의정부출장샵추천
    안양출장샵추천
    부천출장샵추천
    광명출장샵추천
    동두천출장샵추천
    평택출장샵추천
    안산출장샵추천

    ReplyDelete
  8. Aneony is a general site that offers a variety of content in different languages. It also includes a section for questions and answers, which can be useful for finding specific information or for getting help with a problem.
    안산출장샵추천

    ReplyDelete
  9. After reading through this article, you should have a pretty good idea! If you're still not sure, there's a simple test you can do to check for yourself.
    광명출장샵추천

    ReplyDelete
  10. Coups d'etat (Powell and Thyne), Court packing, Covid affecting ratings, Criteria for appointment decisions in the armed forces, Criteria for appointment.
    평택출장샵추천

    ReplyDelete
  11. I am very interested in your articles,
    I hope to read more of your articles in the future,
    you can also visit the articles, I hope we can learn from each other
    통영출장샵
    출장샵 경찰
    출장샵 가격
    서산출장샵
    진해출장샵

    ReplyDelete