How to show the equivalence of a compound and a binomial distribution in a proper manner? I'm a student working on the master's in biology. My thesis is based on a simulation I wrote. Reading the literature I found a discrepancy between my implementation and some published implementations. To resolve this discrepancy I attempted to show that the compound random variable $X \sim Hypergeometric(N, K, n \sim Binomial(N, p))$ is equivalent to the binomial random variable $X \sim Binomial(K,p)$. Numerically this seems to hold.
This is what I managed to come up with:
On the one hand
\begin{align}
P(X=k) &= \sum_{n=k}^{N}\frac{\binom{K}{k}\binom{N-K}{n-k}}{\binom{N}{n}}\binom{N}{n}p^{n}(1-p)^{N-n} \\
&= \binom{K}{k}\sum_{n=k}^{N}\binom{N-K}{n-k}p^{n}(1-p)^{N-n}
\end{align}
on the other hand
$$P(X=k) = \binom{K}{k}p^{k}(1-p)^{K-k}.$$
Note that it's sufficient to start the summation with $n = k$ because $n \geq k$.
\begin{align}
\binom{K}{k}p^{k}(1-p)^{K-k} &= \binom{K}{k}\sum_{n=k}^{N}\binom{N-K}{n-k}p^{n}(1-p)^{N-n} \\
p^{k}(1-p)^{K-k} &= \hphantom{\binom{K}{k}}\sum_{n=k}^{N}\binom{N-K}{n-k}p^{n}(1-p)^{N-n}
\end{align}
With the help of Wolfram Mathematica I found the following:
\begin{align}
p^{k}(1-p)^{K-k} &= p^{k} (1-p)^{N-k} \left( \frac{1}{1-p}\right)^{N-K} - \frac{p^{N+1}}{1-p} \binom{N-K}{N-k+1} {}_{2}F_{1}(1,K-k+1;N-k+2;-\frac{p}{1-p}) \\
p^{k}(1-p)^{K-k} &= p^{k}(1-p)^{K-k} - \frac{p^{N+1}}{1-p} \binom{N-K}{N-k+1} {}_{2}F_{1}(1,K-k+1;N-k+2;-\frac{p}{1-p})
\end{align}
$\binom{N-K}{N-k+1}=0$ because $k \leq K$, so
$$p^{k}(1-p)^{K-k} = p^{k}(1-p)^{K-k}.$$
Is this correct?
Is this a proper presentation of a proof? Does this count as a proof at all? Should I include more assumptions? For example: $N,K,n,k$ are nonnegative integers, $p$ is a real, $N \geq K, N \geq n, N \geq k, K \geq k, n \geq k, 0 \leq p \leq 1$. Are there any conventions of notation/terminology that would make it more professional? What should be done when a step was done by Mathematica? Should I look for the appropriate identities to make the workings of that step explicit?
Are there any shortcuts/tricks that would make it more elegant?
 A: I do not know much about the Wolfram Mathematica solution. It becomes laborious.
You could rewrite
$$\sum_{n=k}^{N}\binom{N-K}{n-k}p^{n}(1-p)^{N-n}$$
as
$$\begin{array}{}\sum_{i=0}^{N-k}\binom{N-K}{i}p^{i+k}(1-p)^{N-(i+k)}
&=& \hphantom{p^k(1-p)^{K-k} }\sum_{i=0}^{N-K}\binom{N-K}{i}p^{i+k}(1-p)^{N-(i+k)+K-K} \\
 &=& p^k(1-p)^{K-k} \sum_{i=0}^{N-K}\binom{N-K}{i}p^{i}(1-p)^{N-K-i} \\ 
&=& p^k(1-p)^{K-k}\end{array}$$
The first equation changes the upper limit because you can not have $n-k>N-K$. The second takes a factor $p^k(1-p)^{K-k}$ outside the sum (this is actually similar to how you took the binomial coefficient outside the sum). The third equation sets the summation equal to one (you may recognize the term in the summation as a binomial distribution and the sum is over the entire range).

Intuitive
Here is an intuitive viewpoint of why the compounded distribution should equal a binomial distribution.
Imagine the following process:
You have $K$ red balls and $N-K$ blue balls. You place them randomly in a row and for each spot in the row you decide with probability $p$ to select the ball or not.
Note that the randomly distributing of the red and blue balls can be done just as well before as after deciding the spots for which the balls will be selected.
If you randomly distribute the red and blue balls afterwards then this process relates to your compound distribution:

*

*The number of balls that you pick is similar to a Binomial distribution.


*If you do it afterwards then it is just like a Hypergemetric distribution (selecting the number of picked balls out of the $K$ red and $N-K$ blue balls without replacement)
If you randomly distribute the red and blue balls before then this process relates to a binomial distribution:

*

*For each colored ball you independently decide to pick it or not based on a Bernoulli variable. This is similar to a Binomial distribution.


Alternative relationship
When you have two Binomial distributed variables (with equal $p$) then the distribution conditional on their sum is a Hypergeometric distribution.
$$P(X = x, Y = n-x | X+Y = n) =  \frac{P(X=x)P(Y=y)}{P(X+Y = n)}$$
with $P(X=x)$, $P(Y=y)$ and $P(X+Y = n)$ each being binomial distributed variables. You will get that the power terms of $p$ and $(1-p)$ cancel and what is left are the three binomial coefficients that you have in the formula for the hypergeometric distribution.
From this, you can imagine how you could reverse this construction of the hypergeometric distribution by compounding with the conditional term $P(X+Y = n)$.
$$P(X=x) = \sum P(X = x, Y = n-x | X+Y = n)P(X+Y = n)  $$
