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) in the probability mass function for a random variable X, and to make available the well-developed theory of power series with non-negative coefficients.

## Definition

### Univariate case

If X is a discrete random variable taking values in the non-negative integers {0,1, ...}, then the probability generating function of X is defined as [1]

${\displaystyle G(z)=\operatorname {E} (z^{X})=\sum _{x=0}^{\infty }p(x)z^{x},}$

where p is the probability mass function of X. Note that the subscripted notations GX and pX are often used to emphasize that these pertain to a particular random variable X, and to its distribution. The power series converges absolutely at least for all complex numbers z with |z| ≤ 1; in many examples the radius of convergence is larger.

### Multivariate case

If X = (X1,...,Xd) is a discrete random variable taking values in the d-dimensional non-negative integer lattice {0,1, ...}d, then the probability generating function of X is defined as

${\displaystyle G(z)=G(z_{1},\ldots ,z_{d})=\operatorname {E} {\bigl (}z_{1}^{X_{1))\cdots z_{d}^{X_{d)){\bigr )}=\sum _{x_{1},\ldots ,x_{d}=0}^{\infty }p(x_{1},\ldots ,x_{d})z_{1}^{x_{1))\cdots z_{d}^{x_{d)),}$

where p is the probability mass function of X. The power series converges absolutely at least for all complex vectors ${\displaystyle z=(z_{1},...z_{d})\in \mathbb {C} ^{d))$ with ${\displaystyle {\text{max))\{|z_{1}|,...,|z_{d}|\}\leq 1.}$

## Properties

### Power series

Probability generating functions obey all the rules of power series with non-negative coefficients. In particular, G(1) = 1, where G(1) = limz→1G(z) from below, since the probabilities must sum to one. 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,
${\displaystyle p(k)=\operatorname {Pr} (X=k)={\frac {G^{(k)}(0)}{k!)).}$
2. It follows from Property 1 that if random variables X and Y have probability-generating functions that are equal, ${\displaystyle G_{X}=G_{Y))$, then ${\displaystyle p_{X}=p_{Y))$. That is, if X and Y have identical probability-generating functions, then they have identical distributions.
3. The normalization of the probability mass function can be expressed in terms of the generating function by
${\displaystyle \operatorname {E} [1]=G(1^{-})=\sum _{i=0}^{\infty }p(i)=1.}$
The expectation of ${\displaystyle X}$ is given by
${\displaystyle \operatorname {E} [X]=G'(1^{-}).}$
More generally, the kth factorial moment, ${\displaystyle \operatorname {E} (X(X-1)\cdots (X-k+1))}$ of X is given by
${\displaystyle \operatorname {E} \left[{\frac {X!}{(X-k)!))\right]=G^{(k)}(1^{-}),\quad k\geq 0.}$
So the variance of X is given by
${\displaystyle \operatorname {Var} (X)=G''(1^{-})+G'(1^{-})-\left[G'(1^{-})\right]^{2}.}$
Finally, the kth raw moment of X is given by
${\displaystyle \operatorname {E} [X^{k}]=\left(z{\frac {\partial }{\partial z))\right)^{k}G(z){\Big |}_{z=1^{-))}$
4. ${\displaystyle G_{X}(e^{t})=M_{X}(t)}$ where X is a random variable, ${\displaystyle G_{X}(t)}$ is the probability generating function (of X) and ${\displaystyle M_{X}(t)}$ is the moment-generating function (of X) .

### Functions of independent random variables

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

• If X1, X2, ..., XN is a sequence of independent (and not necessarily identically distributed) random variables that take on natural-number values, and
${\displaystyle S_{N}=\sum _{i=1}^{N}a_{i}X_{i},}$
where the ai are constant natural numbers, then the probability generating function is given by
${\displaystyle G_{S_{N))(z)=\operatorname {E} (z^{S_{N)))=\operatorname {E} \left(z^{\sum _{i=1}^{N}a_{i}X_{i},}\right)=G_{X_{1))(z^{a_{1)))G_{X_{2))(z^{a_{2)))\cdots G_{X_{N))(z^{a_{N))).}$
For example, if
${\displaystyle S_{N}=\sum _{i=1}^{N}X_{i},}$
then the probability generating function, GSN(z), is given by
${\displaystyle G_{S_{N))(z)=G_{X_{1))(z)G_{X_{2))(z)\cdots G_{X_{N))(z).}$
It also follows that the probability generating function of the difference of two independent random variables S = X1X2 is
${\displaystyle G_{S}(z)=G_{X_{1))(z)G_{X_{2))(1/z).}$
• Suppose that N, the number of independent random variables in the sum above, is not a fixed natural number but is also an independent, discrete random variable taking values on the non-negative integers, with probability generating function GN. If the X1, X2, ..., XN are independent and identically distributed with common probability generating function GX, then
${\displaystyle G_{S_{N))(z)=G_{N}(G_{X}(z)).}$
This can be seen, using the law of total expectation, as follows:
{\displaystyle {\begin{aligned}G_{S_{N))(z)&=\operatorname {E} (z^{S_{N)))=\operatorname {E} (z^{\sum _{i=1}^{N}X_{i)))\\[4pt]&=\operatorname {E} {\big (}\operatorname {E} (z^{\sum _{i=1}^{N}X_{i))\mid N){\big )}=\operatorname {E} {\big (}(G_{X}(z))^{N}{\big )}=G_{N}(G_{X}(z)).\end{aligned))}
This last fact is useful in the study of Galton–Watson processes and compound Poisson processes.
• Suppose again that N is also an independent, discrete random variable taking values on the non-negative integers, with probability generating function GN and probability mass function ${\displaystyle f_{i}=\Pr\{N=i\))$. If the X1, X2, ..., XN are independent, but not identically distributed random variables, where ${\displaystyle G_{X_{i))}$ denotes the probability generating function of ${\displaystyle X_{i))$, then
${\displaystyle G_{S_{N))(z)=\sum _{i\geq 1}f_{i}\prod _{k=1}^{i}G_{X_{i))(z).}$
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

${\displaystyle G(z)=z^{c}.}$
• 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
${\displaystyle G(z)=\left[(1-p)+pz\right]^{n}.}$
Note that this is the n-fold product of the probability generating function of a Bernoulli random variable with parameter p.
So the probability generating function of a fair coin, is
${\displaystyle G(z)=1/2+z/2.}$
• The probability generating function of a negative binomial random variable on {0,1,2 ...}, the number of failures until the rth success with probability of success in each trial p, is
${\displaystyle G(z)=\left({\frac {p}{1-(1-p)z))\right)^{r}.}$
(Convergence for ${\displaystyle |z|<{\frac {1}{1-p))}$).
Note that this is the r-fold product of the probability generating function of a geometric random variable with parameter 1 − p on {0,1,2,...}.
${\displaystyle G(z)=e^{\lambda (z-1)}.}$

## Related concepts

The probability generating function is an example of a generating function of a sequence: see also formal power series. It is equivalent to, and sometimes called, the z-transform of the probability mass function.

Other generating functions of random variables include the moment-generating function, the characteristic function and the cumulant generating function. The probability generating function is also equivalent to the factorial moment generating function, which as ${\displaystyle \operatorname {E} \left[z^{X}\right]}$ can also be considered for continuous and other random variables.