# Simultaneous Poisson processes

The arrival of taxis at a taxi stand is Poisson at rate $$\lambda$$ per hour. The arrival of people to the stand is also Poisson but at rate $$\mu$$ per hour.

Taxis do not stop (they leave empty) if another taxi is waiting at the stand, and customers do not stop if another customer is waiting at the stand. This means that the stand is either empty or occupied by a taxi or a customer at any given time.

(a) What's the distribution of time until the stand is occupied?

(b) What's the expected amount of time for the first customer to leave in a taxi?

(c) In the long run, how many customers leave per hour in a taxi?

(d) In the long run, how many taxis leave per hour empty?

This question is really challenging for me because there is so much going on. I know the interarrival for taxi and people is $$\text{Exp}(\lambda)$$ and $$\text{Exp}(\mu)$$. I also know the merged processes is Poisson process with parameter $$\mu + \lambda$$.

(a) I think here you just find the distribution of $$\min(T_1, T_2))$$ where $$T_1$$ and $$T_2$$ are the interarrival times of taxi and person. Is that right?

(b) Would this just be $$E(\max(T_1, T_2))$$? Again, I'm not sure.

I'm truly unsure how to do (b), (c), and (d). I guess that (c) and (d) are limits of some sort but I am really looking for help on these.

taxi arrival time distribution $$T_i \sim Exp(\lambda)$$ customer arrival time distribution $$C_i \sim Exp(\mu)$$

(a) $$P(x = min(T_i, C_i)) = 1-P(T_i>x)P(C_i>x) = 1-(1-P(T_i (b) $$P(x = max(T_1, C_1)) = P(T_1 $$f_{max(T_1, C_1)}(x) = dP(x = max(T_1, C_1))/dx = \lambda e^{-\lambda x} + \mu e^{-\mu x} - (\lambda + \mu) e^{-(\lambda + \mu) x}$$ $$E(max(T_1, C_1)) = \int_0^\infty x f_{max(T_1, C_1)}(x)dx = \int_0^\infty x \lambda e^{-\lambda x} + \mu e^{-\mu x} - (\lambda + \mu) e^{-(\lambda + \mu) x} dx = \frac{1}{\lambda} + \frac{1}{\mu} - \frac{1}{\lambda + \mu}$$ (c) $$\frac{1}{E(min(T_i, C_i))} = \frac{1}{\lambda + \mu}$$

(d) all taxis per hour - taxis with passengers per hour $$\frac{1}{\lambda} - \frac{1}{\lambda + \mu}$$

Let $$\{X(t):t\geqslant0\}$$ be a continuous-time Markov chain on $$\{0,T,P\}$$ with transition rates $$q_{ij} = \begin{cases} \lambda,& i=0,j=T\\ \lambda,&i=P,j=0\\ \mu,&i=T,j=0\\ \mu,&i=0,j=P. \end{cases}$$ Assume that $$X(0)=0$$. For (a) let $$\tau=\inf\{t>0:X(t)\ne 0\}$$, then $$\mathbb P(\tau>t) = e^{-(\lambda+\mu)t},$$ so that $$\tau$$ has exponential distribution with parameter $$\lambda+\mu$$. Let $$\tau = \inf\{n>0:X_n=0\}$$, then $$\mathbb P(X(\tau)>t) = \mathbb P(X_1=T\mid X_0=0)e^{-\lambda t}$$

For (b), let $$J_n$$ be the jump times of $$X(t)$$. Then $$J_2$$ is the sum of an $$\mathrm{Expo}(\lambda)$$ and an $$\mathrm{Expo}(\mu)$$ random variable, with density given by convolution (assuming $$\lambda\ne \mu$$): \begin{align} f_{J_2}(t) &= f_T\star f_P(t)\\ &= \int_{\mathbb R} f_T(\tau)f_P(t-\tau)\ \mathsf d\tau\\ &= \int_0^t \lambda e^{-\lambda\tau}\mu e^{-\mu(t-\tau)}\ \mathsf d\tau\\ &= \lambda\mu e^{-\mu t}\int_0^t e^{-(\lambda-\mu)\tau}\ \mathsf d\tau\\ &= \frac{\lambda\mu}{\lambda-\mu}e^{-\mu t}(e^{-(\lambda-\mu)t}-1)\\ &= \frac{\lambda\mu}{\lambda-\mu}(e^{-\mu t}-e^{-\lambda t}). \end{align} The mean is thus $$\mathbb E[J_2] = \int_0^\infty tf_{J_2}(t)\ \mathsf dt = \int_0^\infty t\frac{\lambda\mu}{\lambda-\mu}(e^{-\mu t}-e^{-\lambda t})\ \mathsf dt = \frac1\lambda+\frac1\mu.$$

For (c) we compute the stationary distribution by use of the balance equations \begin{align} \lambda\pi_0 &= \mu\pi_T\\ \lambda\pi_P &= \mu\pi_0. \end{align} This yields $$\pi_T = \frac\lambda\mu\pi_0$$ and $$\pi_P=\frac\mu\lambda\pi_0$$. From $$\pi_0+\pi_T+\pi_P=1$$ we see that $$\pi_0\left(1 + \frac\lambda\mu+\frac\mu\lambda\right)=1 \implies pi_0 = \frac{\lambda\mu}{\lambda\mu + \lambda^2+\mu^2},$$ and hence $$\pi_T = \frac{\lambda^2}{\lambda\mu + \lambda^2+\mu^2}$$, $$\pi_P=\frac{\mu^2}{\lambda\mu + \lambda^2+\mu^2}$$. The number of customers that leave per hour in a taxi is given by $$\pi_T\mu + \pi_P\lambda = \frac{\lambda^2\mu}{\lambda\mu + \lambda^2+\mu^2} + \frac{\lambda\mu^2}{\lambda\mu + \lambda^2+\mu^2} = \frac{\lambda^2\mu+\mu^2\lambda}{\lambda\mu + \lambda^2+\mu^2}.$$

For (d), this is simply $$\pi_T\lambda = \frac{\lambda^3}{\lambda\mu + \lambda^2+\mu^2}.$$