Follow @ProbabilityPuz |

Q: A shopkeeper hires an apprentice for his store which gets one customer per minute on average uniformly randomly. The apprentice is expected to leave the shop open until at least 6 minutes have passed when no customer arrives. The shop keeper suspects that the apprentice is lazy and wants to close the shop at a shorter notice. The apprentice claims (and the shopkeeper verifies), that the shop is open for about 2.5hrs on average. How could the shopkeeper back his claim?

Statistics: A good book to learn statistics

A: Per the contract, at least 6 minutes should pass without a single customer showing up before the apprentice can close the shop. To solve this lets tackle a different problem first. Assume you have a biased coin with a probability \(p\) of landing heads. What is the expected number of tosses before you get \(n\) heads in a row. The expected number of tosses to get to the first head is simple enough to calculate, its \(\frac{1}{p}\). How about two heads? We can formulate this recursively. We need to get to a head first. Following this, you need to toss the coin one more time for sure. With a probability \(p\) you get the second heads or with a probability \(1 - p\) you have to start over again. The number of tosses to two heads is thus \(\frac{1}{p} + 1 + \frac{1}{p}\times(1-p)\).

Extending this out to get \(n\) tosses, if you assume that \(y(n)\) is the expected number of tosses to get to \(n\) heads in a row then the following state transition diagram shows how the transitions happen.

From the state \(y_{n-1}\), with probability \(1- p\) you start over again. Stated recursively

$$

y_{n} = y_{n-1} + 1 + (1-p)y_{n}\\

py_{n} = y_{n-1} + 1

$$

Using the above expression, it is easy to derive the general expression for \(y_{n}\) as follows, keeping in mind \(y_{0} = 0\)

$$

y_{1} = \frac{y_{0}}{p} + \frac{1}{p} = \frac{1}{p}\\

y_{2} = \frac{1}{p}(y_{1} + 1) = \frac{1}{p^{2}} + \frac{1}{p}

y_{3} = \frac{1}{p}(y_{2} + 1) = \frac{1}{p^{3}} + \frac{1}{p^{2}} + \frac{1}{p}

$$

Being a sum of a geometric series, the \(y_{n}\) can be evaluated to

$$

y_{n} = \frac{1}{1-p}\big(\frac{1}{p^{n}} - 1\big)

$$

Now, back to the original question. Assume the apprentice waits \(k\) minutes before no customer shows up and he chooses to shut the shop. The situation is "similar" to the coin tossing and awaiting for a string of heads. (Note: Strictly speaking, it's similar only in the limiting case when the time interval is very small). In this case each "head" signifies the absence of a customer showing up in a minute. As the customers arrive uniformly at random we can assume they follow a Poisson process. The probability that \(m\) customers arrive in a one minute window if the rate parameter is \(\lambda\) (in this case \(\lambda = 1min^{-1}\)) is

$$

P(m,\lambda) = \frac{(\lambda)^{m}e^{-\lambda}}{m!}

$$

When \(m =0\) we get \(p = e^{-\lambda}\). Plugging this value back to our equation for \(y_{n}\) we get

$$

y_{n} = \frac{1}{1 - e^{-\lambda}}\big(e^{k\lambda} - 1\big)

$$

for small \(\lambda\) the denominator of the first part of the equation can be approximated as \(\frac{1}{\lambda}\) yielding

$$

y_{n} = \frac{1}{\lambda}\big(e^{k\lambda} - 1\big)

$$

Note, if you plug \(k=6\) into the above equation you get \(\approx 7\) hours whereas for \(k=5\) you get \(\approx 2.5\) hours. Due to the exponential connection between \(y_{n}\) and \(k\) the values for \(y_{n}\) are super sensitive to changes in \(k\).

If you are looking to buy some books in probability here are some of the best books to learn the art of Probability

## Comments

## Post a Comment