# biased coin flipping

Consider $n$ biased coins such that the probability that heads is flipped is $\frac{i}{n}$ for coin $i$ for $i=1, 2, \dots, n$. If a coin is selected at random, flipped, and shows heads, what is the probability that the coin was coin $i$?

Let $I$ be the random variable denoting which coin was picked, and $H$ be the event that heads was flipped. Then we're interested in

$$P(I=i|H)=P(H|I=i)\frac{P(I=i)}{P(H)}.$$

$P(H|I=i)=i/n$,

$P(I)=1/n$,

$P(H)=\sum_{i=1}^n P(H|I=i)P(I=i)=\sum_{i=1}^n\frac{i}{n}\frac{1}{n}=\frac{1}{n^2}\frac{n(n+1)}{2}=\frac{n+1}{2n}.$

So

$$P(I=i|H)=\frac{i}{n}\frac{1}{n}\frac{2n}{n+1}=\frac{2i}{n(n+1)}.$$

Notice that if you sum $P(I=i|H)$ over $i$, you'll get 1, so it's definitely a probability distribution.