# determining the amount of total questions needed in a game given the probabilty

I'm creating a game and can't seem to quite figure this out - driving me crazy.

• There are 8 questions in my game
• You can play the game an unlimited amount of times
• the test bank doesn't change. so when a new game starts it draws from the same test bank (the questions are not replaced by new ones). within a game, however, there are 8 unique questions.

how many total questions do I need in the test bank, where if i play the game twice, the probability of getting 4 questions repeated is less than 5%?

-
clarify something. How many questions per game? –  Sabyasachi Mar 12 '14 at 17:58
"getting 4 questions repeated" exactly 4 or at least 4? –  Hoda Mar 12 '14 at 18:09
wow very sorry. i meant at least 4 questions. Thanks a lot guys. –  user2989523 Mar 12 '14 at 18:12

## 4 Answers

Let $n$ be the number of questions. We will calculate the chance that exactly four questions are repeated out of eight. There are ${n-8 \choose 4}{8 \choose 4}$ ways to choose four matching and four non-matching, and $n \choose 8$ ways to choose the questions overall. So we want $$\frac {{n-8 \choose 4}{8 \choose 4}}{n \choose 8}=0.05$$ I find $36$ gives a probability of $4.7\%$

-
OP meant at least 4. I think replacing $\binom{n-8}{4}$ with $\binom{n-4}{4}$ would answer the new question. –  Hoda Mar 12 '14 at 18:13
Yes, OP wanted at least 4. But if the chance of 4 is small, the chance of 5 is smaller yet, so it will not be much of a change. It should be clear how to modify this to add up 5,6,7,8. –  Ross Millikan Mar 12 '14 at 18:16

In a game context, we should probably interpret the question as asking that the probability of $4$ or more duplicates is less than $5\%$. And in a game context, for successive games, we would presumably not choose questions at random.

But the problem seems to ask us to assume that for each new game, the $8$ questions are chosen at random from the question bank, with all choices equally likely.

Suppose the test bank has $n$ questions, and that the first game has been played. We find the probability that the next selection of $8$ overlaps by $4$ or more with questions from the first game.

There are $\binom{n}{8}$ equally likely ways to choose the second set of $8$ questions. We count the number of choices with overlap $4$.

Which $4$? These can be chosen in $\binom{8}{4}$ ways, and for each way the $4$ non-overlapping questions can be chosen in $\binom{n-8}{4}$ ways.

If (as we should) we want to count also overlaps $5$, $6$, $7$, $8$, the number of ways is $$\binom{8}{4}\binom{n-8}{4}+\binom{8}{5}\binom{n-8}{3}+\binom{8}{6}\binom{n-8}{2}+\binom{8}{7}\binom{n-8}{1}+\binom{8}{8}\binom{n-8}{0}.$$ Divide by $\binom{n}{8}$ for the probability.

We want to make this probability $\lt 0.05$. The easiest way to get the appropriate $n$ is to use software. One can for example ask Wolfram Alpha to compute the probability for various values of $n$. Quite soon we can locate the appropriate $n$. One can also do it "by hand" by making appropriate estimates.

-

If there are $n$ question is the bank and we have already picked our 8 for the first time, then the $n$ questions are split into two categories: the 8 chosen the first time and the remaining $n-8$ not chosen the first time. Thus the question can be restated as: what is the smallest $n$ for which $$\frac{\binom{8}{4}\binom{n-8}{4}}{\binom{n}{8}}+\frac{\binom{8}{5}\binom{n-8}{3}}{\binom{n}{8}}+\frac{\binom{8}{6}\binom{n-8}{2}}{\binom{n}{8}}+\frac{\binom{8}{7}\binom{n-8}{1}}{\binom{n}{8}}+\frac{\binom{8}{8}\binom{n-8}{0}}{\binom{n}{8}}<0.05$$

Clearly we have $n\ge 12$. Time to bust out your favorite number crunching software from here!

-

Hint:

In the second draw, the four repeated questions should be drawn from the first 8. This you can draw it in ${8\choose4}$. Assume there are n questions in the test bank. The other 4 questions in the second draw should come from n-8. The number of ways that could happen is${{n-8}\choose4}$. Extending the same to i = 5,6,7,8 and the total number of ways you can pick 8 answers from the test bank = ${n\choose8}$

Thus the probability that you will have atleast 4 repeated questions = $\sum_{i=4}^8[\dfrac{{8\choose i}{{n-8}\choose{8-i}}}{{n\choose8}}] \approx 0.05$

Find n from that. n seems to be equal to 37

-