Arrival Time in Poisson Process Starting at noon, diners arrive at a restaurant according to a Poisson process at the rate of five customers per minute. The time each customer spends eating at the restaurant has an exponential distribution with mean 40 minutes, independent of other customers and independent of arrival times. Find the distribution, as well as the mean and variance, of the number of diners in the restaurant at 2 p.m.
Approach:
Average inter-arrival time = 1/λ= 1/300hour and λ=300/hour
 A: Let $X(t)$ be the number of customers in the restaurant at time $t$, assuming $X(0)=0$. This is a $M/M/\infty$ queueing model - interarrival and service times are each i.i.d. exponential and there is no limit to how many customers can be served at a time. The process $\{X(t):t\geqslant 0\}$ is a continuous-time Markov chain with generator $Q$ given by
$$
Q_{i,j} = \begin{cases}
\lambda,& j=i+1\\
i\mu,& j=i-1\\
-(\lambda+i\mu),& j=i,
\end{cases}
$$
for nonnegative integers $i,j$. The distribution of $X(t)$ is Poisson with rate 
$$
m(t) = \int_0^t \lambda(s)(1-G(t-s))\ \mathsf ds,
$$
where $\lambda$ is the arrival rate and $G$ the distribution function of the service times. To see this, fix $t\geqslant 0$, and consider an arrival at time $u$ where $0\leqslant s\leqslant t$. The customer is in the system at time $t$ if its service time is more than $t-s$, which has probability $1-G(t-s)$. We compute
$$
m(t) = \int_0^t \lambda e^{-\mu(t-s)}\ \mathsf ds = \lambda e^{-\mu t}\int_0^t e^{-\mu s}\ \mathsf ds = \frac\lambda\mu\left(1-e^{-\mu t}\right),
$$
and since $X(t)$ has a Poisson distribution, its mean and variance are also $m(t)$.
In particular, when $\lambda = 300$, $\mu=\frac32$, and $t=2$, we have
$$
m(t) = 300\cdot\frac23\left(1-e^{-\frac32\cdot 2} \right) = 200\left(1-e^{-3}\right)\approx 190.043.
$$
