A box contains three coins; one coin is two-headed, one coin is fair, and another coin is weighted so that the probability of heads appearing is 1/3. A coin is randomly selected and flipped. 
-Two-headed coin (100% chance in getting heads)
-Fair coin (50% chance in getting heads)
-Weighted Coin (33.3333% chance in getting heads) 
(a) What is the probability (p) that heads appear? 
-Given the info above, I got 33/54.
(b) What is the probability that the coin is two-headed if the coin selected is known to be head? 
I don't understand how to solve for the probability using Bayes' Theorem. Can someone please guide me through the logic of solving such problems? Thank you!
 A: Let $H$ be the event that heads appears, $T$ the event that the two-headed coin is drawn, $F$ the event that the fair coin is drawn, and $W$ the event that the weighted coin is drawn.
For part (a), we just need to compute $P(H)$. Since $T$, $F$, and $W$ partition the sample space (i.e., they are pairwise disjoint and their union accounts for all possibilities), we can use the law of total probability to get
$$
P(H) = P(H \mid T)P(T) + P(H\mid F)P(F) + P(H\mid W)P(W) = (1)(1/3) + (1/2)(1/3) + (1/3)(1/3) = 33/54.
$$
Now, for part (b), we use Bayes' theorem to compute
$$
P(T \mid H) = \frac{P(H\mid T)P(T)}{P(H)} = \frac{(1)(1/3)}{(33/54)}=6/11.
$$

To better understand what is going on with Bayes' theorem, I find it useful to derive the formula above by using the definition of conditional probability:
$$
P(A\mid B) = \frac{P(A\cap B)}{P(B)}.
$$
This definition shows that $P(A\cap B) = P(A\mid B)P(B)$, and so by the symmetry of intersection, $P(A\cap B)=P(B\cap A) = P(B\mid A)P(A)$. This yields the formula
$$
P(A\mid B) = \frac{P(A\cap B)}{P(B)}
= \frac{P(B\mid A)P(A)}{P(B)}.
$$
Thus, in a way, we sort of "reverse" our assumption from $B$ to $A$.
Interestingly enough, this is also how the law of total probability is derived. If $X_1,\ldots,X_n$ partition the sample space, then we have
$$
P(A) = P(A\cap X_1) + \cdots + P(A\cap X_n) = P(A\mid X_1)P(X_1)+\cdots +P(A\mid X_n)P(X_n).
$$
