Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

We already know how to find the distribution of the sum of any two discrete random variables.

P(X+Y=k)=jP(X=j,Y=kj)P(X+Y = k) = \sum_j P(X=j, Y=k-j)

If XX and YY are independent, this simplifies to become the discrete convolution formula:

P(X+Y=k)=jP(X=j)P(Y=kj)P(X+Y = k) = \sum_j P(X=j)P(Y=k-j)

By induction, we can extend this to the sum of any finite number of independent variables.

So in principle, we know how to find the distribution of the sum of nn independent random variables for n>1n > 1. However, this method can be hard to put into practice for large nn.

In this section we examine another way of approaching the problem of finding the distribution of a sum. It is an abstract mathematical approach that is also easier to automate, though it too comes up against computational barriers eventually.

🎥 See More
Loading...

14.1.1Probability Generating Function (PGF)

Let XX be a random variable with possible values 0,1,2,,N0, 1, 2, \ldots, N for some fixed integer NN. For brevity, let pk=P(X=k)p_k = P(X = k) for kk in the range 0 through NN.

Define the probability generating function (pgf) of XX as

GX(s) = k=0Npksk,   <s<G_X(s) ~ = ~ \sum_{k=0}^N p_ks^k, ~~~ -\infty < s < \infty

Technical Note: We have defined the probability generating function for random variables that have finitely many non-negative integer values. The definition can be extended to random variables that have infinitely many non-negative integer values. But in that case the pgf is an infinite series and we have to be careful about convergence. Typically the pgf is defined only on the domain s1\vert s \vert \le 1 so that it converges.

The definition above says that for any ss,

GX(s) = p0+p1s+p2s2+p3s3++pNsNG_X(s) ~ = ~ p_0 + p_1s + p_2s^2 + p_3s^3 + \cdots + p_Ns^N

You can see that GXG_X is a polynomial of degree NN, and that the coefficient of sks^k is pk=P(X=k)p_k = P(X=k).

So if you were given the pgf of a random variable, you could read off the distribution of the random variable by simply listing all the powers and the corresponding coefficients:

  • The powers are the possible values.

  • The coefficients are the corresponding probabilities.

Hence GX(1)=1G_X(1) = 1.

14.1.2PGF of the Sum of Independent Random Variables

To see how the pgf helps us find the distribution of a sum, observe that for every ss, the value GX(s)G_X(s) is an expectation:

GX(s) = k=0NskP(X=k) = E(sX)G_X(s) ~ = ~ \sum_{k=0}^N s^kP(X=k) ~ = ~ E(s^X)

Therefore, if XX and YY are independent non-negative integer valued random variables, then for every ss,

GX+Y(s) = E(sX+Y) = E(sXsY) = E(sX)E(sY) = GX(s)GY(s)G_{X+Y}(s) ~ = ~ E(s^{X+Y}) ~ = ~ E(s^X s^Y) ~ = ~ E(s^X)E(s^Y) ~ = ~ G_X(s)G_Y(s)

We have used the fact that for the independent random variables sXs^X and sYs^Y, the expectation of the product is the product of the expectations.

The result says that the pgf of the sum of two independent random variables is the product of the two pgfs. This extends easily to more than two random variables and yields a simple formula for the pgf of the sum of i.i.d. variables.

🎥 See More
Loading...

14.1.3PGF of the Sum of an IID Sample

Let X1,X2,,XnX_1, X_2, \ldots, X_n be i.i.d. random variables with possible values 0,1,2,,N0, 1, 2, \ldots, N. Let Sn=X1+X2++XnS_n = X_1 + X_2 + \cdots + X_n. Then the probability generating function of SnS_n is

GSn(s) = (GX1(s))n,   <s<G_{S_n}(s) ~ = ~ \big(G_{X_1}(s)\big)^n, ~~~ -\infty < s < \infty

Because GX1G_{X_1} is a polynomial of degree NN, GSnG_{S_n} is a polynomial of degree nNnN. As with any pgf, the coefficient of sks^k is the chance of kk. That is, for every kk in the range 0 through nNnN,

P(Sn=k)=coefficient of sk in GSn(s)P(S_n = k) = \text{coefficient of } s^k \text{ in } G_{S_n}(s)

We now have an algorithm for finding the distribution of SnS_n.

  • Start with the pgf of X1X_1.

  • Raise it to the power nn. That’s the pgf of SnS_n.

  • Read the distribution of SnS_n off the pgf.

Wonderful! We’re done! Except that actually doing this involves raising a polynomial to a power. That is a daunting task if the power is large.

Fortunately, as you will see in the next section, NumPy comes to our rescue with a set of polynomial methods.