Use generating function to find the number of ways to distribute $r$ beans among $8$ children if each child gets an even number of beans.
So I know this is like a weak composition where some children can receive $0$ objects. But I don't know how to account for the even requirement. My guess for the generating function is $$ (1 + x^2 + x^4 + \ldots + x^{r-2} + x^r)^8. $$ But even still, I'm not sure how to determine the possible number of ways to distribute.
Best Answer
You’re doing fine so far; you just haven’t gone far enough. First, while it’s true that you’re not interested in any of the terms $z^n$ with $n>r$, it’s easier to include them and look at $\left(\sum_{k\ge 0}z^{2k}\right)^8$, because then you can replace the infinite series by a simple generating function to get
$$\frac1{\left(1-z^2\right)^8}\;,$$
from which you want the coefficient of $z^r$. Note that this does no harm: the extra terms in the infinite series cannot contribute to the $z^r$ term anyway.
A useful generating function to know is
$$\frac1{(1-z)^{n+1}}=\sum_{k\ge 0}\binom{n+k}kz^k=\sum_{k\ge 0}\binom{n+k}nz^k\;.$$
Substitute $z^2$ for $z$ and take $n=7$, and you get
$$\frac1{\left(1-z^2\right)^8}=\sum_{k\ge 0}\binom{k+7}7z^{2k}\;.$$
In particular, the coefficient of $z^r$ is clearly $0$ if $r$ is odd, and if $r$ is even it’s $\dbinom{7+\frac{r}2}7$.