
Anoop B. answered 12/16/20
ML Engineer with Masters in CS and Bachelors in Math
Let's take the three coins case first:
In order to get exactly two heads in 3 flips, the probability is 3/8. This is because there are 3 possibilities (HHT, HTH, THH) and each of those possibilities occurs with 1/8 (1/2 * 1/2 * 1/2) probability.
In order to get exactly two heads in four flips, the probability is 6/16 or 3/8. This is because there are 6 possibilities (HHTT, HTHT, HTTH, THHT, THTH, TTHH) and each one occurs with 1/16 (1/2 * 1/2 * 1/2 * 1/2) probability.
So the chance of getting 2 heads with three flips or with four flips is the same.
Note that this can also be solved with the binomial theorem. The theorem states that the probability of getting k of some outcome that has a probability of p in n trials is (n choose k)(p)k(1-p)(1-k). So in this case,
3 flips: (3 choose 2)(1/2)2(1/2)1 = 3 * 1/8 = 3/8
4 flips: (4 choose 2)(1/2)2(1/2)2 = 6 * 1/16 = 3/8