# Find the probability of 2 heads of n biased coins

Suppose you have a bag with $$n$$ coins, $$C_1, C_2, \dots, C_n$$, and coin $$C_i$$ has probability $$p_i$$ of coming up heads when flipped. Assume $$p_1 + p_2 + \cdots p_n = 1$$. Suppose you draw a coin from the bag at random and flip it and it comes up heads. If you flip the same coin it again, what is the probability it comes up heads?

I think it should be something about Baye's Theorem? I let $$P(H_1)$$ be the prob of the first head. Then, by Baye's Theorem, $$\sum_{i=1}^{n} P(H_1|C_i) P(C_i) = \frac{1}{n} (p_1+p_2+ \dots + p_n) = \frac{1}{n}$$, where C_i is the coin labelled by i, $$1 \leq i \leq n$$.

Then, I compute $$P(\{H_2|C_i\}|H_i) = \frac{P({H_2|C_i}\cap H_1)}{P(H_1)} = \frac{p_i^2}{\frac{1}{n}} = np_i^2$$. But I think this is not correct, so I wonder what should I do???

The probability that you picked coin $$C_i$$ and got a head is $$\frac1np_i$$. By total probability, the chance that you picked $$C_i$$ given that a head was flipped is $$\frac{(1/n)p_i}{(1/n)\sum_ip_i}=p_i$$ This is the posterior distribution of which coin was picked. The chance that the picked coin turns up heads again is then $$\sum_ip_i\cdot p_i$$ (left factor for the probability of picking $$C_i$$, right factor for the probability of it coming out heads) or $$\sum_ip_i^2$$. This is OK, since squaring a probability never increases it.