[Math] number of subsets of a set with even sum using combinatorics or binomial

binomial-coefficientscombinatoricsnumber theory

Let S={a1,a2,a3…….aN}.There are 2^N subsets of this set so if we don't consider the empty set we are left with 2^N-1.We do need to consider cases where it number of odd numbers may be zero and number of odd numbers not zero.How do we count the number of subsets of this set having sum as even?

Best Answer

Let $o$ and $e$ be the number of odd and even numbers in $S$, respectively, with $o+e=N$. If $o=0$, all $2^N$ subsets have even sum. If $o\ne0$, then half of the $2^o$ subsets of the odd numbers contain an even number of odd numbers and hence have an even sum, and they can be combined with all $2^e$ subsets of the even numbers, for a total of $2^{e+o-1}=2^{N-1}$ subsets.