I have a problem on binomial probability, it goes like this:

A restaurant offers apple and blueberry pies and stocks an equal number of each kind of pie. Each day ten customers request pie. They choose, with equal probabilities, one of the two kinds of pie. How many pieces of each kind of pie should the owner provide so that the probability is about .95 that each customer gets the pie of his or her own choice?

Now I know the binomial formula: $\binom{n}{k}p^k(1-p)^{n-k}$, so in this scenario it goes like: $\binom{n}{10}.5^{10}.5^{n-10}$.

Is this correct? How do I find n? I've been trying several values like $n=15$, $n=20$, etc. but this does not feel correct, there should be a way of getting it.


In matlab I get with binocdf() .9408 with n=15, but what exactly am I doing?

  • $\begingroup$ Why do you think $k$ should be 10? What is being chosen? What is the maximum number of (things) that can be chosen? $\endgroup$ – jbowman Nov 11 '13 at 19:31
  • $\begingroup$ 10 customers get 1 pie, so I think is n choose 10 $\endgroup$ – Pedro.Alonso Nov 11 '13 at 19:43
  • $\begingroup$ And the maximum I say is 10 also it can be 9,8,7, etc., but for 10 costumers 10 pies $\endgroup$ – Pedro.Alonso Nov 11 '13 at 19:52
  • 1
    $\begingroup$ Each of 10 customers chooses 1 pie, with probability $p$. So... how many TOTAL pies are chosen? Of that many total pies, how many are apple? What is the probability that, say, 4 of the pies are apple? $\endgroup$ – jbowman Nov 11 '13 at 20:05
  • 1
    $\begingroup$ You might find it easier to flip the question around: If I bake 5 of each kind, what are the chances everyone gets the kind they want? (that only works if exactly 5 people want each type) If I bake 6 of each, what are the chances everyone gets the kind they want? ... (If I bake 10 of each, clearly it's 100% chance everyone gets what they want). The question is slightly ambiguous in that it can be interpreted as requiring the same number of each or it can be interpreted as not requiring them to be the same (you may be able to get the desired coverage with say 6 of one kind and 7 of the other). $\endgroup$ – Glen_b Nov 11 '13 at 21:57

The exercise says that each day exactly 10 customers walk in, asking for one of two sorts of pie. The question is which total number of pies of each sort must be available to ensure with 95% probability that each customer gets what he/she requests. Let us have a look at the extreme cases first: If the total number is 4 of each sort, then a total number of 8 pies is available and it is certain that the last two customers do not only not get their wish, but no pie at all. If on the other hand 10 pies of each sort are available then each customer will get what he/she wishes - even if all 10 order the same sort of pie.

This may give an idea how to solve the general problem: We have to look for the probability that 0, 1, 2, ..., 10 out of 10 customers choose, say, apple pie. This distribution is given by $\binom{10}{n} p^n (1-p)^{10-n}$ with $p=0.5$. The cumulative binomial distribution shows that the probability to choose 9 or 10 apple pies is about 1%. Likewise, the symmetric question that 0 or 1 customers choose apple pie is equally small. So there is a 98% chance that between 2 and 8 customers choose apple pie. If the shop has 8 pies of each sort on stock, the customers will be happy with 98% probability. (A similar calculation shows that the probability to pick between 3 and 7 apple pies is only 89%. So 7 pies of each sort is not enough.)

Side note: If we assume that apple pie is exquisite and expensive while the alternative is always on stock, then the problem becomes a one-sided statistical problem. Only days on which customers choose many apple pies are problematic. In this scenario, 7 apple pies are almost enough since the probability to choose 8 or more of one sort is equal to 5.5%.

| cite | improve this answer | |
  • $\begingroup$ Yes I got 8 ≈0.98, so that sounds reasonable. $\endgroup$ – Pedro.Alonso Nov 11 '13 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.