-2

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

Kishan Kumar
  • 171
  • 1
  • 11

2 Answers2

2

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

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

joriki
  • 238,052
1

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}$$