Binary string with even and odd number of 1s

4.6k Views Asked by At

How could it be shown that the number of binary string of length k with an even number of 1s is the same as those with an odd number of 1s.

Eg. for $k = 3$ :

Binary string length 3 with even amount of 1s : $000 ; 011 ; 110 ; 101$

Binary string length 3 with odd amount of 1s : $111 ; 100 ; 010 ;001$

Both of these set have the same cardinality. I'd like to see a generalization for any $k\in\mathbb{N}$.

If think we need to show there exist a bijection between the set of binary string of length $k$ with even number of 1s and and the one with odd number of 1s in order to prove they have the same cardinality, but I'm not sure how to define such a function.

Thanks

1

There are 1 best solutions below

0
On

think of a set $S_k$ with $k$ elements. then if you number the elements $1...k$ each binary string of length $k$ uniquely picks out a subset of $S_k$.

so you want to prove that any non-empty finite set has the same number subsets with an even number of elements as subsets with an odd number of elements.

this is trivial if $k$ itself is odd, since you can make a 1-1 correspondence between each subset and its complement, one of which must be even and the other odd.

a little further argument can go from this fact to prove the result in the case $k$ is even. so maybe try to prove this.