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?
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}$$