edited by
1,286 views
3 votes
3 votes
How many bit strings of length $n$ contain exactly $r$  $1's$?
edited by

2 Answers

Best answer
3 votes
3 votes

As the length of the bit strings are n

And the strings are containing exactly r 1's

So, we have to choose  r 1's  from n-length string 

the answer will be $^nC_r$ or $\dfrac{^nP_r}{r!}$→as all 1's are same

one question may arise that   Why it is not a permutation problem?

Consider this string 11000, here n= 5 & r=2

now if we permute $^5 P_2$ then it would be 60

But there are two  1's & three 0's. So, $\dfrac{60}{{2}*{3}}$

And the generalized formula will be same as combination formula or the formula of permutation with repeating objects

Formula of combination ⇒ $^nC_r$ = $\dfrac{n!}{{(n-r)!}*{r!}}$

Formula of permutation with r repeating objects ⇒ $\dfrac{^nP_r}{r!}$ = $\dfrac{n!}{{(n-r)!}*{r!}}$

edited by
0 votes
0 votes
Look its a string of bits you can have only two values at each psoitions in string not n-1

If length of string is n and you want exactly r 1's than you just select r places from these n length string by using nCr....now as you have r 1's exactly now you cant have more 1's the left places need to be filled by 0's so you have only 1 option i.e to fill all left postions by 0's...as all same terms no qsn of arranging so just nCr would be your answer..!

Related questions

1 votes
1 votes
1 answer
2
tusharp asked Jul 5, 2018
1,704 views
I am not getting this condition. Can someone please explain that condition with that example.
1 votes
1 votes
3 answers
4
Lakshman Bhaiya asked Mar 2, 2018
4,263 views
How many ways are there to put four different employees into three indistinguishable offices when each office can contain any number of employees?