Find The Number Of Permutation

I was solving one probability question, and to solve the problem I could relate it to binary and want solution.

The question was that in a fair toss repeated 10 times, what's the probability of 10th try to be the 5'th head.

I used brute-force and calculated it to be 63/512. But I can only brute force for definite numbers. What if I get n and x. So my problem is as stated below.

For all possible combination of a $n$ -bit binary number to have $x$ number of 1's where $x < n$.

Any Helps Will be Appreciated

The number of $n$-bit binary numbers with $x$ ones is given by the binomial coefficient

$$\binom nx=\frac{n!}{x!(n-x)!}\;.$$

• Can I find a proof for it – Kishan Kumar Sep 4 '15 at 18:06
• @KishanKumar: You certainly can -- e.g. in the sections titled "Definition and interpretations", "Multiplicative formula" and "Factorial formula" in the article I linked to. – joriki Sep 4 '15 at 18:21

Actually, when you switched from the specific question to a generalised one, you changed the question. Look closely at them !

The specific question involves what is called a negative binomial distribution, whose details you can look up.

However, as the name suggests, it is linked to the binomial distribution, and you can easily derive a formula. For your specific case, you need 4 heads in 9 tries followed by a head, thus

$${9\choose4}\left(\frac{1}{2}\right)^9\left(\frac12\right) = \frac{63}{512}$$

• Are you referring that I did not considering the last event – Kishan Kumar Sep 5 '15 at 9:46
• No, no, last event needs to be considered, and I have also considered it. It is the final term $\frac12$ in my expression. What I was saying is that there is a difference between getting the 5th head on the 10th toss (concrete example of yours), and getting 5 heads in 10 tosses (akin to the general problem you posed) – true blue anil Sep 5 '15 at 12:16
• I am solving the question as 4 heads in 9 tosses. And then multiplying it with 1/2 to get the actual answer – Kishan Kumar Sep 5 '15 at 14:01
• That is fine for the original question. – true blue anil Sep 5 '15 at 14:07
• Is there any better approach – Kishan Kumar Sep 5 '15 at 14:08