# Derivation of the negative hypergeometric distribution

Suppose we've given an urn which contains $R$ red and $W$ white balls. These balls are drawn randomly from the urn and are not placed back. Let

• $X:=$ number of attempts, before we've drawn at least $r\le R$ red balls
• $Y:=$ number of red balls after $n-1$ attempts

I want to calculate $\text{Pr}(X=n)$.

Suppose we've already drawn $n-1$ balls from the urn and received $r-1$ red balls. The probability of this to happen is given by $$\text{Pr}(Y=r-1)=h(r-1|R+W,R,n-1):=\frac{\begin{pmatrix} R \\ r-1 \end{pmatrix}\begin{pmatrix} W \\ n-r \end{pmatrix}}{\begin{pmatrix} R+W \\ n-1 \end{pmatrix}}$$ where $h$ denotes the hypergeometric distribution. The probability that now another red ball is drawn is given by $$\text{Pr}(X=n)=\text{Pr}(Y=r-1)\;h(1|R+W-(n-1),R-(r-1),1)=\frac{\begin{pmatrix} R \\ r-1 \end{pmatrix}\begin{pmatrix} W \\ n-r \end{pmatrix}}{\begin{pmatrix} R+W \\ n-1 \end{pmatrix}}\frac{R-(r-1)}{R+W-(n-1)}$$ While I think that's correct, I would really like to get a more compact form of that. After some research on the internet, I found out, that I should be able to receive $$\text{Pr}(X=n)=\ldots =\frac{\begin{pmatrix} r-1 \\ n-1 \end{pmatrix}\begin{pmatrix} R+W-(r-1) \\ R-(n-1) \end{pmatrix}}{\begin{pmatrix} R+W \\ R \end{pmatrix}}$$ But I don't see how I get the $\ldots$ filled.

• I'm unsure whether the final expression is correct or not. However, I'm sure we can rewrite the result in a more compact way. – 0xbadf00d Jun 8 '14 at 20:47

Your final expression may not be quite correct: for example I am dubious about ${r-1 \choose n-1}$ when $n \gt r$, but you can approach it from what you have done with something like this, which you should check and simplify. You also seem to have $K$ and $r$ representing the same thing.

$$\dfrac{\displaystyle{R \choose r-1}{W \choose n-r} }{\displaystyle{R+W \choose n-1} } \; \dfrac{R-(r-1)}{R+W-(n-1)}$$

$$=\dfrac{R!\; W!\; (n-1)! \;(R+W-(n-1))!\; (R-(r-1))}{(R+W)!\; (r-1)!\; (R-(r-1))! \; (n-r)!\; (W-(n-r))! \;(R+W-(n-1))}$$

$$=\dfrac{R!\; W!}{ (R+W)!}\; \dfrac{ (n-1)!}{(r-1)!\; (n-r)!} \;\dfrac{(R+W-(n-1))!}{(R-(r-1))! \; (W-(n-r))!}\dfrac{(R-(r-1))}{\; \;(R+W-(n-1))}$$

$$=\dfrac{\displaystyle {n-1 \choose r-1}\; {R+W-n \choose R-r}}{\displaystyle {R+W \choose R}}$$

though I have not checked this.

An alternative approach would be to find the probability of $r$ reds in the first $n$, i.e. $\dfrac{\displaystyle{n \choose r} {R+W-n \choose R-r}}{ \displaystyle{R+W \choose R}}$ and multiply this is the conditional probability that the last one of the $n$ is red, which I believe is $\dfrac{r}{n}$. I think this gives the same answer more quickly.

• You're right. $K$ should be $r$, sorry for that. – 0xbadf00d Jun 8 '14 at 20:49