# Joint generating function

(This problem is from A First Course in Stochastic Processes by Karlin and Taylor.) Let ${X}$ and ${Y}$ be jointly distributed nonnegative integer-valued random variables. For ${|s|<1}$, ${|t|<1}$ define the joint generating function

$\displaystyle P_{X,Y}(s,t) = \sum_{i,j=0}^\infty \mathbb P(X=i,Y=j)s^it^j$

and the marginal generating functions

\displaystyle \begin{aligned} P_X(s)&=\sum_{i=0}^\infty \mathbb P(X=i)s^i\\ P_Y(t)&=\sum_{j=0}^\infty \mathbb P(Y=j)t^j. \end{aligned}

Theorem 1 ${X}$ and ${Y}$ are independent if and only if the joint generating function is equal to the product of the marginal generating functions.

Proof: For the “only if” implication, we have

\displaystyle \begin{aligned} P_{X,Y}(s,t) &= \sum_{i,j=0}^\infty \mathbb P(X=i,Y=j)s^it^j\\ &= \sum_{i,j=0}^\infty \mathbb P(X=i)\mathbb P(Y=j)s^it^j\\ &= \left(\sum_{i=0}^\infty \mathbb P(X=i)s^i \right)\left(\sum_{j=0}^\infty \mathbb P(Y=j)t^j \right)\\ &= P_X(s)P_Y(t). \end{aligned}

For the “if” implication, from

$\displaystyle \sum_{i,j=0}^\infty \mathbb P(X=i,Y=j)s^it^j = \sum_{i,j=0}^\infty \mathbb P(X=i)\mathbb P(Y=j)s^it^j$

for all ${s}$ and ${t}$ we see that ${\mathbb P(X=i,Y=j)=\mathbb P(X=i)\mathbb P(Y=j)}$ for all ${i}$ and ${j}$, and hence ${X}$ and ${Y}$ are independent. $\Box$

Theorem 2 Independence is sufficient, but not necessary for the generating function of ${X+Y}$ to be the product of the marginal generating functions of ${X}$ and ${Y}$.

Proof: Let ${X}$ and ${Y}$ each be uniformly distributed over ${\{0,1,2\}}$, with joint distribution

$\displaystyle \mathbb P(X=i,Y=j) = \begin{cases} \frac19,& (i,j)\in\{(0,0), (1,1), (2,2)\}\\ \frac29,& (i,j)\in\{(0,2), (1,0), (2,1)\}\\ 0,&\text{otherwise} \end{cases}$

Then

$\displaystyle \phi_X(s)\phi_Y(s)=\frac13(1+s+s^2)\frac13(1+s+s^2) = \frac1{9}(1+s+s^2)^2$

and

\displaystyle \begin{aligned} \phi_{X,Y}(s,s) &= \frac19 + \frac29 s + \frac39 s^2 + \frac29 s^3 +\frac19 s^4\\ &= \frac19(1 + 2s + 3s^2 + 2s^3 + s^4)\\ &= \frac19(1+s+s^2)^2\\ &= \phi_X(s)\phi_Y(s). \end{aligned}

But ${X}$ and ${Y}$ are not independent, as for example

$\displaystyle \mathbb P(X=0)\mathbb P(Y=1)=\frac19\ne0=\mathbb P(X=0,Y=1).$

$\Box$