At a traffic junction, the cycle of traffic light is 2 minutes of green and 3 minutes of red. What is the expected delay in the journey, if one arrives at the junction at a random time uniformly distributed over the whole 5 minute cycle ?
I think I need to calculate $E(x)=\displaystyle \int_a^b xf(x)\,dx$ where $f(x)=\dfrac{1}{b-a}$.
I am not sure of what b and a should be. There would be no delay in $[0,2]$.
Would they be 5 and 2 respectively ? Please help.
Let $X$ be the time you arrive at the light (which has $\mathcal U(0,5)$ distribution), and $Y$ the amount of time you spend waiting. Then $$Y = \begin{cases} 0,& X< 2\\ 5-X,& X\geqslant 2\end{cases}. $$ Hence $$\mathbb E[Y] = \int_2^5 (5-x)\cdot\frac15\mathsf dx=\frac9{10}. $$