# Number of Sets problem

A class is attended by $n$ sophomores, $n$ juniors, and $n$ seniors. In how many ways can these students form $n$ sets of three people each if each set is to contain a sophomore, a junior, and a senior?

I'm having trouble figuring this out. It looks like it's $n!^2$, or something like that, but can't explain it.

• Don't say "groups" when you mean "sets", as there's an important difference between these two words in mathematics. – DonAntonio Oct 8 '12 at 14:52

A sketch: Line up the seniors in order of student number. The senior with smallest student number has $n^2$ choices of partners. For each such choice, the senior with the next lowest student number has $(n-1)^2$ choices. So the seniors with the two lowest student numbers have between them $(n^2)(n-1)^2$ choices. Continue.
We can imagine having 3 pools ("A", "B", "C") of different students (each with $n$ students in total), and we want to fill $n$ 3-people slots with students of the 3 distinct types. Since the order within a set does not matter, we can imagine that "A" students are only assigned to the first slot, "B" students only to the second, and "C" students only to the third.
The "first" set (3-people slot) that is formed has $n^3$ possible combinations of students: $n$ choices for the first slot, $n$ for the second and $n$ for the third. After this first 3-people slot is filled, each pool A,B,C has $n-1$ students left. Hence for the "second" set (3-people slot), there are only $(n-1)^3$ possibilities to assign students, and so on. Once there is just one student left in each pool, there is just one possibility to form a group.
This leads to a total number of $\sum_{i=0}^{n-1} (n-i)^3$ sets that can be formed (note that the labeling of the sets does not matter - that's why I put first and second in quotation marks).