In how many ways can a student select six classes from three groups if they must take at least two from the first and second groups? Question: Students at school can choose from 16 subjects to study for their Certificate. Seven of these subjects are in group I, six are in group II, and the other three are in group III. Students must study six subjects to qualify for the Certificate. How many combinations of subjects are possible if students must choose 2 subjects from groups I and II, and the remaining subjects could be from
any group. 
Attempt: 
$${7 \choose 2}{6 \choose 2}{12 \choose 2}=20790$$ 
However the answer is $5320$, i'm not to sure what I am doing wrong, can anyone help? 
 A: You're overcounting because in cases where there are more than $2$ subjects in one of groups I and II you could regard any $2$ of them as the ones satisfying the requirements for those groups. So e.g. if you have $3$ in group I, you're overcounting by a factor $\binom32=3$, and if you have $4$ in group I you're overcounting by a factor $\binom42=6$.
A: You need to consider how many classes can be taken in each group.  There are six possibilities:


*

*Four classes from group 1 and two from group 2

*Three classes from group 1 and three from group 2

*Three classes from group 1, two from group 2, and one from group 3

*Two classes from group 1 and four from group 2

*Two classes from group 1, three from group 2, and one from group 3

*Two classes from group 1, two from group 2, and two from group 3


Consequently, the number of schedules that a student could select is
$$\binom{7}{4}\binom{6}{2} + \binom{7}{3}\binom{6}{3} + \binom{7}{3}\binom{6}{2}\binom{3}{1} + \binom{7}{2}\binom{6}{4} + \binom{7}{2}\binom{6}{3}\binom{3}{1} + \binom{7}{2}\binom{6}{2}\binom{3}{2}$$
A: Let $A_i$ be the selections with $i$ elements from group I and $B_i$ be the selections with $i$ elements from group II.
Then $ \big|\overline{A_0}\cap \overline{A_1}\cap\overline{B_0}\cap\overline{B_1}\big|=\big|S\big|-\big|A_0\big|-\big|A_1\big|-\big|B_0\big|-\big|B_1\big|+\big|A_0\cap B_1\big|+\big|A_1\cap B_0\big|-\cdots$
$\hspace{1.7 in}\displaystyle=\binom{16}{6}-\binom{9}{6}-\binom{7}{1}\binom{9}{5}-\binom{10}{6}-\binom{6}{1}\binom{10}{5}=5320$
