Solution (source code)

= Solution

For a <discrete random variable> taking nonnegative integer values, its <probability generating function> is
$$
\boxed{G_X(s)=\mathbb E[s^X]=\sum_{k=0}^{\infty}\mathbb P(X=k)s^k.}
$$
It is defined at least for $|s|\leq1$. The usual <probability generating function> is intended for nonnegative integer-valued <random variables>; a general discrete real-valued <random variable> need not have this form. The coefficient of $s^k$ recovers $\mathbb P(X=k)$.