# Probability-generating function

﻿
Probability-generating function

In probability theory, the probability-generating function of a discrete random variable is a power series representation (the generating function) of the probability mass function of the random variable. Probability-generating functions are often employed for their succinct description of the sequence of probabilities Pr("X" = "i"), and to make available the well-developed theory of power series with non-negative coefficients.

Definition

If "N" is a discrete random variable taking values on some subset of the non-negative integers, {"0,1, ..."}, then the "probability-generating function" of "N" is defined as::$G\left(x\right) = extrm\left\{E\right\}\left(x^N\right) = sum_\left\{n=0\right\}^\left\{infty\right\}f_N\left(n\right)x^n,$where "fN" is the probability mass function of "N". Note that the equivalent notation "G""N" is sometimes used to distinguish between the probability-generating functions of several random variables.

Properties

Power series

Probability-generating functions obey all the rules of power series with non-negative coefficients. In particular, "G"(1) = 1, since the probabilities must sum to one, and where "G"(1) = limz&rarr;1"G"("z") from below. So the radius of convergence of any probability-generating function must be at least 1, by Abel's theorem for power series with non-negative coefficients.

Probabilities and expectations

The following properties allow the derivation of various basic quantities related to "X":

1. The probability mass function of "X" is recovered by taking derivatives of "G"

:$quad f\left(k\right) = extrm\left\{Pr\right\}\left(X = k\right) = frac\left\{G^\left\{\left(k\right)\right\}\left(0\right)\right\}\left\{k!\right\}.$

2. It follows from Property 1 that if we have two random variables "X" and "Y", and "G""X" = "G""Y", then "f""X" = "f""Y". That is, if "X" and "Y" have identical probability-generating functions, then they are identically distributed.

3. The normalization of the probability density function can be expressed in terms of the generating function by

:$E\left(1\right)=G\left(1^-\right)=sum_\left\{i=0\right\}^infty f\left(i\right)=1.$

The expectation of "X" is given by

:$extrm\left\{E\right\}left\left(X ight\right) = G\text{'}\left(1^-\right).$

More generally, the "k"th factorial moment, E("X"("X" − 1) ... ("X "− "k" + 1)), of "X" is given by

:$extrm\left\{E\right\}left\left(frac\left\{X!\right\}\left\{\left(X-k\right)!\right\} ight\right) = G^\left\{\left(k\right)\right\}\left(1^-\right), quad k geq 0.$

So the variance of "X" is given by

:$extrm\left\{Var\right\}\left(X\right)=G"\left(1^-\right) + G\text{'}\left(1^-\right) - left \left[G\text{'}\left(1^-\right) ight \right] ^2.$

4."G""X"($e^\left\{t\right\}$) = "M""X"(t) where "X" is a random variable, G(t) is the probability generating function and M(t) is the moment-generating function.

Functions of independent random variables

Probability-generating functions are particularly useful for dealing with functions of independent random variables. For example:

* If "X"1, "X"2, ..., "X"n is a sequence of independent (and not necessarily identically distributed) random variables, and

::$S_n = sum_\left\{i=1\right\}^n a_i X_i,$

:where the "a"i are constants, then the probability-generating function is given by

::$G_\left\{S_n\right\}\left(z\right) = E\left(z^\left\{S_n\right\}\right) = E\left(z^\left\{sum_\left\{i=1\right\}^n a_i X_i,\right\}\right) = G_\left\{X_1\right\}\left(z^\left\{a_1\right\}\right)G_\left\{X_2\right\}\left(z^\left\{a_2\right\}\right)cdots G_\left\{X_n\right\}\left(z^\left\{a_n\right\}\right).$

:For example, if

::$S_n = sum_\left\{i=1\right\}^n X_i,$

:then the probability-generating function, "G""Sn"("z"), is given by

::$G_\left\{S_n\right\}\left(z\right) = G_\left\{X_1\right\}\left(z\right)G_\left\{X_2\right\}\left(z\right)cdots G_\left\{X_n\right\}\left(z\right).$

:It also follows that the probability-generating function of the difference of two independent random variables "S" = "X"1 − "X"2 is

::$G_S\left(z\right) = G_\left\{X_1\right\}\left(z\right)G_\left\{X_2\right\}\left(1/z\right).$

*Suppose that "N" is also an independent, discrete random variable taking values on the non-negative integers, with probability-generating function "G""N". If the "X"1, "X"2, ..., "X"N are independent "and" identically distributed with common probability-generating function "G"X, then

::$G_\left\{S_N\right\}\left(z\right) = G_N\left(G_X\left(z\right)\right).$

:This can be seen as follows:

::

:This last fact is useful in the study of Galton&ndash;Watson processes.

:Suppose again that "N" is also an independent, discrete random variable taking values on the non-negative integers, with probability-generating function "G""N". If the "X"1, "X"2, ..., "X"N are independent, but "not" identically distributed random variables, where $G_\left\{X_i\right\}$ denotes the probability generating function of $X_i$, then it holds

::$G_\left\{S_N\right\}\left(z\right) = sum_\left\{i ge 1\right\} f_i prod_\left\{k=1\right\}^i G_\left\{X_i\right\}\left(z\right).$

:For identically distributed "Xi" this simplifies to the identity stated before. The general case is sometimes useful to obtain a decomposition of "SN" by means of generating functions.

Examples

* The probability-generating function of a constant random variable, i.e. one with Pr("X" = "c") = 1, is

::$G\left(z\right) = left\left(z^c ight\right).$

* The probability-generating function of a binomial random variable, the number of successes in "n" trials, with probability "p" of success in each trial, is

::$G\left(z\right) = left \left[\left(1-p\right) + pz ight\right] ^n.$

:Note that this is the "n"-fold product of the probability-generating function of a Bernoulli random variable with parameter "p".

* The probability-generating function of a negative binomial random variable, the number of trials required to obtain the "r"th success with probability of success in each trial "p", is

::$G\left(z\right) = left\left(frac\left\{p\right\}\left\{1 - \left(1-p\right)z\right\} ight\right)^r.$

:Note that this is the "r"-fold product of the probability generating function of a geometric random variable.

* The probability-generating function of a Poisson random variable with rate parameter &lambda; is

::$G\left(z\right) = extrm\left\{e\right\}^\left\{lambda\left(z - 1\right)\right\}.;,$

Example calculation: use of bivariate generating functions

The following example illustrates a very common technique the manipulation of PGFs: the use of bivariate super generating functions to compute the ordinary generating function (OGF) of the PGFs of a sequence of random variables.

Suppose you sample a system that can assume two states, "X" and "Y", "X" with probability "p" and "Y" with probability 1 − "p", e.g. a coin being flipped, obtaining the sequence of samples:$S_1, , S_2, , S_3, ,ldots ,S_n,$where the system was sampled "n" times and has no memory.

Define the random variable $M_n$ to be the number of changes from one sample to the next in a sequence of "n" samples, i.e. how often $S_m$ was different from $S_\left\{m-1\right\}$. For example, the sequence:$X ,X ,X ,Y ,X ,X$has two changes, as does:$Y ,X ,X ,X ,X ,X ,Y ,Y ,Y ,Y.$We want to calculate the PGF of $M_n$, which we will do by using bivariate generating functions.

We introduce the bivariate GF $G\left(z, u\right)$ given by:$G\left(z, u\right) = sum_\left\{nge 1\right\} Eleft \left[u^\left\{M_n\right\} ight\right] z^n,$i.e. $G\left(z, u\right)$ is the ordinary generating function of the PGFs of the $M_n.$This step is completely general and indeed the core of the method.

Now let $x_\left\{n, k\right\}$ be the probability of having "k" changes in a sequence of "n" samples, where the last sample was an "X". Similarly, let $y_\left\{n, k\right\}$ be the probability of having "k" changes in a sequence of "n" samples, where the last sample was a "Y", and put:$X\left(z, u\right) = sum_\left\{nge 1, kge 0\right\} x_\left\{n, k\right\} , u^k z^nquad mbox\left\{and\right\} quad Y\left(z, u\right) = sum_\left\{nge 1, kge 0\right\} y_\left\{n, k\right\} , u^k z^n$so that:$G\left(z, u\right) = X\left(z, u\right) + Y\left(z, u\right).,$

Now we clearly have:$x_\left\{n, 0\right\} = p^n quad mbox\left\{and\right\} quad y_\left\{n, 0\right\} = \left(1-p\right)^n,$because having zero changes means getting a sequence of all "Xs" or "Ys."

For $kge 1$ we find:$x_\left\{n, k\right\} = p , y_\left\{n-1, k-1\right\} + p , x_\left\{n-1, k\right\}quad mbox\left\{and\right\} quad y_\left\{n, k\right\} = \left(1-p\right) , x_\left\{n-1, k-1\right\} + \left(1-p\right) , y_\left\{n-1, k\right\},$because e.g. to have "k" changes in a sequence of length "n" that ends in "X", we either append an "X" to a sequence having "k" − 1 changes and ending in "Y", or append an "X" to a sequence having "k" changes and ending in "X".

Summing these equations over "n" and "k" and writing "X" for "X(z, u)" and "Y" for "Y(z, u)", we obtain:$X - frac\left\{p z\right\}\left\{1 - p z\right\} =p u z Y + p z left\left( X - frac\left\{p z\right\}\left\{1 - p z\right\} ight\right)$and:$Y - frac\left\{\left(1-p\right) z\right\}\left\{1 - \left(1-p\right) z\right\} =\left(1-p\right) u z X + \left(1-p\right) z left\left( Y - frac\left\{\left(1-p\right) z\right\}\left\{1 - \left(1-p\right) z\right\} ight\right).$The solution of this system is:$X =-\left\{frac \left\{ left\left( -pz+puz+z-uz-1 ight\right) pz\right\}\left\{-z+1+p\left\{z\right\}^\left\{2\right\}-\left\{p\right\}^\left\{2\right\}\left\{z\right\}^\left\{2\right\}-\left\{u\right\}^\left\{2\right\}\left\{z\right\}^\left\{2\right\}p+\left\{p\right\}^\left\{2\right\}\left\{u\right\}^\left\{2\right\}\left\{z\right\}^\left\{2\right\}$and:$Y =-\left\{frac \left\{z left\left( -puz-1+p+pz-\left\{p\right\}^\left\{2\right\}z+\left\{p\right\}^\left\{2\right\}uz ight\right) \right\}\left\{-z+1+p\left\{z\right\}^\left\{2\right\}-\left\{p\right\}^\left\{2\right\}\left\{z\right\}^\left\{2\right\}-\left\{u\right\}^\left\{2\right\}\left\{z\right\}^\left\{2\right\}p+\left\{p\right\}^\left\{2\right\}\left\{u\right\}^\left\{2\right\}\left\{z\right\}^\left\{2\right\}.$

We may now use the general identity:$sum_\left\{nge 1\right\} Eleft \left[M_n \left(M_n-1\right) ldots \left(M_n-r\right) ight\right] z^n =left\left( left\left(frac\left\{d\right\}\left\{du\right\} ight\right)^\left\{r+1\right\} G\left(z, u\right) ight\right)_\left\{u=1\right\}$to calculate the factorial moments of $M_n.$ E.g. the OGF of the expectations is given by:$sum_\left\{nge 1\right\} E \left[M_n\right] z^n =left\left( frac\left\{d\right\}\left\{du\right\} \left(X + Y\right) ight\right)_\left\{u=1\right\} =-2,\left\{frac \left\{ left\left( -1+p ight\right) \left\{z\right\}^\left\{2\right\}p\right\}\left\{ left\left( -1+z ight\right) ^\left\{2\right\},$from which we find (extracting coefficients) that:$E \left[M_n\right] = 2 , p \left(1-p\right) ,\left(n-1\right).$

An extensive discussion of this problem, as well as solutions by other methods,may be found on "Les-Mathematiques.net" (external links).

Example calculation: bivariate generating functions and differential equations

Consider the following balls and urns problem: suppose we have an urn containing "n" distinguishable balls, i.e. bearing labels from "1" to "n". We pick one of the balls at random and remove it from the urn. We also remove all balls whose labels are larger than the one we picked from the urn. E.g. if we picked ball number one, the urn is emptied after one operation. We repeat until the urn is empty. E.g. for an urn containing ten balls, the sequence of picks 6-3-1 would empty the urn in three operations. We introduce the random variable $X_n$, which gives the number of picks needed to empty the urn. Our goal is to compute all of its moments, and we will do so using exactly the same bivariate generating function as in the previous example, namely the OGF of the PGFs::$P\left(z, u\right) = sum_\left\{nge 1\right\} Eleft \left[u^\left\{X_n\right\} ight\right] z^n.$

We let $p_\left\{n, k\right\}$ be the probability of emptying an urn containing "n" balls with "k" operations, so that:$P\left(z, u\right) = sum_\left\{nge 1, kge 1\right\} p_\left\{n, k\right\} u^k z^n.$We find that:$p_\left\{n, 1\right\} = frac\left\{1\right\}\left\{n\right\}quad mbox\left\{and\right\} quad p_\left\{n, k\right\} = frac\left\{1\right\}\left\{n\right\} sum_\left\{r=1\right\}^\left\{n-\left(k-1\right)\right\} p_\left\{n-r, k-1\right\}, quad kge 2$because to empty the urn with one operation, we must pick the ball labelled "1". The remaining probabilities are computed recursively, e.g. we pick the ball with the largest label with probability $1/n$, leaving $n-1$ balls (this is $r=1$). We pick the ball with the next-to-largest label with probability $1/n$, leaving $n-2$ balls (this is $r=2$), etc. The upper bound for "r" is $n-\left(k-1\right)$, because we must have $n-rge k-1$ (we cannot e.g. empty an urn containing six balls using seven operations).

Next we set $p_\left\{n, k\right\} = 0$ for

Summing over $kge 1$ (there are two contributions to both sides of the equation, one for $kge 2$ and another one for $k=1$), we obtain:$frac\left\{d\right\}\left\{dz\right\} P\left(z, u\right) = frac\left\{u\right\}\left\{1-z\right\} + frac\left\{u\right\}\left\{1-z\right\} P\left(z, u\right),$e.g. through:$sum_\left\{nge 1\right\} z^\left\{n-1\right\} u \left[z^\left\{n-1\right\} u\right] frac\left\{d\right\}\left\{dz\right\} P\left(z, u\right) =sum_\left\{nge 1\right\} z^\left\{n-1\right\} u = frac\left\{u\right\}\left\{1-z\right\}.$The solution to the differential equation is:$P\left(z, u\right) = -1 + C\left(u\right) left\left( frac\left\{1\right\}\left\{1-z\right\} ight\right)^u$,with $C\left(u\right)$ a formal power series in "u". We note:$\left[z^0\right] P\left(z, u\right) = 0 = -1 + C\left(u\right),$which follows from the formal series:$left\left( frac\left\{1\right\}\left\{1-z\right\} ight\right)^u = sum_\left\{kge 0\right\} frac\left\{u^k\right\}\left\{k!\right\} left\left( log frac\left\{1\right\}\left\{1-z\right\} ight\right)^k.$Hence $C\left(u\right)$ is constant and equal to one, and we finally have:$P\left(z, u\right) = -1 + left\left( frac\left\{1\right\}\left\{1-z\right\} ight\right)^u,$which is, incidentally, the generating function of the Stirling numbers of the first kind.

The moments now follow trivially from the formula given in the first example. E.g. for the expectation, we find:$sum_\left\{nge 1\right\} E \left[X_n\right] z^n =left. frac\left\{d\right\}\left\{du\right\} P\left(z, u\right) ight|_\left\{u=1\right\} =left. left\left( frac\left\{1\right\}\left\{1-z\right\} ight\right)^u log frac\left\{1\right\}\left\{1-z\right\} ight|_\left\{u=1\right\} =frac\left\{1\right\}\left\{1-z\right\} log frac\left\{1\right\}\left\{1-z\right\}$which gives:$E \left[X_n\right] = \left[z^n\right] frac\left\{1\right\}\left\{1-z\right\} log frac\left\{1\right\}\left\{1-z\right\} = H_n,$the "n"th harmonic number, and we need about $log n,$ operations to empty the urn.

An extensive discussion of this problem, as well as solutions by other methods,may be found on "Les-Mathematiques.net" (external links).

Related concepts

The probability-generating function is occasionally called the z-transform of the probability mass function. It is an example of a generating function of a sequence (see formal power series).

Other generating functions of random variables include the moment-generating function and the characteristic function.

* [http://les-mathematiques.u-strasbg.fr/phorum/read.php?f=2&i=339442&t=339442 Riedel, Marko, et al. Espérance, in French.]
* [http://les-mathematiques.u-strasbg.fr/phorum5/read.php?12,349295,349295#msg-349295 Riedel, Marko, et al. Variables aléatoires, in French.]

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• Probability density function — Boxplot and probability density function of a normal distribution N(0, σ2). In probability theory, a probability density function (pdf), or density of a continuous random variable is a function that describes the relative likelihood for this… …   Wikipedia

• Generating function — This article is about generating functions in mathematics. For generating functions in classical mechanics, see Generating function (physics). For signalling molecule, see Epidermal growth factor. In mathematics, a generating function is a formal …   Wikipedia

• Moment-generating function — In probability theory and statistics, the moment generating function of any random variable is an alternative definition of its probability distribution. Thus, it provides the basis of an alternative route to analytical results compared with… …   Wikipedia

• Factorial moment generating function — In probability theory and statistics, the factorial moment generating function of the probability distribution of a real valued random variable X is defined as:M X(t)=operatorname{E}igl [t^{X}igr] for all complex numbers t for which this… …   Wikipedia

• Coupon collector's problem (generating function approach) — The coupon collector s problem can be solved in several different ways. The generating function approach is a combinatorial technique that allows to obtain precise results. We introduce the probability generating function (PGF) G(z) where… …   Wikipedia

• Probability distribution — This article is about probability distribution. For generalized functions in mathematical analysis, see Distribution (mathematics). For other uses, see Distribution (disambiguation). In probability theory, a probability mass, probability density …   Wikipedia

• Probability plot — The probability plot is a graphical technique for assessing whether or not a data set follows a given distribution such as the normal or Weibull, and for visually estimating the location and scale parameters of the chosen distribution. The data… …   Wikipedia

• Characteristic function (probability theory) — The characteristic function of a uniform U(–1,1) random variable. This function is real valued because it corresponds to a random variable that is symmetric around the origin; however in general case characteristic functions may be complex valued …   Wikipedia

• Cumulative distribution function — for the normal distributions in the image below …   Wikipedia

• List of probability topics — This is a list of probability topics, by Wikipedia page. It overlaps with the (alphabetical) list of statistical topics. There are also the list of probabilists and list of statisticians.General aspects*Probability *Randomness, Pseudorandomness,… …   Wikipedia