# Formula for probability that a set of size S contains at least X objects of value V, given common range R of possible values for each object

For example, If I roll 4 dice (set size 4, range of possible values 1-6), what is the probability of getting at least 2 of 6s.

-
Ideally, the body of the question should be self-contained without relying on the title; in the present case, the two seem to contradict each other. Rolling $4$ dice doesn't generate a permutation. Also, the concept of "value of an object" isn't explained in the body. If, as the example seems to suggest, your question is what the probability is of getting a particular value $V$ at least $X$ times drawn from $S$ independent uniform distributions over $R$ items, the answer is $\sum_{n=X}^S\binom{S}{n}p^n(1-p)^{S-n}$, where $p=1/R$. –  joriki Jun 16 '11 at 4:38
@joriki: sorry for the semantic errors, I'm not too familiar with math jargon. But how does rolling 4 dice not generate a permutation? –  Matt Munson Jun 16 '11 at 4:51
See en.wikipedia.org/wiki/Permutation. A permutation is an arrangement of different elements without repetition; rolling $4$ dice doesn't generate all of the $6$ possible values and may lead to repetitions. An example of a permutation of the values $1$ to $6$ would be $2,5,4,3,1,6$; an example of the result of rolling $4$ dice would be $2,3,6,3$. –  joriki Jun 16 '11 at 4:57
@joriki: Ah, ok. My definition of the word permutations was clearly way off. –  Matt Munson Jun 16 '11 at 4:59
For your example, the probability is $$\sum_{n=2}^4\binom{4}{n}\left(\frac{1}{6}\right)^n\left(\frac{5}{6}\right)^{4-n}$$ as this is the sum of the probabilities that you roll exactly $2$ sixes, exactly $3$ sixes, or exactly $4$ sixes in four rolls using the binomial distribution. In general, the formula will given by $$\sum_{n=X}^S\binom{S}{n}p^nq^{S-n}$$ assuming there is a probability $p=\frac{1}{R}$ of the object having value $V$, and probability $q=1-p$ of the object not having value $V$.
@Matt: To understand the notation, see en.wikipedia.org/wiki/Binomial_coefficient and en.wikipedia.org/wiki/Sigma_notation. For why this is the correct answer, see en.wikipedia.org/wiki/Binomial_distribution. Note that despite the similarity in appearance, in $\binom{4}{n}\left(\frac{1}{6}\right)^n\left(\frac{5}{6}\right)^{4-n}$ the first factor is a binomial coefficient whereas the other two are just fractions in parentheses. –  joriki Jun 16 '11 at 5:01
@ joriki: So if I understand correctly then, the notation is equivalent to $$\left(\frac{1}{6}\right)^2\left(\frac{5}{6}\right)^{4-2}+ \left(\frac{1}{6}\right)^3\left(\frac{5}{6}\right)^{4-3}+ \left(\frac{1}{6}\right)^4\left(\frac{5}{6}\right)^{4-4}$$ , which simplifies to 25/1296 + 5/1296 + 1/1296 = 31/1296. But that can't be right. I don't know what I'm supposed to do with the binomial coeffeicient. –  Matt Munson Jun 16 '11 at 5:43
@Matt, you evaluate the binomial coefficient in each term as well. $\binom{n}{k}$ is shorthand for $n!/(k!(n-k)!)$. So for example, $\binom{4}{2}=4!/(2!(4-2)!)=4!/(2!2!)=24/(2\cdot 2)=6$. I take it you're familiar with the factorial? If not, $n!=1\cdot 2\cdot 3\cdots (n-1)\cdot n$, the product of all positive integers up to $n$. –  yunone Jun 16 '11 at 5:50