# Arranging 120 students into 6 different groups so that the largest and smallest group differ by 2 me

Arranging 120 students into 6 different groups so that the largest and smallest group differ by 2 members
In how many different ways can we arrange 120 students into 6 groups for 6 different classes so that the largest group has at most 2 members more than the smallest group?
My initial plan was to use a generating function, but I stumbled across a problem. Let's mark the groups with numbers 1 to 6 and let ${n}_{i},i\in \left\{1,\dots ,6\right\}$ denote the number of members of the i-th group in some arrangment. To see where this would lead me, for a moment, I assumed ${n}_{1}\le {n}_{2}\le \cdots \le {n}_{6}\le {n}_{1}+2$ in hope to find some range $\left\{m,\dots M\right\}$ for ${n}_{i}$'s and use a generating function $f\left(x\right)=\left({x}^{m}+\cdots +{x}^{M}{\right)}^{6}$ and find $⟨{x}^{120}⟩-$ the coefficient in front of ${x}^{120}$, however students are distinct entities and m and M still remained misterious. I then tried figuring out if I was on the somewhat right track by, again taking $m=min\left\{{n}_{1},\dots ,{n}_{6}\right\}$ and write ${n}_{i}=m+{j}_{i},{j}_{i}\in \left\{0,1,2\right\}.$. I believe, an arrangement with 2 groups of 19,2 groups of 20 and 2 groups of 21 people suggests there should be at least 19 people in each group.
You can still ask an expert for help

## Want to know more about Discrete math?

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Paxton James
Step 1
For an another approach : When we check over the question , we see that it is distributing distingusiable objects into distinguishable boxes question. By that reason , using exponential generating function is more suitable than using ordinary generating functions.
It is given that the largest class can have at most 2 more students than the smallest. Then we see that a group can have at least 19 and at most 21 students. Then if the groups will be distingusihable then our exponential generating function of each group will be $\left(\frac{{x}^{19}}{19!}+\frac{{x}^{20}}{20!}+\frac{{x}^{21}}{21!}\right)$
Then ,we should find the coefficient of $\frac{{x}^{120}}{120!}$ or find the coefficient of ${x}^{120}$ and multiply it by 120! in the expansion of $\left(\frac{{x}^{19}}{19!}+\frac{{x}^{20}}{20!}+\frac{{x}^{21}}{21!}{\right)}^{6}$.
Step 2
However , if the groups will be indistinguishable , then multiply the result of $\left[{x}^{120}\right]\left(\frac{{x}^{19}}{19!}+\frac{{x}^{20}}{20!}+\frac{{x}^{21}}{21!}{\right)}^{6}$
by $\frac{1}{6!}$.
Then , the result is $\frac{1}{6!}×\left[{x}^{120}\right]\left(\frac{{x}^{19}}{19!}+\frac{{x}^{20}}{20!}+\frac{{x}^{21}}{21!}{\right)}^{6}$
When we calculate the result using given coefficient in the link , the answer is $5.756410166785662e+87$
###### Did you like this example?
landdenaw
Step 1
You can do this a smidgen more simply (at least, it's simpler to me).
First, the average size of a group is 20. If any group is smaller than average, then some other group must be larger than average, which means that there must be a group of size at least 21. Thus, the smallest group must have size at least 19.
Distribute 19 people into each group. This can be done in $x=\left(\genfrac{}{}{0}{}{114}{19,19,19,19,19,19}\right)$ ways.
Now count the ways to distribute the remaining 6 people across the groups with the constraint that no more than 2 of these people can go into any group and multiply the result by x. The unconstrained number of solutions of ${x}_{1}+\cdots +{x}_{6}=6$ is $\left(\genfrac{}{}{0}{}{11}{6}\right)$. Using the principal of inclusion and exclusion, you must subtract the number of solutions where ${x}_{i}\ge 3$. For any i, there are $\left(\genfrac{}{}{0}{}{8}{3}\right)$ such solutions, so you must subtract $6\left(\genfrac{}{}{0}{}{8}{3}\right)$. But you also must add back the double-counted solutions where ${x}_{i},{x}_{j}\ge 3$, of which there are $\left(\genfrac{}{}{0}{}{6}{2}\right)$.
So the answer is: $\left(\left(\genfrac{}{}{0}{}{11}{6}\right)-6\left(\genfrac{}{}{0}{}{8}{3}\right)+\left(\genfrac{}{}{0}{}{6}{2}\right)\right)x.$