# Conditional distribution of binomial random variables is hypergeometric

Let's say $X$ and $Y$ are binomial random variables with parameters $n$ and $p$ and $X+Y=m$. I want to show that the conditional distribution of $X$ if $X+Y=m$ is a hypergeometric distribution.

I'm thinking about putting these in terms of coin flips with the $m^\text{th}$ head occurring after $2n$ tosses. $X$ and $Y$ have $n$ tosses with probability of heads $p$. I'm not sure how to relate this to the hypergeometric distribution however.

## 1 Answer

We prove a somewhat more general result. Let $X$ and $Y$ be independent binomially distributed random variables with the same probability $p$ of "success" and number of trials equal to $a$ and $b$ respectively. (In your problem, we have $a=b=n$.)

Let us find the probability that $X=k$ given that $X+Y=m$. By the usual formula for the conditional probability, this is the probability that $X=k$ and $Y=m-k$ divided by the probability that $X+Y=m$.

The probability that $X=k$ and $Y=m-k$ is $\binom{a}{k}p^k(1-p)^{a-k}\binom{b}{m-k}p^{m-k} (1-p)^{b-(m-k)}$. This is $\binom{a}{k}\binom{b}{m-k}p^m(1-p)^{a+b-m}$.

The probability that $X+Y=m$ is $\binom{a+b}{m} p^m(1-p)^{a+b-m}$.

Divide. We get $$\frac{\binom{a}{k}\binom{b}{m-k}}{\binom{a+b}{m}}.\tag{1}$$

This is precisely the probability of getting $k$ red balls if we choose, without replacement, $m$ balls from $a+b$ balls $a$ of which are red and $b$ of which are blue. Formula (1) is a version of the familiar hypergeometric distribution function.