# Number of integer solutions to the equation $x_1 + x_2 + x_3 + x_4 = 21$ such that $x_i \in [0, 10]$

I want to find the number of solutions to the following equation $$x_1+x_2+x_3+x_4 = 21$$ such that $$x_i$$ is in $$[0,10]$$

I know that total solutions will be $${24}\choose3$$ but this will also include solutions where $$x_i$$ is not in $$[0,10]$$. So how do I find the solution to this problem?

• The quantity $\binom{20}{3}$ is actually the number of solutions in the positive integers, not the nonnegative integers. – N. F. Taussig Dec 22 '18 at 13:51
• Yeah right, I’ve made the correction, thanks – user601297 Dec 22 '18 at 13:52

As you observed, the number of solutions of the equation $$x_1 + x_2 + x_3 + x_4 = 21 \tag{1}$$ in the nonnegative integers is $$\binom{21 + 4 - 1}{4 - 1} = \binom{24}{3}$$ From these, we must subtract those solutions in which one or more of the variables exceeds $$10$$. There can be at most one such variable since $$2 \cdot 11 = 22 > 21$$.
We count the number of solutions that violate the restriction that $$x_i \leq 10$$, $$1 \leq i \leq 4$$.
Choose which of the four variables exceeds $$10$$. Suppose it is $$x_1$$. Then $$x_1' = x_1 - 11$$ is a nonnegative integer. Substituting $$x_1' + 11$$ for $$x_1$$ in equation 1 yields \begin{align*} x_1' + 11 + x_2 + x_3 + x_4 & = 21\\ x_1' + x_2 + x_3 + x_4 & = 10 \tag{2} \end{align*} Equation 2 is an equation in the nonnegative integers with $$\binom{10 + 4 - 1}{4 - 1} = \binom{13}{3}$$ solutions. Hence, there are $$\binom{4}{1}\binom{13}{3}$$ solutions in the nonnegative integers that violate the restriction that $$x_i \leq 10$$, $$1 \leq i \leq 4$$.
Hence, the number of admissible solutions is $$\binom{24}{3} - \binom{4}{1}\binom{13}{3}$$
I would find coefficient of $$x^{21}$$ in the expansion of $$(1+x+x^2+x^3+...+x^{10})^4$$ Calculate $$1+x+x^2+x^3+...+x^{10}$$ by G.P. and then using formulas for finding coefficients for binomial and negative binomial you can find the coefficient.
• @N.F.Taussig thank you ...i first tried typing but I typied $x^21$ so I got confused – onlymath Dec 22 '18 at 14:04