Expected waiting time at traffic signals I came across the problem below:
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.
a. 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?
b. What if the number of signals is 3 and Calvin can use his magic wand only once?
I found that it was asked before here but I am not able to understand the accepted answer. The accepted answer states that it takes 40 seconds for the lights to change from Red to Green and from Green to Red.
But should it not be 80 seconds as stated in the question?
 A: Calvin approaches a light.
3 options.  The light is green (50%)
The light is red and the counter is low, and Calvin chooses to wait it out.
The light is red and the counter is high, and Calvin uses his putter outer.
What is the expected wait time if Calvin doesn't use the putter-outer?
0.5*40 = 20  (40 because the time on the countdown time is uniformly distributed over an 80 second interval, and the mean is 1/2 the size of the interval)
a) If Calvin gets to the first light, and he can save more than 20 seconds, (counter>20) he will use his putter outer.
options: green light 0 wait 1/2
red light uses putter outer 0 wait 3/8
red light 20 sec or less wait, waits it out 1/8
expected wait = 10/8
chance of using putter outer 3/8
at the second light... 3/8 likelihood doesn't have the putter outer and must wait.
expected wait 3/8*20
total = 70/8 seconds
b) 
before looking at 4 lights, lets look at 3.
If he uses the putter outer at the 1st light, he has an expects wait of 40 seconds for the rest of the way home.  If he doesn't he expect to wait 8.75 seconds.
he can save himself 31.25 seconds, he uses the putter outer.
expected wait.
(31.25/160) (31.25/2)   wait at the 1st light
+(111.25/160) 8.75 +  (48.75)/160 * 40 wait at the second light
21.3 seconds expected wait
4 lights
60 - 21.3 = 38.7
if the counter reads 38.7 (or more) at the 1st light, use the putter outer.
(38.7/160)(38.7/2) + (118.7/160)(21.3) + (41.3/160)(60)
