3 Generating functions

3.1 Generating functions and their properties

Definition 3.1.1.

Let X be a nonnegative integer-valued rv with P(X=i)=pi, for i= 0, 1, 2, 3, …. Then the probability generating function (pgf) of X is

G(z)=p0+p1z+p2z2+=i=0pizi=E(zX).
Remark.

G(z) is well defined, i.e. is (absolutely) convergent for any numerical value of z in |z|1, because pi converges. It may, of course, converge in a larger region than this.

A simple but useful example is when X is a Bernoulli variable with

p0=P(X=0)=q and p1=P(X=1)=p

with X taking no other values. Then

G(z)=p0+p1z=q+pz

which is defined for all z.

Figure 3.1: Link, Caption: none provided

For real z in [0,1], G(z) is increasing from G(0)=p0 to G(1)=pi=1 provided X has a proper distribution. We shall also consider cases where X is not proper, so that G(1)<1. One example could be the hitting time of 0 in the gambler’s ruin problem.

Proposition 3.1.2 (Properties of pgfs).
  • (a)

    There is a unique correspondence (1:1) between a pmf {pi} and the corresponding pgf G(z). So if we know that X has a pgf G(z) which may be expanded:

    G(z)=p0+p1z+p2z2+p3z3+

    then X must have the pmf {p0, p1, p2, p3, }.

  • (b)

    The moments of a (proper) rv X can be derived from G(z):

    μ=E(X)=G(1)

    by which we mean ddzG(z) evaluated at z=1. Also

    E[X(X-1)]=E(X2)-E(X)=G′′(1).

    This gives E(X2)=G′′(1)+μ so that Var(X)=G′′(1)+μ-μ2.

  • (c)

    Distributions of sums of independent rvs can be found.

    Let X and Y be independent rvs with pmfs {pi} and {qj} respectively, and let S=X+Y have pmf {rk}. Then S has pgf

    GS(z)=GX(z)GY(z),

    the product NOT the sum of the pgf’s of X and Y.

Proof.

(a) is a result from mathematical analysis which is not proved here.

For example if X has pgf

G(z)=12-z=12+14z+18z2+

then X has pmf p0=1/2, p1=1/4, p2=1/8, ….

We shall solve some problems by finding an expression for G(z), and then obtaining the pmf by expanding G(z) as a power series. To do this we shall use some standard expansions. If necessary we use the formula for a Taylor (or Maclaurin) series about z=0.

Proof of (b) - first version. Differentiate G(z) term by term:

ddz(p0+p1z+p2z2+p3z3+)=p1+p2 2z+p3 3z2+

which on setting z=1 gives

p1+2p2+3p3+=i=0ipi=E(X).

Proof of (b) - second version. Differentiate inside the expectation:

ddzG(z)=ddzE(zX)=E(ddzzX)=E(XzX-1)

which on setting z=1 gives E(X). This is possible because expectation is linear, i.e. we can let h0 in

G(z+h)-G(z)h=E[(z+h)X]-E(zX)h=E[(z+h)X-zXh].

Example. Find the mean and variance of a random variable with pgf G(z)=1/(2-z).

G(z)=1/(2-z)2,

and so μ=E(X)=1. Further,

G′′(z)=2/(2-z)3,

so E[X(X-1)]=2 and Var(X)=2+μ-μ2=2.

Proof of (c).

GS(z)=E(zS)=E(zX+Y)=E(zXzY)=E(zX)E(zY)=GX(z)GY(z).

We are using here the fact that X and Y are independent, from which it follows that any function of X is independent of any function of Y. In particular here zX and zY are independent, and the expectation of the product of independent rvs is the product of their expectations. ∎

Corollary 3.1.3.

Let X1, X2, …, Xn be mutually independent rvs each with the same distribution and therefore the same pgf G(z). Then their sum

S=X1+X2++Xn

has pgf

GS(z)=G(z)n.

This follows from repeated application of the previous result.

Example. Let Xi be a Bernoulli process, so that G(z)=q+pz. Calculate the pgf of S=i=1nXi, and hence its distribution.

By 3.1.3:

GS(z)=G(z)n=(q+pz)n.

Now we can expand this (Binomial expansion) to get

GS(z)=i=0n(ni)piqn-izi.

Reading off the coefficient of zi, we see that S has a Binomial(n,p) distribution.