How many subsets of the set {1, 2, ... , 9} contains exactly two odd numbers? I have encountered this problem in one of my books on discrete mathematics: How many subsets of the set {1, 2, 3, 4, 5, 6, 7, 8, 9} contains exactly two odd numbers? There is no restriction on how many even numbers the subset can contain.
I quickly realized that the number subsets of the set is so large that is stupid to solve it by just writing and counting it.
I solved it using Python instead, like you can see in the attached image file. But now I want to know how you can solve it with just math? There must be a proper way to solve problems like these. If I programmed it correctly then the correct answer is 160. Please help, thanks.


Any subset satisfying the condition is determined by its parts consisting of odd and even numbers, which are:

*

*an arbitrary two-element subset of $\{ 1, 3, 5, 7, 9 \}$;

*an arbitrary subset of $\{ 2, 4, 6, 8 \}$.

The first part can be formed in $\binom{5}{2} = 10$ ways, the second part in $2^4 = 16$ ways. Hence there are $16 \cdot 10 = 160$ such subsets.
