# Discrete probability functions

I got a few questions about this topic, specifically the hypergeometric distribution and moment generating function from the text book by H.

1. A bag contains 144 ping-pong balls. More than half of the balls are painted orange and the rest are painted blue. Two balls are drawn at random without replacement. The probability of drawing two balls of the same color is the same as the probability of drawing two balls of different colors. How many orange balls are in the bag?
2. To find the variance of a hypergeometric random variable in Example 2.3-4 we used the fact that $$\ E[X(X − 1)] = \frac {N_1(N_1 − 1)(n)(n − 1)} {N(N − 1)}$$

Prove this result by making the change of variables $\ k = x − 2$ and noting that
$$\binom{N}{n}=\frac{N(N − 1)}{n(n − 1)}\binom{N-2}{n-2}$$

For the first one, I tried several ways, knowing that$$\binom{N_1}{1}\binom{N_2}{1}=\binom{N_1}{2}\binom{N_2}{0}=\binom{N_1}{0}\binom{N_2}{2}$$ But this doesn't give the correct result which is 78

For number two, I couldn't follow the answer given in the manual.
We have $\ N=N_1+N_2$. Thus

$$\ E[X(X-1)]=\sum_{x=0}^n x(x-1)f(x)$$
$$\ =\frac{\sum_{x=2}^n x(x-1)\frac{N_1!}{x!(N_1-x)!}*\frac{N_2!}{(n-x)!(N_2+n-x)!}}{\binom{N}{n}}$$
$$\ =N_1(N_1-1)\frac{\sum_{x=2}^n \frac{(N_1-2)!}{(x-2)!(N_1-x)!}*\frac{N_2!}{(n-x)!(N_2+n-x)!}}{\binom{N}{n}}$$ I don't get these two long steps. How did $\ x(x-1)$ disappear and why is $\ (x-2)!$ there instead?

Thanks for the help!

For part I: Seems like overkill. if $b$ is the number of blue balls then your condition is $$\frac b{144}\times\frac {b-1}{143}+\frac {144-b}{144}\times \frac {143-b}{143}=2\times \frac {b}{144}\times \frac {144-b}{143}$$ which immediately gives $b\in\{66,78\}$ and then $b<72\implies b=66\implies 144-b=78$.
For part II: just observe that $$\frac {x(x-1)}{x!}=\frac 1{(x-2)!}$$