Expectation of Discrete Random Variable from PGF

Theorem
Let $X$ be a discrete random variable whose probability generating function is $\map {\Pi_X} s$.

Then the expectation of $X$ is the value of the first derivative of $\map {\Pi_X} s$ $s$ at $s = 1$.

That is:
 * $\expect X = \map {\Pi'_X} 1$

Proof
For ease of notation, write $\map p x$ for $\map \Pr {X = x}$.

From the definition of the probability generating function:


 * $\displaystyle \map {\Pi_X} s = \sum_{x \mathop \ge 0} \map p x s^x = \map p 0 + \map p 1 s + \map p 2 s^2 + \map p 3 s^3 + \cdots$

Differentiate this $s$:

Plugging in $s = 1$ gives:


 * $\displaystyle \map {\Pi'_X} 1 = \sum_{k \mathop = 0}^\infty k \, \map \Pr {X = k} \, 1^{k - 1} = \map p 1 + 2 \map p 2 + 3 \map p 3 + \cdots$

But:


 * $\displaystyle \sum_{k \mathop = 0}^\infty k \, \map \Pr {X = k} \, 1^{k - 1} = \sum_{k \mathop = 0}^\infty k \, \map \Pr {X = k}$

is precisely the definition of the expectation.

Comment
So, in order to find the expectation of a discrete random variable, then there is no need to go through the tedious process of what might be a complicated and fiddly summation.

All you need to do is differentiate the PGF and plug in $1$.

Assuming, of course, you know what the PGF is.