Equal number of 1s and 0s in number of n digits

367 Views Asked by At

How many ways could one create a binary number of n digits where the number of 1s and 0s are equal?

For example, if n was 8 then we could have:

10101010

or

11110000

In addition to this, I may add that numbers such as:

00001111

are allowed as I am concerning the application of 1 and 0 as abstract ideas.So 1 and 0 could easily be replaced by "banana" and "apple" or (in better context) "y+1" and "x+1".

2

There are 2 best solutions below

0
On

Pick $n$ of the $2n$ digits to put one's in: $$\binom{2n}{n}=\frac{(2n)!}{(n!)^2}$$

0
On

Suppose there are $2n$ digits to fill. (The problem is clearly impossible if the number of digits is odd.) Once we have chosen the location of the $n$ zero digits the position of the ones digits will be uniquely determined. It follows that the number of strings of the form you are looking for is the number of ways to choose $n$ objects from a set of $2n$ objects without caring about ordering, i.e. the number is $$ \binom{2n}{n}=\frac{(2n)!}{(n!)^2}. $$