Number of ways to select N sets out of M sets, plus 1 item from each set

219 Views Asked by At

I have M sets with a different number of items from each: e.g. [a b c] [d e] [f g h] [i j k l] [m] [n o p q] ... [w x] I need to select N of these sets, and one item from each set:

e.g. If N = 3: [a d f] [a e f] [a e h] [a e i] [d f l] ...

How many possible ways are there of doing this?

1

There are 1 best solutions below

1
On

Let $S_{i}$ denote the $i^{th}$ set out of $M$ and |$S_{i}$| denote the size of $S_{i}$. We assume all sets are disjoint.

Since the number of total elements and specific set sizes arent defined, this answer will be very abstract. You need to sum the ways of picking an element from each set across each distinct possible selection of N sets.

Let $B_{j}$ denote the $j^{th}$ string out of ${M\choose N}$ binary strings with M digits containing N 1s.
Let $B_{j,i}$ denote the $i^{th}$ binary digit in the $j^{th}$ string.

$\sum_{j=1}^{M\choose N} \prod_{i=1}^{M} B_{j,i}* |S_{i}|$