Tuesday, 24 June 2014

logical deduction - Four cups on a table


I didn't invent this myself, I heard it a long time ago and it stuck with me.


Four glasses are placed on the corners of a square rotating table. Some of the glasses are facing upwards and some upside-down. Your goal is to arrange the glasses so that they are all facing up or all facing down. Here are the rules:



  1. You must keep your eyes closed at all times. (No tricks or lateral thinking, this is a pure logic puzzle)

  2. In a single turn, any two glasses may be inspected. After feeling their orientation, you may reverse the orientation of either, neither, or both glasses.

  3. After each turn, the table is rotated through a random angle.


  4. At any point, if all four glasses are of the same orientation a bell will ring.


Find a solution to ensure that all glasses have the same orientation (either up or down) in a finite number of turns. The algorithm must not depend on luck.


Edit: The bell will not ring mid-turn, it will only ring if the glasses are all of the same orientation at the end of your turn.



Answer



I have solution that can guarantee the end goal being reached in a maximum of four five steps. (Many thanks for @dmg and @Taemyr for their comments to fix this solution.) The trick is to:



Reduce the cups into the following configuration:
$\begin{bmatrix} \circ & \bullet \\ \bullet & \circ \end{bmatrix} $
where turning any two cups along the diagonal will satisfy the end goal




For a constructive proof, we first consider the following two three CASES:


CASE 1) the orientation of a single cup is different from the others, e.g. $\begin{bmatrix} \circ & \bullet \\ \circ & \circ \end{bmatrix} $ or $\begin{bmatrix} \bullet & \circ \\ \bullet & \bullet \end{bmatrix} $
CASE 2a) two cups are in each orientation along the diagonal, e.g. $\begin{bmatrix} \circ & \bullet \\ \bullet & \circ \end{bmatrix} $
CASE 2b) two cups are in each orientation along two sides, e.g. $\begin{bmatrix} \circ & \bullet \\ \circ & \bullet \end{bmatrix} $


Step 1



Take two cups along the diagonal.
- If they are different, flip $\circ$ to $\bullet$. If this doesn't sound the bell, we either have $\begin{bmatrix} \circ & \bullet \\ \bullet & \circ \end{bmatrix}$ or $\begin{bmatrix} \circ & \bullet \\ \circ & \circ \end{bmatrix}$, with the majority orientation being $\circ$. In either case, proceed to step 2.
- If they are the same, flip both. If this doesn't sound the bell, we either have $\begin{bmatrix} \bullet & \circ \\ \bullet & \bullet \end{bmatrix}$ or $\begin{bmatrix} \circ & \bullet \\ \circ & \circ \end{bmatrix}$. Either way, the majority orientation is known, and we can proceed to step 3.




Step 2



Take two cups along the diagonal.
- If they are different, we now know we have $\begin{bmatrix} \circ & \bullet \\ \circ & \circ \end{bmatrix}$. Flip $\bullet$ to $\circ$ to win.
- If they are the same, flip both. If this doesn't sound the bell, we now know we have $\begin{bmatrix} \circ & \bullet \\ \circ & \circ \end{bmatrix}$. Proceed to Step 3.



Step 3



At this point, we have already figured out what the majority orientation is, so we assume we have $\begin{bmatrix} \circ & \bullet \\ \circ & \circ \end{bmatrix} $ WLOG. Then:

Take two cups along the diagonal.
- If the cups are different, flip $\bullet$ to $\circ$ to win.
- If the cups are both $\circ$, flip one of them. We now know we have $\begin{bmatrix} \circ & \bullet \\ \circ & \bullet \end{bmatrix}$.



Step 4



Take two adjacent cups along an edge and flip both.
- If the cups chosen are the same, we win.
- If they are different, we now know we have $\begin{bmatrix} \circ & \bullet \\ \bullet & \circ \end{bmatrix} $




Step 5



Take two cups along a diagonal and flip both. We win!



No comments:

Post a Comment

Understanding Stagnation point in pitot fluid

What is stagnation point in fluid mechanics. At the open end of the pitot tube the velocity of the fluid becomes zero.But that should result...