Calvin has to cross several signals when he walks from his home to school. Each of these signals operate independently. They alternate every 80 seconds between green light and red light.At each signal, there is a counter display that tells him how long it will be before the current signal light changes. Calvin has a magic wand which lets him turn a signal from red to green instantaneously. However, this wand comes with limited battery life, so he can use it only for a specified number of times.
If the total number of signals is 2 and Calvin can use his magic wand only once, then what is the expected waiting time at the signals when Calvin optimally walks from his home to school?
I was convinced that I had the right solution, but apparently I didn't but I cannot see what is wrong with my reasoning.
My solution is as follows: Each light, $Y_1$ and $Y_2$ have uniformly distributed waiting times in $[0, 80]$. Basically, he has to make a decision at the first light. At the second light, he always uses the wand if it is available. I assume that he has to pick some optimal waiting time $x \in [0, 80]$ at the first light such that if $Y_1 > x$, he uses the wand. In that case, the waiting time at the first light becomes $0$.
Using this reasoning, the total expected time is $$ \mathbb E[Y_1 1_{\lbrace Y_1 \leq x \rbrace} + Y_2 1_{\lbrace Y_1 > x \rbrace}] = \\ \mathbb E[Y_1 1_{\lbrace Y_1 \leq x \rbrace}] + \mathbb E[Y_2]\mathbb P(Y_1 > x ) $$ This becomes $$ \int^x_0 \frac{1}{80}u du + 40 \frac{80-x}{80} = \frac{1}{2} \left(\frac{x^2}{80} + 80 -x \right) $$ Then differentiating, setting to $0$, solving for $x$ and plugging it back into the expectation gives me $30$ as the answer. I have been told that this is incorrect.
Where is the mistake?