Discrete mathematics generating function grabbing balloons restricted. Say we have 3 different kind of balloons: blue, red and black. If we want to grab k balloons with the restriction that the number of red balloons is al least twice the number of blue balloons. How can i represent this in a generating function? The order does not matter
 A: Temporarily introduce three variables, $x,y$, and $z$; we’ll use the exponent on $x$ to represent the number of black balloons, the exponent on $y$ to represent the number of blue balloons plus the minimum number of red balloons required to accompany them, and the exponent on $z$ to represent the number of red balloons over and above that minimum. The exponent on $y$ is necessarily a multiple of $3$, since each blue balloon must be accompanied by a minimum of $2$ red balloons. A term $x^py^{3q}z^r$ then represents a selection of $p$ black balloons, $q$ blue balloons, and $2q+r$ red balloons; the total number of balloons represented is $p+3q+r$, the sum of the exponents.
Thus, the terms of the product
$$\left(\sum_{p\ge 0}x^p\right)\left(\sum_{q\ge 0}y^{3q}\right)\left(\sum_{r\ge 0}z^r\right)\tag{1}$$
represent the possible selections of balloons, and we’re interested in the number of terms $x^py^{3q}z^r$ for which $p+3q+r=k$. If we replace $y$ and $z$ by $x$ in $(1)$, ghat’s just the coefficient of $x^k$, so the desired generating function is
$$\left(\sum_{p\ge 0}x^p\right)\left(\sum_{q\ge 0}x^{3q}\right)\left(\sum_{r\ge 0}x^r\right)\;;\tag{2}$$
I’ll leave to you the pretty straightforward task of finding a closed form for $(2)$.
