I have 5 fair coins and 10 unfair coins in a bag. For the unfair coins, there is 80% chance of getting a head and 20% for tails. What's the probability of flipping 4 heads out of 6 flips? Each flip is with a different coin, and there is no replacement.
I came up with two different answers using two approaches.
Approach # 1:
Probability of getting a head regardless of fair or unfair coin $$(5/15) \cdot 0.5 + (10/15) \cdot 0.8 = 0.7$$
Probability of flipping 4 heads out of 6 flips $$\frac{6!}{4!2!} \cdot 0.7^4 \cdot 0.3^2 = 0.324135$$
Approach # 2:
Probability of getting 4 heads out of 6 flips in fair coin $$\frac{6!}{4!2!} \cdot 0.5^6 = 0.23438 $$
Probability of getting 4 head out of 6 flips in unfair coin $$\frac{6!}{4!2!} \cdot 0.8^4 \cdot 0.2^2 = 0.24576 $$
Probability of getting 4 heads out of 6 flips $$(5/15) \cdot 0.23438 + (10/15) \cdot 0.24576 = 0.24197 $$
Which approach is the correct one? What was the flaw / misstep in the wrong approach? Thanks!
Your approaches do not take into account that the probabilities of drawing an unfair or fair coin do vary from step to step. As André Nicolas points out, there is no direct analytical way to calculate the overall probability.
I have tried to determine the probability experimentally with the following
C#code:The resulting probability of 4 heads out of 6 is 33.38%
Strangely enough, in spite of the high number of 100 million iterations, I get slightly varyiing results (33.38% +/- 0.005%) when I repeat the experiment.
When modifying the coin flipping experiment from random number generator thresholds [1...5000...8000...10000] to [1...5...8...10] the resulting probability goes down to 28.8%. I am not sure, why.