= Conditional composition of two independent binomial counts
{title2=$\mathbb P(X=j\mid X+Y=k)\propto\binom nj\binom m{k-j}p^j(1-p)^{n-j}q^{k-j}(1-q)^{m-k+j}$}
Let $X$ and $Y$ be <independent random variables> with <binomial distributions> $\operatorname{Bin}(n,p)$ and $\operatorname{Bin}(m,q)$. Conditional on $X+Y=k$ having positive <probability>, the possible values of $X$ satisfy $\max(0,k-m)\leq j\leq\min(n,k)$. Their probabilities are
$$
\mathbb P(X=j\mid X+Y=k)=\frac{w_j}{\sum_iw_i},
\quad w_j=\binom nj\binom m{k-j}p^j(1-p)^{n-j}q^{k-j}(1-q)^{m-k+j},
$$
where the denominator sums over that feasible integer range. The formula follows by multiplying independent <binomial probabilities> and dividing by the <probability> of the disjoint union of all feasible count pairs.
For $p,q\in(0,1)$, common factors cancel and the weights are proportional to $\binom nj\binom m{k-j}\theta^j$, where $\theta=p(1-q)/[q(1-p)]$. If $p=q$, this reduces to the <hypergeometric distribution>, with probabilities $\binom nj\binom m{k-j}/\binom{n+m}k$. At parameter endpoints, use the original probability weights and check that the conditioning event has positive <probability> before dividing.
Back to article page