Explicit distribution of B which has conditioned binomial distribution I have a question concerning the following task:
Let $A \sim$ Bin($n, p$) and let $B$ conditioned on {A = m} have binomial distribution with parameters $m$ and $q$, that is
$P(B = k|A = m) =$ ${m} \choose {k}$ $q^k(1-q)^{m-k}$, $k = 0, ..., m$ 
What is the distribution of B?
What I already got is the following:
$P(B = k) = \sum_{m=0}^n P(B = k|A = m) P(A = m) =$ ...
$= \sum_{m=0}^n$ ${m} \choose {k}$ $q^k(1-q)^{m-k}$ ${n} \choose {m}$ $p^m(1-p)^{n-m} = \sum_{m=k}^n$ ${m} \choose {k}$ $q^k(1-q)^{m-k}$ ${n} \choose {m}$ $p^m(1-p)^{n-m}$
Has anyone a hint how i could simplify this sum?
 A: We have
\begin{align}
\Pr(B = k) &= \sum_{m= 0}^n \binom{m}{k}q^k(1-q)^{m-k}\binom{n}{m}p^m(1-p)^{n-m} \\
&=\left(\frac{q}{1-q}\right)^k(1-p)^n\sum_{m=0}^n \binom{m}{k}\binom{n}{m}\left(\frac{p(1-q)}{1-p}\right)^m \\
&=\left(\frac{q}{1-q}\right)^k(1-p)^n\sum_{m=0}^n\binom{n}{k}\binom{n-k}{n-m}\left(\frac{p(1-q)}{1-p}\right)^m \\
&=\left(\frac{q}{1-q}\right)^k(1-p)^n\binom{n}{k}\left(\frac{p(1-q)}{1-p}\right)^n\sum_{m=0}^n \binom{n-k}{n-m}\left(\frac{1-p}{p(1-q)}\right)^{n-m} \\
&=\left(\frac{q}{1-q}\right)^k(1-p)^n\binom{n}{k}\left(\frac{p(1-q)}{1-p}\right)^n\left(1 + \frac{1-p}{p(1-q)}\right)^{n-k} \\
&=\binom{n}{k}(1-pq)^{n-k}(pq)^k
\end{align}
A: Different look on it:
Take independent $X_1,\dots, X_n, Y_1,\dots,Y_n$ with $X_i\sim\text{Ber}(p)$ and $Y_i\sim\text{Ber}(q)$ for $i=1,\dots,n$.
Setting: $$A:=X_1+\cdots+X_n$$ and: $$B:=X_1Y_1+\cdots+X_nY_n$$ we are exactly in the situation described in your question. 
Evidently the $X_iY_i$ are independent with $X_iY_i\sim\text{Ber}(pq)$ for $i=1,\dots n$ so that $B\sim\text{Bin}(n,pq)$.

Actually this does not answer your question ("how to simplify this sum"), but shows that the distribution can be found without using the sum.
