[Math] Dividing a class into groups

combinatorics

A class contains 15 students, with three students in each grade from grade 1 to grade 5. The teacher want to divide the class into five groups of three students, so that in each group, the grades of any two students differ by at most 1. How many different ways can the teacher form the groups? How should I start? Thanks. $8$ is a wrong answer. I don't know if the students are same or different. This is the exact question given to me.

Best Answer

Let $f(n)$ be the number of ways to sort the $3n$ students into $n$ trios, with the condition imposed.

  • Suppose all three students in grade $n$ are together. There is $1$ way to put them together, and then $f(n-1)$ way to put everyone else into trios.
  • Suppose two students in grade $n$ are together. The third student must be in grade $n-1$. That means that there is another trio containing one student in grade $n$ and two students in grade $n-1$. There are $9$ ways to arrange this, and then $f(n-2)$ ways to put the younger students into trios.

Therefore we have $$f(n)=f(n-1)+9f(n-2)$$ with the starting values $f(1)=1,\ f(2)=10$.

This is equivalent to Emperor of Ice Cream's second solution. The other solutions are correct if we are looking only for the number of schemes (e.g. 111-223-233-445-455). The answer to the original question is $$f(5)=280.$$.