# Attention capacity and queue length in a cafeteria

I have not been able to solve this problem. The difficulties I am having are that I don't know if its possible to solve for a numerical value, or if the solution is supposed to be in terms of $t$ (time).

In a cafeteria, there is a rate of costumer entrance of $0.3$ clients per minute. The cafeteria is able to attend $0.5$ clients per minute. What is the average of the clients that will have to wait until they are attended?

Hint: I think that one is supposed to use the Poisson distribution function.

• This is classical queuing theory. What do you know? What have you tried? – Did Oct 22 '11 at 8:20
• You need some extra information about the distributions of arrival times (Poisson process? Regular? something else?) and of service times (Exponential? Constant? something else?). – Henry Oct 22 '11 at 11:33
• Well, that's the thing; the problem statement specifies no further information. So I guess that the problem is not formulated correctly? @Henry yes, I think you are supposed to use Poisson. If so, it should be only Poisson, these problems don't mix theory concepts together. DidierPiau Well frankly I don't know where to start. I would have derivated the function to obtain the curve of the distribution and see where one of the curves is below the other, but it has factorials so I couldn't. – Severo Raz Oct 22 '11 at 13:52
• What curve(s)? What factorial(s)? I suggest you post the computations you used to get to the solution, so that we can see where you got stuck (or, more probably, why these are not relevant). // By the way: use @ if you want to signal a comment, I saw yours only by chance. – Did Oct 22 '11 at 17:19
• "Derivate" is not a verb. "Differentiate" is the word you want. – Gerry Myerson Oct 23 '11 at 6:19

When mentioning the rate $a$ of a process, one usually assumes that two properties hold. First, there is a point of the process in a given infinitesimal time interval $(t,t+\mathrm dt)$ with probability $a\mathrm dt+o(t)$. Second, the events that some disjoint intervals contain some points of the process or not are independent.

Here, one assumes that there is somebody entering the cafeteria during any time interval $(t,t+\mathrm dt)$ with probability $a\mathrm dt+o(\mathrm dt)$ with $a=0.3$ and that there is somebody leaving the cafeteria during any time interval $(t,t+\mathrm dt)$, if the cafeteria was not empty at time $t$, with probability $b\mathrm dt+o(\mathrm dt)$ with $b=0.5$. The fact that nothing happens has probability $1-a\mathrm dt+o(\mathrm dt)$ if the cafeteria is empty at time $t$ and $1-(a+b)\mathrm dt+o(\mathrm dt)$ otherwise. And two different events, either two arrivals or two departures or one of both types, happen with probability $o(\mathrm dt)$.

As I said in the comments, this is queuing theory at its most basic. What will interest us here is that $a<b$. One can guess that in this regime the cafeteria will not become occupied by more and more customers but that, after a time, a stationary state will occur where the probability $p_n$ that $n$ customers are in the cafeteria at time $t$ does not depend on the time $t$ anymore.

Let us take this for granted and consider the dynamics of the process once more. What is the probability that zero customers are in the cafeteria at time $t+\mathrm dt$? Three disjoint events can cause this to happen:

1. Either none was there at time $t$ and none arrived during the time interval $(t,t+\mathrm dt)$.
2. Or one customer was there at time $t$, which left during the time interval $(t,t+\mathrm dt)$.
3. Or at least two customers were there at time $t$, which all left during the time interval $(t,t+\mathrm dt)$.

Event 1. has probability $p_0$ (none there) times $1-a\mathrm dt+o(\mathrm dt)$ (none arriving). Event 2. has probability $p_1$ (one there) times $b\mathrm dt+o(\mathrm dt)$ (one leaving). Event 3. has probability $o(\mathrm dt)$ (at least two leaving). Summing up, this yields $$p_0=p_0(1-a\mathrm dt+o(\mathrm dt))+p_1(b\mathrm dt+o(\mathrm dt))+o(\mathrm dt),$$ hence $$ap_0=bp_1.$$ A similar decomposition applies to the probability that $n\geqslant1$ customers are there at time $t+\mathrm dt$.

1. Either $n$ customers were there at time $t$ and none left nor any other arrived. This happens with probability $p_n(1-(a+b)\mathrm dt)+o(\mathrm dt)$.
2. Or $n+1$ customers were there at time $t$ and one left. This happens with probability $p_{n+1}b\mathrm dt+o(\mathrm dt)$.
3. Or two elementary events happened. This happens with probability $o(\mathrm dt)$.

Equating this with $p_n$ and simplifying, one gets $$(a+b)p_n=ap_{n-1}+bp_{n+1}.$$ These equations fully characterize the distribution $(p_n)_{n\geqslant0}$ at stationarity. To compute each $p_n$, let us sum these over every $n\geqslant k$, for a given $k\geqslant1$. One gets $$(a+b)\sum\limits_{n\geqslant k}p_n=a\sum\limits_{n\geqslant k-1}p_{n}+b\sum\limits_{n\geqslant k+1}p_{n}=a\sum\limits_{n\geqslant k}p_{n}+ap_{k-1}+b\sum\limits_{n\geqslant k}p_{n}-bp_k,$$ hence $$ap_{k-1}=bp_k.$$ This, together with the fact that $\sum\limits_{n\geqslant 0}p_{n}=1$, yields that, for every $n\geqslant0$, $$p_n=(a/b)^n(1-(a/b)).$$ In particular the proportion of arrivals happening when the cafeteria is not empty is $1-p_0=a/b$.