# Finding generating functions for modeling the ways to distribute k different kinds of objects among n containers

The problem I am dealing with first asks us to find the generating function $g(x,y,x)$ whose coefficient of $x^s$$y^s$$z^t$ is the number of ways to distribute $r$ red balls, $s$ blue balls and $t$ green balls to n people with between three and six balls of each type to each person.

My answer to this part was:

$g(x)=((x^3+x^4+x^5+x^6)(y^3+y^4+y^5+y^6)(z^3+z^4+z^5+z^6))^n$

I broke it down to an individual case where each factor corresponds to the number of red, blue, and green balls selected by an individual. And since there are n individuals we repeat the process n times.

For the next problem we are supposed to include an additional condition: We suppose each person gets at least as many red balls as blues. Assuming $x$ corresponds to red, $y$ to blue and $z$ to green, I initially came up with the following generating function:

$g(x)=((x^3)(y^3+xy^4+x^2y^5+x^3y^6)(z^3+z^4+z^5+z^6))^n$

But how would account for selections of say 5 red balls and 3 blue balls. I was thinking about just including all the terms up to $x^6$ in the first factor but then that allows for the possibility of choosing more than 6 red balls.

Is there a standard technique to deal with these types of problems?

Also, how would we deal with an additional condition like supposing no person gets the same amount of green and red balls?

## 1 Answer

Well for your first question you could just consider what are the possibilities of (red,blue) balls, which are:

• (3,3)
• (4,{3,4})
• (5,{3,4,5})
• (6,{3,4,5,6})

That gives:

$x^3 y^3 ( 1 ( 1 ) + x ( 1 + y ) + x^2 ( 1 + y + y^2 ) + x^3 ( 1 + y + y^2 + y^3 ) )$

= $x^3 y^3 \frac{1}{1-y} ( (1-y) + x (1-y^2) + x^2 (1-y^3) + x^3 (1-y^4) )$

For the second question, you can exclude that case by subtracting it off:

$x^3 y^3 z^3 \frac{1}{1-y} ( (1-y) + x (1-y^2) + x^2 (1-y^3) + x^3 (1-y^4) ) \frac{1-z^4}{1-z} - x^3 y^3 z^3 \frac{1}{1-y} ( (1-y) + x z (1-y^2) + x^2 z^2 (1-y^3) + x^3 z^3 (1-y^4) )$

• That's what I got after staring at it for a while. Thanks! – Marco Jan 24 '14 at 3:57
• You're welcome! – user21820 Jan 24 '14 at 3:58