There are two biased coins, the probability of flipping heads for the first coin is a, the probability of flipping heads for the second coin is b. One of the coins is chosen at random, with probability p that the first coin is chosen. A Once the coin is chosen, it is flipped 3 times and k Heads are observed, where k = 0, 1, 2, 3.
What is the conditional probability that the first coin was chosen?
Letting X be the random variable representing the choice of the coin, and K be the random variable representing the number of heads, I understand that this is an application of a variation of Bayes' Rule:
$$ p_{X|K}(x|k) = \frac {p_X(x)p_{K|X}(k|x)}{\sum_{k'}p_X(x')p_{K|X}(k|x')} $$
I know that the first term is substituted for p, from above: $$ p_X(x) = p $$
But I'm unsure how to evaluate: $$ p_{K|X}(k|x) $$ Having similar trouble interpreting the denominator.
Any help is much appreciated. Picking up a stat class late in the semester and struggling to get caught up. Thanks in advance.
Conditional on the first coin being chosen, the probability of flipping $k$ heads is $\binom{3}{k}a^k(1-a)^{3-k}$, and conditional on the second coin being chosen, it is $\binom{3}{k}b^k(1-b)^{3-k}$. Thus, by Bayes' Rule, the probability of flipping $k$ heads is $$ p\binom{3}{k}a^k(1-a)^{3-k}+(1-p)\binom{3}{k}b^k(1-b)^{3-k}. $$ Thus, the conditional probability that the first coin was chosen given that $k$ heads were flipped is $$ \frac{p\binom{3}{k}a^k(1-a)^{3-k}}{p\binom{3}{k}a^k(1-a)^{3-k}+(1-p)\binom{3}{k}b^k(1-b)^{3-k}}. $$