# Determine the Hypergeometric probability function using sample space in which the selection is ordered

Suppose our sample space distinguishes points with different orders of selection. For example suppose that $S =\{SSSSFFF\ldots\}$ consists of all words of length n where letters are drawn without replacement from a total of $r$ $S$’s and $N$ � $r$ $F$’s. Derive a formula for the probability that the word contains exactly $X$ $S$’s. In other words, determine the hypergeometric probability function using a sample space in which order of selection is considered.

The answer is: $f(x)= \dfrac{\binom{n}{x} r^x (N-r)^{n-x}}{N^n}$

with $x$ ranging from $\max(0, n-(N-r))$ to $\min(n,r)$

• The formula you provide as an answer is not correct for sampling without replacement. It works for sampling with replacement, and for that it is a thinly disguised version of the binomial distribution. – André Nicolas Feb 5 '15 at 3:51
• In the answer it is (N-r)^(n-x) (I couldn't get it in the right format), is it still incorrect? if yes what do you think the answer should be? And the method is more important than the answer so could you elaborate a little on your method. thanks for trying! – L887 Feb 5 '15 at 4:24
• @AndréNicolas Could you please explain both the cases- sampling with and without replacement. thanks – L887 Feb 5 '15 at 4:31

For your sampling without replacement problem, there are $\binom{N}{n}$ equally likely choices. (Imagine that the letters have ID numbers written on them with invisible ink.) Whether we grab the $n$ items all at once or sequentially makes no difference to the probability we have $x$ S's.
There are $\binom{r}{x}$ ways to choose $x$ S's, and for each of these ways there are $\binom{N-r}{n-x}$ to choose $n-x$ F's. So our probability is $$\frac{\binom{r}{x}\binom{N-r}{n-x}}{\binom{N}{r}}.$$
Remark: For sampling with replacement, at each pick our probability of success S is $\frac{r}{N}$, and the probability of failure is $1-\frac{r}{N}$, which is $\frac{N-r}{N}$. Thus the probability of $x$ successes in $n$ trials is $$\binom{n}{x}\left(\frac{r}{N}\right)^x \left(1-\frac{r}{N}\right)^{n-x}.$$ This is the $f(x)$ of the OP. When we sample with replacement, the distribution is binomial, not hypergeometric.
• You are welcome. when $n$ is small in comparison with $N$, $r$, and $N-r$, then the $f(x)$ of your post will give a reasonable approximation* to the sampling without replacement situation. – André Nicolas Feb 5 '15 at 4:58