# Trying to find P(X=k|Z=m) for binomial random variables with parameters n and p

Let $X$ and $Y$ are independent binomial random variables with parameter $n$ and $p$. Their sum is denoted by $Z$. How do I prove :

$$P(X=k\mid Z=m) = {n \choose k}{n \choose m-k}\biggm/ {2n \choose m}$$

-

As $X$ and $Y$ are independent, we have $Z \cong \mathrm{Binomial}(2n, p)$, hence $$P(Z = m) = \binom{2n}m p^m(1-p)^{2m-p}$$ Moreover \begin{align*} P(X= k, Z=m) &= P(X=k, X+Y=m)\\ &= P(X=k, Y = m-k)\\ &= P(X=k)P(Y=m-k)\\ &=\binom nk p^k(1-p)^{n-k}\binom n{m-k}p^{m-k}(1-p)^{n-m+k}\\ &= \binom nk\binom n{m-k} p^m (1-p)^{2n-m} \end{align*} And therefore $$P(X = k \mid Z= m) = \frac{P(X=k,Z=m)}{P(Z=m)} = \frac{\binom nk\binom n{m-k}}{\binom{2n}m}$$