I need help with counting with restrictions, such as in the problem

In how many ways can we distribute 13 pieces of identical candy to 5 kids, if the two youngest kids are twins and insist on receiving an equal number of pieces?

How do you complete these type of questions?

NOTE: This is NOT the exact question, mine has more people.

Any help is appreciated.


  • $\begingroup$ It'd be useful if you told us how much you know about combinatorics. $\endgroup$ – Shahar Jan 24 '15 at 21:11
  • $\begingroup$ I know about permutations and combinations... $\endgroup$ – Annie Jan 24 '15 at 21:26
  • $\begingroup$ In your problem, how many candies? For smallish like $13$ we can do cases and Stars and Bars for each case. $\endgroup$ – André Nicolas Jan 24 '15 at 21:34
  • $\begingroup$ You mean in my real question I have to answer? For that I have to do 20. $\endgroup$ – Annie Jan 24 '15 at 21:36

Suppose you have $n$ candies, and $c$ kids. You can first select how many candies you want to give the twins, suppose it is $2r$ in total. Then there are $c-2$ kids and $n-2r$ candies left. You can now give these candies away freely. We use the method of stars and bars to count the number of ways: there are $n-2r$ candies(stars) and there are $c-2$ kids left which need $c-3$ bars to be separated, then there are $\binom{n-2r+c-3}{c-3}$ ways to distribute the candies.

Since $r$ can go anywhere from $0$ to $\frac{n}{2}$ the final answer is:


In your particular question $n=13,c=5$. Hence the answer is


  • $\begingroup$ Thank you for explaining that very clearly! $\endgroup$ – Annie Jan 24 '15 at 21:50
  • $\begingroup$ Sure, my pleasure, I hope it helped. I am glad to answer any further questions. $\endgroup$ – Jorge Fernández Hidalgo Jan 24 '15 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.