# Determining the probability of the count of Heads and Tails in a trial of 50 flips.

I am trying to determine the probability of how many heads or tails show up after flipping a coin 50 times. If I wanted to determine the probability of getting 20 heads in 50 flips. How would I go about doing this? I do know that if I wanted to determine the probability of getting at least 1 head would be x = 1 - (0.5^L) where L is the number of total flips. I also know that if I wanted to determine the number of Heads when there were no tails flipped that the equation would be x = 0.5^L. For my question would the probability of getting 20 heads out of 50 coin tosses be x = 20 - (0.5^L)? Or am I not thinking about this the right way?

• Your $20-0.5^L$ cannot be a probability as it exceeds $1$, so you are indeed thinking about this the wrong way. You can either calculate the probability of $20$ from $50$ using combinatorics (how many equally probable ways of $20$ from $50$? how many equally probable ways in total?) or from the binomial distribution – Henry Nov 6 '19 at 23:25

This is the Binomial distribution, with $$n = 50$$ and $$p = 0.5$$. For a $$B(n, p)$$ distribution, the probability of getting $$k$$ "successes" (in this case, heads) is equal to the product of the probabilities of $$k$$ individual successes (which are all equal to $$p$$) and $$n-k$$ failures (which are all equal to $$1-p$$), multiplied by the number of ways to arrange them in different orders (e.g. for three coins and two heads, there's HHT, HTH and THH), which is equal to $${n \choose k} = \frac{n!}{k!(n-k)!}$$.

In other words:

$$P(k \mbox{ successes}) = p^k (1-p)^{n-k} \frac{n!}{k!(n-k)!}$$

so for your case, with $$n=50, p=0.5, k=20$$, that probability is:

$$P(\mbox{20 heads}) = 0.5^{20} \times 0.5^{30} \frac{50!}{20!30!} \approx 0.0419$$ (according to an online calculator)

Note that if you're wondering how "unusual" it is to only get 20 heads out of 50 flips, you generally look at the probability of getting a result at least as unusual, which means we actually want the cumulative probability $$P(\mbox{20 or fewer heads}) = P(k \leq 20) \approx 0.1013$$

That is, you would get 20 heads about 1 in every 24 tries, but you would get 20 or fewer heads about 1 in every 10.