# Probability generating function of binomial distribution [duplicate]

In a population of $2n$ individuals there are $n$ infected individuals and $n$ uninfected. Suppose that $X$ of the n uninfected become infected, where $X \sim \mathcal B(n, p)$, and, then, given $X = j$, $Y$ of the $n + j$ infected recover, where $Y\mid X=j \sim \mathcal B(n + j, q)$, allowing $Z = n + j − Y$ infected.

It is assumed the infection and recovery probabilities satisfy $p, q ∈ (0; 1)$.

First find the probability generating function of $X$ and the conditional probability generating function of $Y$ given $X = j$. Then, use conditional expectation to find the probability generating function of $Z$.

Now, assume that $Z$ has the same distribution as the sum of two independent binomial random variables and thus comment on the effect of the infection/recovery process on the initial number of infected $n$.

I know that $G_X(z)=(1-p+pz)^n$ where $z$ is an element of $\Bbb R$ is the generating function for Binomial distribution but I'm unsure how to use this to start the question??

## marked as duplicate by Graham Kemp, Daniel W. Farlow, user147263, user223391, colormegoneMay 22 '15 at 3:05

You know that $G_X(z)= (1-p+pz)^n$ and that $G_{Y\mid X}(z\mid j) = (1-q-qz)^{n+j}$ . Further, recall that $G_W(z) = \mathsf E(z^W)$.
Thus to find the unconditional probability of $Y$ use the Law of Iterated Expectation. \begin{align}G_Y(z) & = \mathsf E(z^Y) \\ & = \mathsf E(\mathsf E(z^Y\mid X)) \\ & =\mathsf E(G_{Y\mid X}(z\mid X))\end{align}
Similarly \begin{align}G_Z(z) & = \mathsf E(z^{n+X-Y}) \\ & = z^n\mathsf E(z^X \mathsf E(z^{-Y}\mid X)) \\ & = z^n\mathsf E(z^X\,G_{Y\mid X}(1/z\mid X)) \end{align}