1. ## Generating functions

A jar of 50 quarters and 20 loonies is to be divided amongst Alex, Kim, and Julie. How many
ways can this be done if Alex gets no quarters, Kim gets no loonies but at least 10 quarters,
and Julie gets an odd number of loonies? (Use generating functions to solve the problem)

2. Originally Posted by sbankica
A jar of 50 quarters and 20 loonies is to be divided amongst Alex, Kim, and Julie. How many
ways can this be done if Alex gets no quarters, Kim gets no loonies but at least 10 quarters,
and Julie gets an odd number of loonies? (Use generating functions to solve the problem)
Let's say the number of ways to get m quarters and n loonies is $\displaystyle a_{mn}$. We want to find the 2-variable ordinary power series generating function (OPSGF) $\displaystyle f(x,y)=\sum_m \sum_n a_{mn} x^m y^n$.

The OPSGF for Alex's coins is
$\displaystyle A = 1 + y + y^2 + \dots = (1-y)^{-1}$

For Kim's coins,
$\displaystyle K = x^{10} + x^{11} + x^{12} + \dots = x^{10} \; (1-x)^{-1}$

For Julie's coins,
$\displaystyle J = (1 + x + x^2 + \dots) \; (y + y^3 + y^5 + \dots) = (1-x)^{-1} \; y \; (1-y^2)^{-1}$

So
$\displaystyle f(x,y) = A \cdot K \cdot J = x^{10} \; y \; (1-x)^{-2} \; (1-y)^{-1} \; (1-y^2)^{-1}$

In a sense we are done, but maybe we should go ahead and find the answer to the original problem, which is the coefficient of $\displaystyle x^{50} y^{20}$ in f. We can factor f as
$\displaystyle f(x,y) = g(x) \; h(y)$, where
$\displaystyle g(x) = x^{10} \; (1-x)^{-2}$ and
$\displaystyle h(y) = y \; (1-y)^{-1} \; (1-y^2)^{-1}$.

$\displaystyle g(x) = x^{10} \; \sum_i (-1)^i \binom{-2}{i} x^i$
so $\displaystyle g[x^{50}] = (-1)^{40} \binom{-2}{40} = \binom{2+40-1}{40} = \binom{41}{40} = 41$

Next we need to find $\displaystyle h[y^{20}]$, but it will simplify things if we first apply partial fractions to h:
$\displaystyle h(y) = y \cdot [(1/2) (1-y)^{-2} + (1/4) (1-y)^{-1} + (1/4) (1+y)^{-1}]$
$\displaystyle = y \cdot \left( (1/2) \sum_i (-1)^i \binom{-2}{i} y^i + (1/4) \sum_i y^i + (1/4) \sum_i (-1)^i y^i \right)$
so
$\displaystyle h[y^{20}] = (1/2) (-1)^{19} \binom{-2}{19} + (1/4) + (1/4) (-1)^{19}$
$\displaystyle = (1/2) \binom{2+19-1}{19} = (1/2) \binom{20}{19} = 10$

So the number of ways to get 50 quarters and 20 loonies is
$\displaystyle g[x^{50}] \cdot h[y^{20}] = 41 \cdot 10$