If a question asked: How many integer solutions of $x_1+x_2+x_3+x_4=30$ with $-9 \leq x_i \leq 21$? How would this be solved?

I understand how to solve if the inequality was $0 \leq x_i \leq 21$?, but how to solve between a negative and positive inequality?

$N = \binom{30 + 4-1}{30}$

$N(A_i) = \binom{(30 - ?) +4-1}{30 - ?}$


  • $\begingroup$ It is the coefficient of $x^{30}$ in $$\frac{x^{-36}(1-x^{30})^4}{(1-x)^4}$$ $\endgroup$ Dec 10, 2018 at 20:44
  • $\begingroup$ @MattSamuel Could you explain this? We have to use sets (finished generating functions chapter). $\endgroup$ Dec 10, 2018 at 20:46
  • $\begingroup$ The formula for $N$ you give is the unrestricted value. That is, it would be the answer if the question was how many solutions are there to $x_1+x_2+x_3+x_4=30$ with $x_i≥0$. More work is needed to handle a cap, as in $0≤x_i≤21$. $\endgroup$
    – lulu
    Dec 10, 2018 at 20:58
  • $\begingroup$ "set theory" has nothing to do with your question. $\endgroup$
    – Jean Marie
    Dec 10, 2018 at 21:47
  • $\begingroup$ @JeanMarie Ah, sorry, I assumed so because that's our current chapter. $\endgroup$ Dec 10, 2018 at 22:34

1 Answer 1


Let $y_i=x_i+9$. Then $$ y_1+y_2+y_3+y_4=66\\ 0\leq y_i\leq 30 $$ Now find the number of solutions the way you say you know.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.