During a test at school today the following question was asked - (Translated from Danish, please ask if the question is unclear)
At a workplace, consisting of 50 members, there is a 7% chance that a given worker is using the toilet at any time.
Assume every worker has the same chance of being at the toilet at any time, and that their toilet visits are all independent of one another
What is the minimum number of toilets required, such that the probability of a queue forming outside the toilet is less that 5%?
Is there an 'elegant' way to solve this question?
How we all solved it
Talking to class-mates after the test - turns out we all did the same thing to solve this question. We were allowed to use maple so we defined a cumulative distribution function:
$$cdf(n,p,t):=\sum_{i=0}^t \binom{n}{i}p^i(1-p)^{n-i}$$
And simply guessed the number:
$$cdf(50,0.07,6)=0.0583136357$$ $$cdf(50,0.07,7)=0.0220099488$$
So the answer became "It would take 7 toilets"
This is just an unsatisfying way to solve the problem, and dosent look that great either.
Additional attempts
When I got home, I tried to use maples "solve()" function to do something like:
$$solve(cdf(50,0.07,t)=0.05)$$
But maple could not find an answer there, so then I got desperate and tried things like:
$$solve(min(cdf(50,0.07,t)<0.05))$$
Which clearly was not going anywhere either, and now im out of ides.
So my question: Would you solve this question in a different manner? - if so how?
We can make use of an extension of the factorial function for non-integer values. Ie, n! = Γ(n + 1)
https://en.wikipedia.org/wiki/Factorial#Factorial_of_non-integer_values
This allows us to obtain a continuous representation for which stock numeric rootfinding can be used. This allows for a short and simple approach using Maple.
Moreover, this approach removes the need to first discover an integer value of
tfor which the probability is less than 5%.First I'll show it alongside some explanation, and then I'll show the short code the obtains the result.
NB. Your Question is tagged with
Maple, and you show Maple code attempts to solve the problem, hence it very much appears that this is one kind of answer for which you are looking.Here is
sum(ext, i=0..t), simplified only for convenience.We can check agreement at some positive integer values of
t.We can superimpose plots involving the discrete function and this continuous extension.
Using numeric root-finding it is now simple to find the value of
tfor which this attains a value of 0.05 .Note that we do not have the burden of supplying a value of
tfor which the probability was less than 0.05 .The next integer higher than that root
And, without all the exposition,