# Find number of Heads and Tails in Possible Permutations

In my discrete math book we keep coming back to using a coin flip. When doing random variables and expected value they use the coin flip again to figure out how many heads on 3 coin flips. However, they do it by hand listing out each iteration to find the number of heads.

As an example if a coin is flipped 3 times and you want to know the number of permutations have 2 heads. In the book they do

X(HHT) = X(HTH) = X(THH) = 2
X(TTH) = X(THT) = X(HTT) = 1


That makes a lot of sense. However I am being presented a problem that is a coin is flipped 8 times. I really don't want to write down 256 variations just to the random variable of H.

So my question is. Is there a way to find this out mathematically? I swear I have to be missing something while looking up how to do it.

-
Do you know what a binomial coefficient is? en.wikipedia.org/wiki/Binomial_coefficient – Qiaochu Yuan May 1 '11 at 23:29
We talked about it for about 10 minutes in class and nothing since then. I will go back and take a look. – percent20 May 1 '11 at 23:39
That worked. Later I will post it up. Just to be thorough on this question if no one else does. – percent20 May 1 '11 at 23:59