# Distributing k objects among m people where each person gets i objects such that a<i<b

In an examination, the score in each of the four subjects ( say ) - A ,B,C & D can be between integers 0 and 10. Then , how many are there such that the student can secure a total of 21 ?

My attempt - My initial attempt was to find out the total number of ways in which the student could score 21 and then look to subtract the number of ways which included a student scoring above 10. But I realised that this would include a lot of cases to be considered as I will have to weed out manually the attempts for each integer great than 10 which is too computationally intensive . Please tell me if there is any formulae ( along with justification for the formulae ) for solving the same.

• It's the coefficient of $x^{21}$ in $(1+x+\cdots+x^{10})^4$. Now use sum of a geometric progression, and general form of Binomial Theorem. – Gerry Myerson Feb 26 '16 at 8:11

Let $a$, $b$, $c$, $d$ denote the student's scores in subjects $A$, $B$, $C$, and $D$, respectively. Then $$a + b + c + d = 21 \tag{1}$$ is an equation in the non-negative integers subject to the constraints $a, b, c, d \leq 10$.

A particular solution of equation 1 corresponds to the insertion of three addition signs in a row of $21$ ones. For instance, $$1 1 1 1 1 1 + 1 1 1 1 1 1 1 + 1 1 + 1 1 1 1 1 1$$ corresponds to $a = 6$, $b = 7$, $c = 2$, and $d = 6$, while $$1 1 1 1 1 1 1 + 1 1 1 1 1 1 + + 1 1 1 1 1 1 1 1$$ corresponds to $a = 7$, $b = 6$, $c = 0$, and $d = 8$. Thus, the number of solutions of equation 1 is the number of ways three addition signs can be inserted into a row of $21$ ones, which is $$\binom{21 + 3}{3} = \binom{24}{3}$$ since we must select which three of the $21$ symbols (three addition signs and $21$ ones) will be addition signs.

However, we must exclude solutions in which one or more of the variables exceeds $10$. Observe that at most one of the variables can exceed $10$ since $2 \cdot 11 = 22 > 21$.

Suppose $a > 10$. Let $a' = a - 11$. Then $a'$ is a non-negative integer. Substituting $a' + 11$ for $a$ in equation 1 yields \begin{align*} a' + 11 + b + c + d & = 21\\ a' + b + c + d & = 10 \tag{2} \end{align*} Equation 2 is an equation in the non-negative integers with $\binom{10 + 3}{3} = \binom{13}{3}$ solutions. By symmetry, there are also $\binom{13}{3}$ solutions in which $b$, $c$, or $d$ exceeds $10$. Hence, there are $$\binom{4}{1}\binom{13}{3}$$ solutions of equation 1 in which one of the variables exceeds $10$.

Thus, the number of solutions of equation 1 in which none of the variables exceeds $10$ is $$\binom{24}{3} - \binom{4}{1}\binom{13}{3}$$

• Brilliant answer. – Noob101 Apr 7 '16 at 16:57

Note that if one subject scores 11 or more, then no additional subject will. So any such case will simply be a choice of a subject to receive 11 or more, then a distribution of the points over the 4 (not 3, we can still distribute more to the highest)

So, using multichoice (stars and bars)

$${21+4-1 \choose 21} - {4 \choose 1} {10 + 4 - 1 \choose 10}$$