Passengers arrive at a railway station according to a homogeneous Poisson process with rate λ. At the beginning (time 0), there are no passengers at the station. The train departs at time T. Denote by W be the total waiting time of all passengers arrived up to the departure of the train. Compute E(W).

My solution:

Let $S_i$ be the arriving time of passenger $i$.

$E(W) = E(E(W|N(T)) = E(E(T\cdot N(T) - \sum_{i=1}^{N(T)} S_i))$

$= T\cdot \lambda T - E(\sum_{i=1}^{N(T)} ES_i)$

$= \lambda T^2 - E(\sum_{i=1}^{N(T)} i/\lambda)$

$ = \lambda T^2 - \frac{1}{\lambda}E(1+ 2+ ... + N(T))$

$ = \lambda T^2 - \frac{1}{2\lambda}E((1+N(T))N(T))$

$ = \lambda T^2 - \frac{1}{2\lambda}(EN(T) + (EN(T))^2)$

$ = \lambda T^2 - \frac{1}{2\lambda}(\lambda T^2 + \lambda T^2+(\lambda T^2)^2)$

$ = \lambda T^2 - T - \lambda T^2/2$

$ = \lambda T^2/2 - T$.

I know the answer is wrong but cannot find my mistake.

  • $\begingroup$ Do you have the correct answer? $\endgroup$
    – gunes
    Commented Apr 11, 2020 at 17:20

1 Answer 1


Use the units calculus and do reality checks to identify the errors. These general principles are helpful for anyone doing any statistical calculation, especially those who are authorities and need to get the answers right!

First -- responding to a comment -- the answer looks wrong because intuitively each person waits $T/2$ time on average, so the answer ought to be $T/2$ times the expected number of waiters ($\lambda T$ by definition), equal to $\lambda T^2/2.$ Furthermore, when $T$ and $\lambda$ are small the answer could be negative: take $T=1$ hour, say, and $\lambda = 1$ person per hour: $\lambda T^2 - T = -1/2$ is nonsensical.

Nevertheless, the strategy looks good. I will therefore not attempt to improve on it, but instead will respond to the literal question by demonstrating one simple method to check one's work: namely, by employing the units calculus.

By tracking the units of measurement we can find where errors may have crept in. Notice that $T,$ $S_i,$ and $W$ are in units of $\text{[time]},$, $N$ is unitless, and $\lambda$ must be in counts per unit time, or $\text{[time]}^{-1}.$ Let's carry these units explicitly in the calculation for as long as they make sense:

$$\begin{aligned} E(W \text{[time]}) &= E\left(E\left(W \text{[time]}\mid N(T)\right)\right) \\ &= E\left(E\left(\sum_{i=1}^{N(T)} T\text{[time]}-S_i\text{[time]}\right)\right)\\ &= E\left(E\left(T\text{[time]}\cdot N(T) - \sum_{i=1}^{N(T)} S_i\text{[time]}\right)\right)\\ &= T\text{[time]}\cdot\lambda\text{[time]}^{-1} T\text{[time]} - E\left(E\left(\sum_{i=1}^{N(T)} S_i\text{[time]}\right)\right) \\ &= \lambda\text{[time]}^{-1} T^2\text{[time]}^2 - E\left(\sum_{i=1}^{N(T)} \frac{i}{{\lambda}\text{[time]}^{-1}}\right)\\ &\ldots\\ &= \lambda T^2\text{[time]} - \frac{1}{2\lambda\text{[time]}^{-1}}E\left(N(T)+N(T)^2\right)\\ &\overset{?}{=}\lambda T^2\text{[time]} - \frac{1}{2\lambda}\text{[time]}\left(\lambda\text{[time]}^{-1}T^2\text{[time]}^2 + \cdots + (\lambda\text{[time]}^{-1}T^2\text{[time]}^2)^2\right)\cdots \end{aligned} $$

The units of measure in the last term, when expanded out, are $\text{[time]}\times \text{[time]}^{-1}\times \text{[time]}^2 = \text{[time]}^2$ and $\text{[time]}\times (\text{[time]}^{-1}\times \text{[time]})^2 = \text{[time]}^3,$ neither of which is commensurate with the first term, which is in units of $\text{[time]}$ (as it must be). This must be where an error occurred. Maybe it's not the only error -- and maybe it's not even the first one -- but at least we have found something to correct.

Evidently, the expectations aren't what were supposed. In fact, because the count $N(T)$ has a Poisson distribution with parameter $\lambda\text{[time]}^{-1} T\text{[time]} =\lambda T$ (unitless), its expectation and its variance are both unitless and equal to $\lambda T.$ Consequently

$$E(N(T)^2) = \operatorname{Var}(N(T)) + E(N(T))^2 = \lambda T + (\lambda T)^2$$

(all unitless). Continuing from the penultimate line, just before the mistake, we find

$$\begin{aligned} E(W\text{[time]}) &= \cdots = \lambda T^2\text{[time]} - \frac{1}{2\lambda}\text{[time]}\left(\lambda T + (\lambda T + (\lambda T)^2)\right)\\ &= \frac{\lambda}{2}T^2\text{[time]} - T\text{[time]}. \end{aligned}\tag{*} $$

Although the units are now correct the value is still wrong: it incorrectly subtracts $T.$ (We saw at the outset how that can lead to erroneous answers. Try $T=1/2$ hour and $\lambda = 1$ per hour, for instance.) Tracking back up through the questions, we see the subtrahend came from the $N(T) + (N(T))^2$ expectation. Where did that enter into the calculations? At the point where expectations of the $S_i$ were taken. This suggests evaluating the expected sum in a different way.

Now, the sum of the $S_i$ doesn't care about the order in which passengers arrived. If we forget the order, all the $S_i$ have the same distribution and, as we well know, that distribution is uniform between $0$ and $T.$ Thus, the expectation of any waiting time is $T/2\text{[time]}$ and the expectation of their sum (conditional on $N(T)$) must be $N(T)T/2.$ Taking expectations we find

$$E\left(\sum_{i=1}^{N(T)} S_i\text{[time]}\right) = \lambda\text{[time]}^{-1}T^2\text{[time]}^2/2,$$

which at least is still in units of time. Using this in place of the second term of $(*)$ gives

$$E(W\text{[time]}) = \lambda T^2 - \lambda T^2/2 = \lambda T^2/2,$$

a time that agrees with the intuitive answer.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.