# Exercise considering generating functions

A drawer contains $9$ beads: four red beads, three blue beads and two green beads. In how many ways can we select five beads from the drawer with at least $2$ red, at least $1$ green, and an odd number of blue (beads of same color are identical)?

I know how to get $G(x)$ but don't know how to find the coefficient $x^5$. Any help would be great. Like where do I get for here?

$x_1$: choose red
$x_2$: choose blue
$x_3$: choose green

$G(x_1, x_2, x_3) = (x_1^2 + x_1^3 + x_1^4)(x_2^1 + x_2^2)(x_3^1 + x_3^3)$

Once you collapse the three indeterminates $x_1,x_2$, and $x_3$ to a single indeterminate $x$, you have

$$G(x)=(x^2+x^3+x^4)(x+x^2)(x+x^3)\;,$$

and you want the coefficient of $x^5$. Pull out as many factors of $x$ as possible:

$$G(x)=x^4(1+x+x^2)(1+x)(1+x^2)\;.$$

You can now see that the coefficient of $x^5$ in $G(x)$ is the same as the coefficient of $x$ in

$$(1+x+x^2)(1+x)(1+x^2)\;,$$

which is very easy to calculate.