The Answer: Locked room and light bulb problem


Ok, so this is an old problem and assumes some "common sense" for the solution. This is a great example of how that can be dangerous, because some times common sense changes. In this case the problem assumes that when you turn on a light bulb it gets hot, an expectation which has changed with advances in lighting technology.

So for this problem we assume that the lights will in fact get warm to the touch if the lights are left on. We also assume that the light bulbs are far enough apart that heating caused in the other bulbs, by one of the bulbs being on, is negligible. We also need to assume that the switches and bulbs are independent.

Two bulb solution

Some simpler versions of the problem only use two switches. Start with both switches in the off position, then wait a long time for the temperatures to settle.

    {S1 S2} = {a,b} 
  
Then you can flip the "a" switch and open the door.
    {S1 !S2} = {a,b} 
    or
    {!S1 S2} = {a,b} 
  
For problems that let us open and close the door we can flip and test with the following conditions.
    1. Light that was constantly on should now be warm and on. 
    2. Light that was constantly off should still be off and cold. 
    3. Light that was on and is now off should be off and cold. 
    4. Light that was off and is now on should be on and cold.
  

Tests 1 and 2 uniquely identify S1, and you get S2 by process of elimination. If you can not open the door multiple times you can also use a testing setup that generates multiple temperatures like what I am about to describe for the three switch problem.

Three bulb Solution

With the three switch problem you can do the flip and test:

    1. {S1  S2  S3} = {a,  b,  c} -> Starting test  - wait for X minutes. 
    2. {S1  S2 !S3} = {a,  b, !c} -> Toggle switch and wait for Y minutes.
    3. {S1 !S2  S3} = {a, !b,  c} -> Toggle switch and open the door
  
With this decoding then is
    1. S1. Light that was constantly on should either be ambient temperature and off or very hot and on.
    2. S2. Should either be heated for X+Y minutes and off, or ambient and on. 
    3. S3. Should either be heated for X-Y minutes and on, or heated Y minutes and off.
  
Four temperatures possible: Ambient, Y, X-Y, X+Y
    1.Ambient and off light is S1. 
    2.Ambient and on light is S2. 
    3. Heated (X+Y) and on is S1. 
    4. heated (X+Y) and off it is S2. 
    5. Heated X-Y and on is S3 and heated Y and off is S3. 
       So the medium temperature (either Y or X-Y) is S3.
  

From #5 above we can collapse the temperature range to Ambient, {Y, X-Y}, X+Y. So just picking a X/Y ratio that allows for adequate difference in heating and cooling times is all that is needed.