bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Data Interview Question

Biased Coin Probability

bugfree Icon

Hello, I am bugfree Assistant. Feel free to ask me for any question related to this problem

Solution & Explanation

The problem involves determining the probability that you selected the biased coin after observing 10 heads in a row from your chosen coin. This is a classic example of using Bayes' Theorem to calculate conditional probabilities.

Bayes' Theorem

Bayes' Theorem is a mathematical formula used to determine the conditional probability of an event, given the probability of another event that has already occurred. The theorem is expressed as:

P(AB)=P(BA)×P(A)P(B)P(A|B) = \frac{P(B|A) \times P(A)}{P(B)}

Where:

  • P(AB)P(A|B) is the probability that event AA occurs given that BB is true.
  • P(BA)P(B|A) is the probability that event BB occurs given that AA is true.
  • P(A)P(A) is the probability of event AA occurring.
  • P(B)P(B) is the probability of event BB occurring.

Definitions for this Problem

  • Event AA: The coin selected is the biased coin (two heads).
  • Event AA': The coin selected is a fair coin (one head, one tail).
  • Event BB: The result of flipping the coin 10 times is 10 heads.

Given Probabilities

  • P(A)=1100P(A) = \frac{1}{100} because there is 1 biased coin out of 100 coins.
  • P(A)=99100P(A') = \frac{99}{100} because there are 99 fair coins.
  • P(BA)=1P(B|A) = 1 because the biased coin will always show heads.
  • P(BA)=(12)10P(B|A') = \left(\frac{1}{2}\right)^{10} because a fair coin has a 12\frac{1}{2} chance of showing heads per flip.

Calculate P(B)P(B)

To find P(B)P(B), use the law of total probability:

P(B)=P(BA)×P(A)+P(BA)×P(A)P(B) = P(B|A) \times P(A) + P(B|A') \times P(A')

Substitute the values:

P(B)=(1×1100)+((12)10×99100)P(B) = (1 \times \frac{1}{100}) + \left(\left(\frac{1}{2}\right)^{10} \times \frac{99}{100}\right)

Simplifying further:

P(B)=1100+991024×100P(B) = \frac{1}{100} + \frac{99}{1024 \times 100}

Calculate P(AB)P(A|B)

Now apply Bayes' Theorem:

P(AB)=P(BA)×P(A)P(B)P(A|B) = \frac{P(B|A) \times P(A)}{P(B)}

Substitute the known values:

P(AB)=1×11001100+991024×100P(A|B) = \frac{1 \times \frac{1}{100}}{\frac{1}{100} + \frac{99}{1024 \times 100}}

Simplify the expression:

P(AB)=11+991024=102411230.9118P(A|B) = \frac{1}{1 + \frac{99}{1024}} = \frac{1024}{1123} \approx 0.9118

Conclusion

The probability that the coin you selected is the biased one, given that you observed 10 heads in a row, is approximately 0.9118. This high probability reflects how unlikely it is to get 10 consecutive heads with a fair coin, thus making it more probable that the biased coin was chosen.