# Calculating expected residual service times

This is a queueing theory-related question. Suppose we have two types of arrivals, call them A and B, who arrive according to a Poison proces with rates $\lambda_A = 1/20$ per second and $\lambda_B = 1/30$ per second, respectively. These arrivals arrive at a single server. Type A arrivals have a service time of exactly $B_A= 8$ seconds, type B arrivals have a service time of exactly $B_B = 12$ seconds. I now want to calculate the expected residual time of an arbitrary job. The service time and residual time are related through $$E(R) = \frac{E(B^2)}{2E(B)}$$

Since the expected service time of an arbitrary job can be calculated through (using $P(\text{type A job}) = \frac{\lambda_A}{\lambda_A + \lambda_B} = \frac{3}{5}$ and $P(\text{type B job}) = \frac{\lambda_B}{\lambda_A + \lambda_B} =\frac{2}{5}$)$$E(B) = E(B|\text{type A job})P(\text{type A job}) + E(B|\text{type B job})P(\text{type B job}) = 8\cdot\frac{3}{5} + 12\frac{2}{5} = \frac{48}{5}$$ I thought I'd do the same for the expected residal time, through $$E(R) = E(R|\text{type A job})P(\text{type A job}) + E(R|\text{type B job})P(\text{type B job}) = \frac{8^2}{2\cdot 8}\frac{3}{5} + \frac{12^2}{2\cdot 12}\frac{2}{5} = \frac{24}{5}$$ However, a solution sheet gives as correct answer $$E(R) = \frac{1}{2}(\frac{8^2}{2\cdot 8} +\frac{12^2}{2\cdot 12})$$

I don't quite see why this is the case. I'm sure I'm missing something obvious but I would welcome any advice.

NB This is not homework. Also, the reader I use can be found at http://www.win.tue.nl/~iadan/queueing.pdf

-

Applying the definitions you recall, one gets $$\mathrm E(B)=8\cdot\frac35+12\cdot\frac25,\qquad\mathrm E(B^2)=8^2\cdot\frac35+12^2\cdot\frac25,$$ hence $$\mathrm E(R)=\frac12\cdot\frac{\mathrm E(B^2)}{\mathrm E(B)}=\frac12\cdot\frac{8^2\cdot3+12^2\cdot2}{8\cdot3+12\cdot2}=5.$$