MathGent
MathGent
  • Threads: 3
  • Posts: 17
Joined: Dec 5, 2014
December 12th, 2014 at 12:40:10 PM permalink
At MathProblems.info is the following logic problem, labeled “Two Switches problem #1”.

“You are trapped in a small phone booth shaped room. In the middle of each side of the room there is a hole. In each hole there is a light switch. You can’t see in the holes but you can reach your hands in them and flip the switches. You may stick your hands in any two holes at the same time and flip none, either, or both of the switches as you please. Nothing will happen until you remove both hands from the holes. You succeed if you get all the switches into the same position, after which time you will immediately be released from the room. Unless you escape, after removing your hands the room will spin around, disorienting you so you can’t tell which side is which. How can you escape? The fewest possible turns that I know of is five.”

The presented solution requires (up to) 5 turns, as the problem states. However, there is a better 5-turn solution, where the average number of turns required to escape is less than the presented solution.

Here is the presented solution (with some edits for clarity):

At the end of any step you may win, otherwise proceed to the next step.

  1. Pick two adjacent holes and flip both switches UP (if not already UP).
    • Win if other two switches are UP.
    • Otherwise, switches must be in DUUU or DDUU configuration.
  2. Pick two opposite holes and flip both switches UP (if not already UP).
    • Win if other two switches are UP.
    • Otherwise, switches must be in a DUUU configuration.
  3. Pick two opposite holes.
    • If one switch is DOWN, flip UP and win.
    • Otherwise, flip one DOWN to put switches in a DDUU configuration.
  4. Pick two adjacent holes and flip both switches.
    • Win if both switches were in the same position.
    • Otherwise, switches must be in DUDU configuration.
  5. Pick two opposite holes and flip both switches and win.

If you assume there are only 14 possible initial switch states (i.e. exclude UUUU and DDDD), then the probability of winning at each turn using the presented solution is:

Win in 1 Turns = 21% (3/14)
Win in 2 Turns = 20% (11/14 * 2/8)
Win in 3 Turns = 29% (11/14 * 6/8 * 2/4)
Win in 4 Turns = 15% (11/14 * 6/8 * 2/4 * 2/4)
Win in 5 Turns = 15% (11/14 * 6/8 * 2/4 * 2/4 * 2/2)

Average # of turns = 2.817

If you assume there are 16 possible initial switch states, but you don’t win if switches start in UUUU or DDDD states (i.e. you only win if they end in that state after 1 or more steps), then the probability of winning at each turn using the presented solution is:

Win in 1 Turns = 25% (4/16)
Win in 2 Turns = 19% (12/16 * 2/8)
Win in 3 Turns = 28% (12/16 * 6/8 * 2/4)
Win in 4 Turns = 14% (12/16 * 6/8 * 2/4 * 2/4)
Win in 5 Turns = 14% (12/16 * 6/8 * 2/4 * 2/4 * 2/2)

Average # of turns = 2.734

Here is the alternate/better solution I came up with. Steps 1~2 are different from the presented solution, but Steps 3~5 are essentially the same. As in the presented solution, you reach Step 3 when 3 of the 4 switches are in the same position (and from what has transpired in Steps 1~2, you know whether it is DUUU or UDDD).

Note: It’s easier to explain this if I refer to holes & switches by number. You can think of Hole #1 (H1) as being the hole on your left, after each room spin. The physical switch behind it can be any of the 4 after each room spin, but I refer to the switch in H1 as SW1. H2/SW2, H3/SW3, and H4/SW4 are clockwise from there.

  1. Choose H1 & H3.
    • If switches differ, then flip SW1 (to match SW3).
      • Win if Step 1 starting configuration was DUUU or UDDD.
      • Otherwise, switches must be in DUDU or DUUU or UDDD configuration; continue to Step 2.
    • Otherwise, flip SW1 & SW3.
      • Win if Step 1 starting configuration was DUDU or UDUD.
      • Otherwise … at this point it depends on whether you assume 14 or 16 possible initial states.
        If 14, then switches must be in DUUU or UDDD configuration; skip to Step 3.
        If 16, then switches must be in DUDU or DUUU or UDDD configuration; continue to Step 2.
  2. Choose H1 & H3.
    • If switches differ, then flip whichever one matches the Step 1 starting position of SW1, and win.
      (You win if Step 2 starting configuration was DDUD or UDDD or UUDU or DUUU.)
    • Otherwise, flip SW1 & SW3.
      • Win if Step 2 starting position was DUDU or UDUD.
      • Otherwise, switches must be in DUUU or UDDD configuration; continue to Step 3.
  3. Choose H1 & H3.
    • If switches differ, then flip whichever one matches the previous Step starting position of SW1, and win.
      (You win if Step 3 starting configuration was DDUD or UDDD or UUDU or DUUU.)
    • Otherwise, flip SW1 to put switches in DDUU configuration.
  4. Choose H1 & H2, and flip SW1 & SW2.
    • Win if both switches were in the same position.
    • Otherwise, switches must be in DUDU configuration
  5. Choose H1 & H3, and flip SW1 & SW3 and win.

With 14 possible initial states, the probability of winning after each turn is:

Win in 1 Turn 29% (4/14)
Win in 2 Turns 40% (6/14 * 6/10) + (4/14 * 4/8)
Win in 3 Turns 16% (6/14 * 4/10 * 4/8) + (4/14 * 4/8 *2/4)
Win in 4 Turns 11% (6/14 * 4/10 * 4/8 * 2/4) + (4/14 *4/8 * 2/4 * 2/2)
Win in 5 Turns 4% (6/14 * 4/10 * 4/8 * 2/4 * 2/2)

Average # of Turns = 2.229

With 16 possible initial states, the probability of winning after each turn is:

Win in 1 Turn 25% (4/16)
Win in 2 Turns 45% (12/16 * 6/10)
Win in 3 Turns 15% (12/16 * 4/10 * 4/8)
Win in 4 Turns 8% (12/16 * 4/10 * 4/8 * 2/4)
Win in 5 Turns 8% (12/16 * 4/10 * 4/8 * 2/4 *2/2)

Average # of Turns = 2.275

I’ve played around with this quite a bit, and this was the best solution I could find (regardless whether 14 or 16 initial states).

Can anyone come up with a better 5-step solution, with fewer average # of turns? I don’t think a 4-step solution is possible (based on all of the various actions I’ve tried), but I’m not quite ready to bet the farm on that yet.

Cheers!
Dieter
Administrator
Dieter
  • Threads: 16
  • Posts: 6013
Joined: Jul 23, 2014
December 12th, 2014 at 8:03:28 PM permalink
Quote: MathGent

Can anyone come up with a better 5-step solution, with fewer average # of turns?



Quote: Math Problem

Nothing will happen until you remove both hands from the holes.



So only take one hand out of a hole at a time, keeping your orientation.

I'm assuming that given the geometry of a standard phone booth, you could keep your left hand on one switch, while reaching the right arm into any other switch (crossed arms for one).
May the cards fall in your favor.
beachbumbabs
beachbumbabs
  • Threads: 101
  • Posts: 14268
Joined: May 21, 2013
December 13th, 2014 at 8:20:34 AM permalink
Quote: Dieter

So only take one hand out of a hole at a time, keeping your orientation.

I'm assuming that given the geometry of a standard phone booth, you could keep your left hand on one switch, while reaching the right arm into any other switch (crossed arms for one).



Grinning at your creativity.


Still grinning.


:) Kobayashi Maru
If the House lost every hand, they wouldn't deal the game.
Dieter
Administrator
Dieter
  • Threads: 16
  • Posts: 6013
Joined: Jul 23, 2014
December 13th, 2014 at 12:57:06 PM permalink
Quote: beachbumbabs

:) Kobayashi Maru



Somewhere along the line, I heard the joke than ends in "The Russians used a pencil."

I like to think I learned something from that.
May the cards fall in your favor.
beachbumbabs
beachbumbabs
  • Threads: 101
  • Posts: 14268
Joined: May 21, 2013
December 13th, 2014 at 1:22:50 PM permalink
Quote: Dieter

Somewhere along the line, I heard the joke than ends in "The Russians used a pencil."

I like to think I learned something from that.



Without clicking your link, I'm guessing this is about NASA developing a zero-gravity pen.

Which made a fortune for whoever it was that developed them..Parker?

It's the American way, comrade.
If the House lost every hand, they wouldn't deal the game.
  • Jump to: