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?

  • $\begingroup$ It is exactly the same question. But I have some doubts about the answer. So thought to ask again. $\endgroup$ – chintan s Sep 9 '16 at 14:58

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)

| cite | improve this answer | |
  • $\begingroup$ Thanks Doug for your detailed reply but I am still confused. How to derive the 40 based on uniform distribution? Also, why do you have 50% for the green light in the first option? This may sound stupid but I can't seem to connect the dots. $\endgroup$ – chintan s Sep 9 '16 at 16:14
  • $\begingroup$ Ok, I found that the Expected value of a Uniformly Distributed Random variable is 0.5*interval, in this case it will be (80-0)/2 = 40. But please tell me what do you mean by 50% for the Green option. Thanks! $\endgroup$ – chintan s Sep 9 '16 at 16:18
  • $\begingroup$ Also, why do you have 0.5*40 = 20? Should it not be 0.5*80 = 40? $\endgroup$ – chintan s Sep 9 '16 at 16:20
  • $\begingroup$ Ok, 50% Green comes from the fact that the light is either Red or Green with 1/2 probability. Am I right? $\endgroup$ – chintan s Sep 9 '16 at 16:33
  • $\begingroup$ Lots of comments. I was away from my computer and unable respond. Sounds like you figured it out though. In a 160 second interval, the light is red for 80 seconds and green for 80 seconds. When it is red, the expected value of a uninformly distributed variable is the midpoint of its range. $\endgroup$ – Doug M Sep 10 '16 at 5:12

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