# Counting with restrictions.

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.

-Annie

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

$\sum\limits_{r=0}^\frac{n}{2}\binom{n-2r+c-3}{c-3}$

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

$\sum\limits_{r=0}^2\binom{n-2r+c-3}{c-3}=\binom{15}{2}+\binom{13}{2}+\binom{11}{2}=238$

• Thank you for explaining that very clearly! – Annie Jan 24 '15 at 21:50
• Sure, my pleasure, I hope it helped. I am glad to answer any further questions. – Jorge Fernández Hidalgo Jan 24 '15 at 21:56