5
$\begingroup$

I have $10$ indistinguishable cars , $12$ indistinguishable balls, $14$ indistinguishable teddy bears.I want to distribute them to $3$ different children in a kindergarten such that each child will take exactly $7$ toys.How many distributions are there?

$\mathbf{\text{My attempt:}}$ First of all, I thought that it can be solved by generating functions easily. However, the process became suddenly cumbersome.

If each child will take exactly $7$ toys , then we need $21$ toys in total. For example , $10$ cars, $6$ balls and $5$ teddy bears can be a sample. By using this information, I decided to use generating functions such that if a child take exactly $7$ toys, then his generating function form is $$(x^7+y^7+z^7+x^6y+x^6z+x^5y^2+x^5yz+...+yz^6)$$ where $x,y,z$ represents cars, balls and teddy bears, respectively. As you count by combination with repetition, there are $\binom{7+3-1}{7}=36$ terms in the tuple.

Because of there are $3$ children , we will deal with $$(x^7+y^7+z^7+x^6y+x^6z+x^5y^2+x^5yz+...+yz^6)^3$$

However, there is a problem for me. Calculating the coefficients for each possible selection is very cumbersome. For example, we said that one of the possible toy selections of $21$ of $36$ is $10$ cars, $6$ balls and $5$ teddy bears. In that sample, we should find $$[x^{10}y^6z^5](x^7+y^7+z^7+x^6y+x^6z+x^5y^2+x^5yz+...+yz^6)^3$$

As you realize there are many other toy selections out of $36$, for example $5$ cars, $8$ balls and $8$ teddy bears is an another sample.

I want you guys to handle this cumbersome selection process. How can I find the all coefficients of this generating function for all possibilities?

Please do not suggest using a computer algorithm. I am here to see a mathematical approach I could apply to my problem. What's more, if you have another approach, feel free and share it with me. I am open to another methods.

$\endgroup$
6
  • $\begingroup$ Seems like a tough one. I think that this answer is no help, because you have to satisfy the following $6$ constraints: [1] $a_1 + a_2 + a_3 \leq 10.$ [2] $b_1 + b_2 + b_3 \leq 12.$ [3] $c_1 + c_2 + c_3 \leq 14.$ [4] $a_1 + b_1 + c_1 = 7.$ [5] $a_2 + b_2 + c_2 = 7.$ [6] $a_3 + b_3 + c_3 = 7.$ $\endgroup$ Commented Nov 10, 2021 at 23:03
  • $\begingroup$ If I was forced to solve this manually, re the previous comment, I would look for some way to organize (i.e. partition) the set of solutions to [1], the set of solutions to [2], and the set of solutions to [3]. The idea would be to somehow conjure partitioning that facilitated combining solutions from [1], [2], and [3] to also satisfy [4], [5], and[6]. Frankly, I can't imagine what the partitioning schemes would be. $\endgroup$ Commented Nov 10, 2021 at 23:07
  • $\begingroup$ The alternative approach is (sort of) the reverse. There are $\binom{9}{2} = 36$ solutions to each of [4], [5], [6]. So, you might consider how many of the $(36)^3$ overall solutions violate the constraints of at least one of [1], [2], or [3]. The problem is that this (very inelegant) approach will not generalize well when (for example) the number of children and the number of each type of toy is increased. $\endgroup$ Commented Nov 10, 2021 at 23:12
  • $\begingroup$ @user2661923 thanks for your work and comments . As you said partition schemes is tedious , so i need a generalization. If somethings come to your mind , please write it. B.T.W , I glad to see you in my question :) Have a nice day.. $\endgroup$ Commented Nov 11, 2021 at 6:03
  • 1
    $\begingroup$ @MathLover thanks , i glad to hear it from you :) Sometimes i made up such question when i am in traffic jam , by the way Mike's solution is better than my question. What a genius man !! $\endgroup$ Commented Nov 12, 2021 at 16:14

1 Answer 1

4
$\begingroup$

Method 1

Instead of using variables for the toys, use variables for the kids. This is the right idea since there is only way to satisfy the kids, $(7,7,7)$, while there are many ways to satisfy the toys.

Let $$ F_{\text{car}}(x,y,z)=\sum_{\substack{i,j,k \,\ge \,0,\\ i+j+k\,\le\, 10}} x^iy^jz^k $$ be the generating function which describes all ways to distribute the cars to the kids. Define $F_{\text{ball}}$ and $F_{\text{teddy}}$ similarly, where $10$ is replaced with $12$ and $14$. Then $$ \text{# ways}=[x^7y^7z^7](F_{\text{car}}\times F_{\text{ball}}\times F_{\text{teddy}}) $$

Method 2

Here is an equivalent version of your problem. You have $10+12+14=36$ identical tokens, and $12$ urns. The urns are laid out in a $4\times 3$ grid. Three of the rows correspond to children, while the last row is a slack row that represents the leftover toys no child receives. Each column corresponds to a toy. The equivalent problem is:

How many ways are there to distribute the $36$ identical tokens to these $12$ urns so that there are $7$ tokens total in each of the "child" rows, and $10$ (resp. $12,14$) tokens total in the "car" (resp. "ball," "teddy") columns?

Since there are now six target totals to keep track of, we need six variables. I will use $x,y,z$ for the children again, and $a,b,c$ for the teddy, ball, and car respectively. Since there are $12$ urns, we need twelve generating functions. The generating functions are summarized in the below table.

The final answer is the coefficient of $x^7y^7z^7a^{14}b^{12}c^{10}$ in the product of all twelve functions in this table.

Teddy $(a)$ Ball $(b)$ Car $(c)$
Child 1 $(x)$ $1/(1-ax)$ $1/(1-bx)$ $1/(1-cx)$
Child 2 $(y)$ $1/(1-ay)$ $1/(1-by)$ $1/(1-cy)$
Child 3 $(z)$ $1/(1-az)$ $1/(1-bz)$ $1/(1-cz)$
Unused $1/(1-a)$ $1/(1-b)$ $1/(1-c)$

For example, the generating function for urn for child $1$ and teddy is $$1/(1-ax)=1+ax+a^2x^2+a^3x^3+\dots$$ Choosing a monomial from this series is equivalent to choosing the number of tokens that go into the urn in the child $1$ row and teddy column. If you put $n$ tokens in that urn, it is equivalent to choosing $a^nx^n$, which contributes $n$ to the quota of $x^7$, and contributes $n$ to the quota of $a^{14}$.

Computation

As a sanity check, we should see if these methods agree. The following Mathematica code indeed confirms a common answer of $35{,}336$ for both methods. The second method is much faster; the first took $30$ seconds on my machine, the latter only half a second.

(* Method 1 *)

F[x_, y_, z_, n_] := Sum[x^i y^j z^k Boole[i + j + k <= n], 
                         {i, 0, n}, {j, 0, n}, {k, 0, n}]

Print[Coefficient[F[x, y, z, 10] * F[x, y, z, 12] * F[x, y, z, 14], x^7 y^7 z^7]]

(* Method 2 *)

Print[SeriesCoefficient[
  ((1 - a x) (1 - b x) (1 - c x)
   (1 - a y) (1 - b y) (1 - c y)
   (1 - a z) (1 - b z) (1 - c z)
   (1 - a)   (1 - b)   (1 - c)  )^{-1},
  {x, 0, 7}, {y, 0, 7}, {z, 0, 7}, {a, 0, 14}, {b, 0, 12}, {c, 0, 10}
]]
$\endgroup$
7
  • $\begingroup$ This answer reminded me why i like M.SE , bacause it allows to see what other people's mind work. Anyway , to be honest , i have not thought the question in this perspective.This is an elegant approach , but there is a little problem. When we apply it for example for $F_{car}$ , then there will be $C(10+4-1,3)=260$ ways.This is a hindrance in front of me. So do you have any suggestion for generalizing this generating function to find the coefficient of $x^7y^7z^7$ ? See next comment.. $\endgroup$ Commented Nov 11, 2021 at 6:22
  • $\begingroup$ I use wolfram , but it is too long for it.If there were two variable ,then i could say $$(\frac{x^{11}- y^{11}}{x-y})$$ , for the $F_{car}$ , but what about $3$ varible ? $\endgroup$ Commented Nov 11, 2021 at 6:22
  • $\begingroup$ B.T.W , if something new comes to your mind , please share it. +1 for this creative perpective , but as i said i need a method to get rid of tedious process $\endgroup$ Commented Nov 11, 2021 at 6:26
  • $\begingroup$ @Bulbasaur Seems plausible (but by no means certain) that you have conjured a (new) problem which has no readily available elegant method of attack. This is not that uncommon a situation, and explains (for example) why the LambertW function or the Stirlings Numbers (of one kind or another) were conjured. In fact, in a forest for the trees moment, it also explains why the functions $\sin(x), \cos(x),$ and $e^x$ were conjured. $\endgroup$ Commented Nov 11, 2021 at 12:37
  • 1
    $\begingroup$ @MikeEarnest Feel a pat on your back from me to you.This was very elegant approach. I hope you never hear the sound of rubbing paper on chalkboard in your whole life. $\endgroup$ Commented Nov 11, 2021 at 17:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .