TITLE: Probability of Defective coins
QUESTION [7 upvotes]: Among 100 coins one is defective: it has two heads. One chooses a coin (a good or bad one) and tosses it 10 
times. It turns out that the head comes out all 10 times. What is the probability that the head comes out again 
when the coin is tossed one more time?

REPLY [10 votes]: Please note that Gambler's fallacy does not apply here, because not all coins are equal.
The formula for Bayes's theorem expresses the relationship between $\Pr(A\mid B)$ and $\Pr(B\mid A)$. In our context it can be written as
$$\Pr(\text{Defective}\mid 10H) = \frac{\Pr(10H\mid\text{Defective})\Pr(\text{Defective})}{\Pr(10H)}$$
We knew that

$\Pr(\text{Defective}) = 1/100$
$\Pr(10H\mid\text{Defective}) = 1^{10} = 1$
$\Pr(10H) = 1 \cdot 1/100 + (1/2)^{10} \cdot 99/100 = 1123/102400$

So $\Pr(\text{Defective}\mid 10H) = 1024/1123$. This means the probability that you are holding a defective coin, given that 10 heads came up, is very high. This makes sense because it is unlikely that a good coin would give you 10 consecutive heads.
So, if it is indeed a defective coin, then the probability of getting a head again would be
$$1024/1123 \cdot 1 = 1024/1123$$
Or, if it is not a defective coin, then the probability is
$$99/1123 \cdot 1/2 = 99/2246$$
Therefore,
$$\Pr(\text{Head again}) = 1024/1123 + 99/2246 = 2147/2246$$