Okay, so in the last post I used generating functions to compute the expected number of coin flips to get consecutive heads – and the computation was very ugly. In fact there are much easier ways to solve that problem. So here is an example of where generating functions make life easier: Let and , with independent of the . Define . What is the distribution of ?

The direct computation proceeds as follows:

so that . However, if we observe that the generating functions of and are and , respectively, then the generating function of is

which is the generating function of a random variable. Wasn’t that much easier?