# Binomial probability problem from a book

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.

EDIT:

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

• Why do you think $k$ should be 10? What is being chosen? What is the maximum number of (things) that can be chosen? – jbowman Nov 11 '13 at 19:31
• 10 customers get 1 pie, so I think is n choose 10 – Pedro.Alonso Nov 11 '13 at 19:43
• And the maximum I say is 10 also it can be 9,8,7, etc., but for 10 costumers 10 pies – Pedro.Alonso Nov 11 '13 at 19:52
• 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? – jbowman Nov 11 '13 at 20:05
• 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). – Glen_b Nov 11 '13 at 21:57

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.)