# Mean of total time spent at the exhibition

An exhibition is open for a period of time of $T$ hours. Visitors arrive to it following a Poisson process with parameter $\lambda$ visitors per hour. Visitors stay in the exhibition until it's closing time. Calculate the mean of the total time spent by visitors at the exhibition.

I know it must be solved using conditional probability, but I don't even know where to start. Any help is highly appreciated. Regards.

Edited: missed the word "total".

• "Mean total time" says "across all the arrival patterns people can have, on average, how long did all the visitors in a day spend, cumulatively" whereas "mean time per person" says "on average, how long does a visitor stay" – Stella Biderman Feb 23 '16 at 5:06
• It still seems as though it can be determined by simply multiplying the expected number of visitors by the average time spent by each visitor, though. – Brian Tung Feb 23 '16 at 5:16
• @BrianTung Actually, it cannot since, in general, $$E(N)\cdot E\left(\frac1N\sum_{k=1}^NT_k\right)\ne E\left(\sum_{k=1}^NT_k\right).$$ – Did Feb 23 '16 at 12:06
• Conditioned on the number of visitors, arrival time of the visitor is $U(0,T)$, so average time spent at the exhibition is $\frac T 2$. Average number of visitors is $\lambda T$, hence mean total time spent is $\frac 1 2 \lambda T^2$. In other words, you have a non-homogeneous Poisson process of intensity $\lambda(T-t)$ and you are looking for its average over $[0,T]$. – A.S. Feb 23 '16 at 12:30
• @Did What you wrote down is Wald's identity and it's true under rather mild assumptions (which are satisfied here). – A.S. Feb 23 '16 at 12:46

Expected (or mean) number of visitors per hour is $λ$. The visitors that arrived in the time interval $[t,t+1)$ for $t=0,1,2,\dots T-1$ will stay $T-(t+1)$ for sure plus $\frac12$ hours in mean (this is non-trivial and is derived from the fact that given that there are $λ$ Poisson arrivals in a time period, then they are uniformly distributed over this time period). Hence if we denote with $M$ the total time spent by visitors in the museum, we have that \begin{align}\Bbb E[M]&=\sum_{t=0}^{T-1}\left(T-t-1+\frac12\right)\cdot λ=λ\sum_{t=0}^{T-1}\left(T-\frac12-t\right)=T(T-\frac12)λ-λ\frac{T(T-1)}{2}\\&=\frac{λT^2}{2}\end{align}
Even simpler, as stated in the comments, you can consider the whole interval $[0,T]$ with Poisson arrivals with rate $λT$. Moreover, this question has much to do with conditional (expectation if not probability) since, if we denote with $N(T)$ the random number of Poisson arrivals in the time interval $[0,T]$ and with $T_k$ the time of the $k-$th arrival for $0\le k\le N(T)$, then $$\Bbb E[M]=\Bbb E\left[\sum_{k=1}^{N(T)}(T-T_k)\right]=\Bbb E\left[\Bbb E\left[\sum_{k=1}^{N(T)}(T-T_k) \mid N(T) \right]\right]$$ where $$\Bbb E\left[\sum_{k=1}^{N(T)}T-T_k \mid N(T)=n \right]=nT-\sum_{k=1}^n\Bbb E[T_k]=nT-\sum_{k=1}^n\frac{kT}{n+1}=\frac{nT}{2}$$ Hence $$\Bbb E[M]=\Bbb E\left[\frac{N(T)T}{2}\right]=\frac{T}{2}\Bbb E[N(T)]=\frac{T}{2}λT=\frac{λT^2}{2}$$
Conditional probability has nothing to do with this. A person who arrives at time $t$ spends $T-t$ hours in the museum. This allows you to write an equation for the distribution of time that a random person spends. Then use integration to get the mean