# How many possible ways of distributing 20 red balls and 20 blue balls among 4 students?

I am dividing 20 red balls and 20 blue balls among 4 students in a way that no student gets less than 3 or more than 7 of each ball? How can I carry out the distribution.

All I know, if there were no conditions, the solution would have been straight as follows: $$\left( \begin{array}{c} 20+4-1 \\ 4-1 \\ \end{array} \right)$$ for red balls and $$\left( \begin{array}{c} 20+4-1 \\ 4-1 \\ \end{array} \right)$$ for blue balls. And thus, the solution would be $$\left(\begin{array}{c} 20+4-1 \\ 4-1 \\ \end{array} \right) \times \left( \begin{array}{c} 20+4-1 \\ 4-1 \\ \end{array} \right).$$ Now, how should I involve the given conditions?

I was thinking of formulating an exponential generating function. But I am stuck! Is there a simple way of looking at this problem?

• If no student gets less than $3$ of each ball, then we would require at least $4 \cdot 3 = 12$ balls of each color. Please clarify. – N. F. Taussig Feb 11 '18 at 20:04
• What? If no student gets less than 3 balls of each type, then each student must get 3 red balls and 3 blue balls. But there are four students, so that's 12 red balls and 12 blue balls already. Am I missing something? – user326210 Feb 11 '18 at 20:04
• Did you mean that no student gets less than 3 or more than 7 balls in total (as opposed to "of each color")? – fractal1729 Feb 11 '18 at 20:04
• I am sorry, there was an oversight in the formulation of the question. But I have revisited it and made suitable changes. – Sulayman Feb 11 '18 at 20:38

Let's consider just one of the colours of balls.

The number of ways to distribute 20 indistinguishable objects between 4 people is equal to the number of solutions to

$$w + x + y + z = 20$$

for integers $w,x,y,z$ with $3 \leqslant w,x,y,z \leqslant 7$. This is the same as solving

$$w + x + y + z = 8$$

for integers $w,x,y,z$ with $0 \leqslant w,x,y,z \leqslant 4$. You know how many solutions this has when the only restriction is that $w,x,y,z \geqslant 0$. Now if we want to find how many cases there are with, say, $w > 4$ then we can set $w' = w-5 \geqslant 0$ and solve

$$w' + x + y + z = 3.$$

where $w',x,y,z \geqslant 0$. You know how many solutions this has, now repeat this for $x,y,z$. Finally, notice that we can't simultaneously have any two variables greater than 4, so it's easy to apply inclusion-exclusion from here.