Permutations – Beggar’s Theorem with Limited Range of Items

combinationspermutations

Beggars can't be choosers…

…or they just say.

Introduction

So the question is:

The number of ways to distribute 30 identical candies among four children C1, C2, C3 and C4 so that C2 receives at least 4 and at most 7 candies, C3 receives at least 2 and at most 6 candies, is equal to:

Okay, we have 4 children and 30 candies, but one can take $4$ to $7$ candies, other can take $2$ to $6$ candies while others can take any number of candies.
Enough of English, now lets bring it down to some mathematical action.

So we have $$C_1 + C_2 + C_3 + C_4 = 30$$ where,
$C_1, C_2, C_3, C_4 \in W$,
$C_2 \in \{4, 5, 6, 7\}$,
$C_3 \in \{2, 3, 4, 5, 6\}$

Standard/Classical Way

Since $C_2$ and $C_3$ are getting at least $2$ and $4$ candies already in every case, let's just give them already. So, after giving away $6$ candies from $30$ candies, we're left with 24 candies and we can still give more candies to $C_2$ and $C_3$, so we get:
$$C_1 + C_2 + C_3 + C_4 = 24$$
where,
$C_1, C_2, C_3, C_4 \in W$,
$C_2 \in \{0, 1, 2, 3\}$,
$C_3 \in \{0, 1, 2, 3, 4\}$

Now rewrite the equation as:
$$C_1 + C_4 = 24 – (C_2 + C_3)$$

Then we make all the possibilities for $(C_2 + C_3)$ and find their respective values of $(C_1 + C_4)$ and apply Beggar's Theorem individually. So lengthy process already.

In the end, we get a total $430$ possibilities.

Alternate Possible Solution (Doubt)

So, for now I've no approval that this method is legit or not but my idea is based on eliminating the individual beggars or children based on their upper limits of number of items (candies) received.

Step $1$

The first step is identical to that of the classical method, that is we give the minimum number of items received to the respective beggars. So, we're left with $24$ candies again.
And we get again:
$$C_1 + C_2 + C_3 + C_4 = 24$$
where,
$C_1, C_2, C_3, C_4 \in W$,
$C_2 \in \{0, 1, 2, 3\}$,
$C_3 \in \{0, 1, 2, 3, 4\}$

There is only $1$ way of distributing $4$ candies to $C_2$ and $2$ candies to $C_3$.

Step $2$

Now, the lowest upper limit of number of items received is of $C_2$, which is $3$, so let's distribute 3 chocolates among them and eliminate $C_2$.

Number of ways to distribute 3 candies among 4 children: $^6C_3 = 20$.
Number of candies left: 21

And we're left with $C_2$ can no longer receive any more candies and $C_3$ can still receive one more candy,
$$C_1 + C_3 + C_4 = 21$$
where,
$C_1, C_3, C_4 \in W$,
$C_3 \in \{0, 1\}$

Step $3$

Again, the receiver with the least lower limit of number of candies to receive is now $C_3$, which is $1$. So again, number of ways of distributing $1$ candy among all three are: $^3C_2 = 3$
So, now we're left with $20$ more candies to give to two children and we get:
$$C_1 + C_4 = 20$$
where,
$C_1, C_4 \in W$,

So there are exactly $3$ ways $1$ candy can be distributed among these $3$ children.

Step $4$

Now simply applying beggar's theorem, we get:
Number of ways to distribute $20$ candies to $2$ children: $^{21}C_1 = 21$

Step $5$

Multiplying all the possibilities of each step gives us:
$1\times20\times3\times21 = 1260$

Now the result I'm getting is way higher than the correct one is. After thinking and calculating other possibilities I noticed that there's a repetition of assigning number of candies for the children with higher or no upper limits of number of items candies received.

For example: If $C_1$ gets only $1$ candy, there are 4 possibilities that it got it from either of the four steps, while the number of candies received by it and other children is same.

Is there any way to eliminate these repetition or make some modifications in the process?
Any help will be appreciated…

Best Answer

This is the standard approach to such problems.

  • We want $A_1 + (A_2 + 4) + (A_3 + 2) + A_4 = 30$, subject to $ A_2 \leq 3, A_3 \leq 4$.

    • As OP noted, if there was no condition, then there are $ {27 \choose 3 }$ ways by stars and bars.
  • Let's count the complement. We apply PIE.

    • Let $E_2$ be the event that $A_2 \geq 4$ and $E_3$ be the event that $A_3 \geq 5$. We want to find $|E_ 2 \cup E_3 |$.
    • Show that $ |E_2| = {23 \choose 3}$, $|E_3 | = { 22 \choose 3 }$ and $|E_2 \cap E_3 | = {18 \choose 3 } $.
    • Hence by PIE, $|E_2 \cup E_3| = |E_2 | + |E_3| - |E_2 \cap E_3 |$
  • Thus, the number of ways is ${27 \choose 3 } - |E_2 \cup E_3 | = 430$