quality:correction, stylistic:style_transfer, linguistic:paraphrasing
Conditional binomials

If X ~ B(n, p) and Y | X ~ B(X, q) (the conditional distribution of Y, given X), then Y is a simple binomial random variable with distribution Y ~ B(n, pq).

For example, imagine throwing n balls to a basket U and taking the balls that hit and throwing them to another basket U. If p is the probability to hit U then X ~ B(n, p) is the number of balls that hit U. If q is the probability to hit U then the number of balls that hit U is Y ~ B(X, q) and therefore Y ~ B(n, pq).

Since X ∼ B (n, p) {\displaystyle X\sim B(n,p)} and Y ∼ B (X, q) {\displaystyle Y\sim B(X,q)}, by the law of total probability,

Since (n k) (k m) = (n m) (n − m k − m), {\displaystyle {\tbinom {n}{k}}{\tbinom {k}{m}}={\tbinom {n}{m}}{\tbinom {n-m}{k-m}},} the equation above can be expressed as

Factoring p k = p m p k − m {\displaystyle p^{k}=p^{m}p^{k-m}} and pulling all the terms that don't depend on k {\displaystyle k} out of the sum now yields

After substituting i = k − m {\displaystyle i=k-m} in the expression above, we get

Notice that the sum (in the parentheses) above equals (p − p q + 1 − p) n − m {\displaystyle (p-pq+1-p)^{n-m}} by the binomial theorem. Substituting this in finally yields

and thus Y ∼ B (n, p q) {\displaystyle Y\sim B(n,pq)} as desired.