# How to recover the probability mass function from probability generating function?

Would someone please provide me an example of where we take a p.g.f and use it to derive the p.m.f. ?

I understand that you were have to take the derivatives of the pmf, which is understandable because the derivatives tell us the probabilities, but I would just like to see an example of where it all comes together.

-

Here's an example:

The probability mass function for a binomial random variable is given by

$$\mathrm{Pr}(X=i)=f(i; n, p) = \begin{pmatrix} n \\ i\end{pmatrix}p^i(1-p)^{n-i}.$$

Expand the generating function $G(z) = [(1-p)+pz]^n$ using the binomial theorem:

$$G(z) = \sum_{k=0}^n \begin{pmatrix} n \\ k\end{pmatrix} (pz)^k(1-p)^{n-k}.$$

Taking the $i$th derivative with respect to $z$, we must see that all the terms with index less than $i$ are annihilated, leaving,

$$G^{(i)}(z) = \sum_{k=i}^n \begin{pmatrix} n \\ k\end{pmatrix} (1-p)^{n-k} \frac{d^i}{dz^i} (pz)^k.$$

Equally obviously, any terms with index greater than $i$ have a power of $z$ that does not annihilate. By computing $G^{(i)}(0)$, these terms vanish, leaving only the $i$th term:

$$G^{(i)}(0) = \begin{pmatrix} n \\ i\end{pmatrix} (1-p)^{n-i} p^i \left.\frac{d^i}{dz^i} (z)^i\right|_{z=0}.$$

Of course, we know that $\frac{d^m}{dx^m} x^m = m!$, so this gives us

$$G^{(i)}(0) = \begin{pmatrix} n \\ i\end{pmatrix} (1-p)^{n-i} p^i i! = i!\ \mathrm{Pr}(X=i)$$

-