2

I have seen this question which lead me ask this following question.

What is the number of unique possibilities to generate a binary string that has M 0s and N 1s.? For example,

If M=3, N=4, then possible combinations are 
0001111
0101010
etc.

2 Answers2

2

I think this is equivalent to say, we have $M+N$ positions from where we choose $N$ positions to fill with $1$. The number of ways is clearly then $$ \binom{M+N}{N} = {(M+N)! \over M! \cdot N!} $$

nickchalkida
  • 1,495
0

OK, so you have $n$ digits, of which $r$ are 0 and $s$ are 1. Obviously, $r + s \le n$.

Think of it in the following steps, which are independent:

  • Select $r + s$ of the $n$ positions for the 0 and 1. This can be done in $\binom{n}{r + s}$ ways.
  • Select $r$ of the 0/1 positions for the 0s, this can be done in $\binom{r + s}{r}$ ways
  • Fill the $n - (r + s)$ positions left over with one of the remaining $8$ digits, in order. This gives $8^{n - (r + s)}$ options.

Pulling all together:

$$\binom{n}{r + s} \cdot \binom{r + s}{r} \cdot 8^{n - (r + s)}$$

vonbrand
  • 27,812