Find the number of non-negative integers to
$$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 = 57$$ where $$x_1 \lt 3, x_3 \ge 4$$ I first found the total number of solutions N=$57+6-1\choose57$=6471002, then the total number of equations for the restriction $x_1 \ge 3$, N(P1)=$54+6-1\choose54$=3425422, then for the restriction $x_3 \le 3$, N(P2)=$4+6-1\choose4$=126 and I have to find the number of solutions for both the restrictions N(P1P2), but I don't know the number I should plug in the combination formula or if my calculations are correct.

  • $\begingroup$ The way you handled the $x_1\geq 3$ restriction you can also handle the $x_3\geq 3$ restriction. Which is to say, remove the restriction and say you want $x_1+x_2+x_3+x_4+x_5+x_6 = 54$ instead. That's one less thing to worry about. $\endgroup$
    – Arthur
    Jan 14, 2020 at 21:39
  • $\begingroup$ Can you elaborate? $\endgroup$
    – lina
    Jan 14, 2020 at 21:41
  • 1
    $\begingroup$ How did you get $54+6-1\choose54$? That's really all there is to it. Just do it to $x_3$ rather than $x_1$, and simplify the problem before trying to use inclusion-exclusion. $\endgroup$
    – Arthur
    Jan 14, 2020 at 21:43
  • $\begingroup$ I see now that we have $x_3\geq 4$ rather than $x_3 \geq 3$. So apologies for the confusion there. Still, that's something I would suggest you take care of first, and then set to find the number of solutions. Like was suggested in the naswer below. $\endgroup$
    – Arthur
    Jan 14, 2020 at 22:22

1 Answer 1


This problem is equivalent to distribute $57$ candies to $6$ kids. To eliminate $x_3\ge4$ restriction, let's give $4$ candies to $x_3$. So problem is now

$x_1 + x_2 + x_3 + x_4 + x_5 + x_6 = 53$ with $x_1\le2$

I prefer Stars and Bars method see here.

$x_1=0:\quad$ $ x_2 + x_3 + x_4 + x_5 + x_6 = 53$. This implies we have $53$ stars and $4$ bars and we use Permutations with Repetition see here


$x_1=1:\quad$ $ x_2 + x_3 + x_4 + x_5 + x_6 = 52$ $$\frac{56!}{52!4!}$$

$x_1=2:\quad$ $ x_2 + x_3 + x_4 + x_5 + x_6 = 51$


So the answer is $$\frac{57!}{53!4!}+\frac{56!}{52!4!}+\frac{55!}{51!4!}$$

  • $\begingroup$ How did you get x1≤2? $\endgroup$
    – lina
    Jan 14, 2020 at 21:52
  • $\begingroup$ Because $x_1<3$ and it is non-negative integer, $x_1<3\equiv 0\le x_1\le2$ $\endgroup$ Jan 14, 2020 at 21:56

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.