Question:

In a certain system, a customer must first be served by server 1 and then by server 2. The service time at server $i$ is exponential with rate $\mu_i$, $i = 1, 2$. An arrival finding server 1 busy waits in line for that server. Upon completion of service at server 1, a customer either enters service with server 2 if that server is free or else remains with server 1 (blocking any other customer from entering service) until server 2 is free. Customers depart the system after served by server 2. Suppose that when you arrive there is one customer in the system and that customer is being served by server 1. What is the expected total time you spend in the system?

Working:

Define:

\begin{align*}

X & = \text{Total time in system} \\

W_1 & = \text{Waiting time at server 1} \\

W_2 & = \text{Waiting time at server 2} \\

S_1 & = \text{Service time at server 1} \\

S_2 & = \text{Service time at server 2} \\

\end{align*}

Then $X = W_1 + S_1 + W_2 + S_2$. We need to find $E[X] = E[W_1] + E[S_1] + E[W_2] + E[S_2]$.

Since at the beginning there is only one customer in the system and that customer is being served by server $1$, then the waiting time at server $1$ is the same as the service time for the customer that is currently being served by server $1$. Therefore, $W_1$ is exponentially distributed with parameter $\mu_1$ and hence $E[W_1] = \frac{1}{\mu_1}$.

Since $S_1$ is exponentially distributed with $\mu_1$, then $E[S_1] = \frac{1}{\mu_1}$.

The Law of Total Expectation can be used to find $E[W_2]$. Define $A_1$ as the event where server $1$ completes before server $2$ and $A_2$ as the event where server $1$ completes after server $2$ completes. Then,

\begin{align*}

E[W_2] = E[W_2|A_1]P(A_1) + E[W_2|A_2]P(A_2)

\end{align*}

Define an ``arrival'' to mean the completion of service (at either servers), then consider the merging of the Poisson process represented by the service time at server $1$ and server $2$. The merged process is also Poisson with rate $\mu_1 + \mu_2$. Hence,

\begin{align*}

P(A_1) = \frac{\mu_1}{\mu_1+\mu_2} \\

P(A_2) = \frac{\mu_2}{\mu_1+\mu_2}

\end{align*}

By the memoryless property of the exponential distribution, the expected waiting time at server 2 given that server 1 has completed its service before server 2 is still exponentially distributed with parameter $\mu_2$. Hence, $E[W_2|A_1] = \frac{1}{\mu_2}$. If server 1 completes its service after server 2, then the waiting time at server 2 is zero, hence $E[W_2|A_2] = 0$. Thus,

\begin{align*}

E[W_2] = \frac{1}{\mu_2}\left(\frac{\mu_1}{\mu_1+\mu_2} \right) + 0 \left(\frac{\mu_2}{\mu_1+\mu_2} \right) = \frac{1}{\mu_2}\left(\frac{\mu_1}{\mu_1+\mu_2} \right)

\end{align*}

The service time at server 2 is exponentially distributed with parameter $\mu_2$, hence $E[S_2] = \frac{1}{\mu_2}$.

In total,

\begin{align*}

E[X] & = \frac{1}{\mu_1} + \frac{1}{\mu_1} + \frac{1}{\mu_2}\left(\frac{\mu_1}{\mu_1+\mu_2} \right) + \frac{1}{\mu_2} \\

& = \frac{2}{\mu_1} + \frac{1}{\mu_2} \left(\frac{\mu_1}{\mu_1+\mu_2} +1 \right)

\end{align*}

Query

I want to confirm whether the arguments I used are correct. More specifically, I am not too sure whether my argument to derive $P(A_1)$ and $P(A_2)$ is valid, can someone please confirm whether what I've done is right? Or provide any other kinds of solution would be cool too