Number of distributions of balls in boxes

66 Views Asked by At

I have been thinking for this problem and I found it harder than I expected:

Find de number of distributions of 1000 red balls, 1000 yellow balls and 1000 blue balls in 3 boxes with every box having 1000 balls.

Note: (Balls of the same colour are undistinguishable and boxes are distinguishable)

I would be grateful if someone could help me.

1

There are 1 best solutions below

11
On

I think the best way is to use generating functions such that

Red Ball $(a)$ Yellow Ball $(b)$ Blue Ball $(c)$
Box $1$ $(x)$ $1/(1-ax)$ $1/(1-bx)$ $1/(1-cx)$
Box $2$ $(y)$ $1/(1-ay)$ $1/(1-by)$ $1/(1-cy)$
Box $3$ $(z)$ $1/(1-az)$ $1/(1-bz)$ $1/(1-cz)$

Now, we should find the coefficient of $a^{1000}b^{1000}c^{1000}x^{1000}y^{1000}y^{1000}$ in the expansion of these $9$ generating functions..

As you remember your calculus class , $$\frac{1}{(1-ax)}=1+ax+a^2x^2+a^3x^3+..$$ When we find the product of these generating functions , their coefficient gives the number of all possible ways to construct the desired product,in our question it is $a^{1000}b^{1000}c^{1000}x^{1000}y^{1000}y^{1000}$

$\mathbf{\text{Pseudocode for solution:}}$

Step $1-)$ Write a code that turn the infinite serie such as $1/(1-ax)$ into a infinite polynomial such as $1+ax+a^2x^2+a^3x^3+..$ .Btw , you can also restrict your polynomial $1+ax+a^2x^2+a^3x^3+....+a^{1000}x^{1000}$ , because the number of balls and the capacity of boxes are up to $1000$.

Step $2-)$ Find the product of these nine polynomials , and write a code to pick the coefficient of $a^{1000}b^{1000}c^{1000}x^{1000}y^{1000}y^{1000}$ in this product.

Here is the mathematica code for solution , but because of my free trial time is over for mathematica , so i could not write the answer.However ,if you have mathematica in your computer this code will give you the exact answer:

  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},
  {x, 0, 1000}, {y, 0, 1000}, {z, 0, 1000}, {a, 0, 1000}, {b, 0, 1000}, 
{c, 0, 1000}
]]