Math Puzzle: Bottoms up

A bar contains a row of upside-down pint glasses arranged in a straight line. The bartender has a particular quirk: she will only flip three adjacent glasses at a time. She might flip the same glass multiple times over separate moves, but she only ever picks three neighboring glasses at once and toggles all of them. (Upright ones become upside-down, and vice versa.) Is there any sequence of flips that results in all of the glasses simultaneously upright if she starts with 12 glasses, 13 glasses or 14 glasses total? Does it make a difference if the glasses are arranged in a circle rather than a line?

For example, if there were only five glasses arranged in a row, oriented UDDUD (U for up and D for down), then she would have three legal moves: toggling the first three to make DUUUD, toggling the middle three to make UUUDD or toggling the last three to make UDUDU.

When the glasses are arranged in a straight line, the bartender can only succeed in the case with 12 glasses. When they are arranged in a circle, she can always succeed. In general, she can succeed in the straight-line case exactly when the number of glasses is a multiple of 3.

With 12 glasses, she simply flips the first three glasses, followed by the next three glasses, and so on down the line. Why is she destined to fail with 13 or 14 glasses? Consider the case of 13 glasses. Imagine coloring the glasses in three alternating colors, starting from the left: blue, green, red, blue, green, red, and so on. So there are five blue glasses total, four green glasses and four red glasses. Every flip of three adjacent glasses, no matter where it is in the line, will contain one blue glass, one green glass and one red glass.

A glass will be upright whenever it has been flipped an odd number of times. So to get all of the green glasses simultaneously upright, the total number of times a green glass was flipped must be the sum of four odd numbers (an odd number of flips for each of the four green glasses). A sum of an even number of odd numbers is always even, so the set of green glasses must receive an even number of flips in total. The same goes for the set of four red glasses. The blue glasses must receive an odd number of flips in total, however (because the sum of five odd numbers will be odd).

Because every valid move flips exactly one glass of each color, the running total of flips applied to the blue, green and red groups will always be identical. So it’s impossible to achieve an even number of flips for green and red glasses while maintaining an odd number of flips for blue glasses. The only way to avoid this issue is to have all colors contain the same number of glasses, which only occurs when the total number of glasses is a multiple of 3.

When the glasses are arranged in a circle, she can always succeed, regardless of their quantity. We’ll show it for the case with 13 glasses. Call the glasses A, B, C, D, E, F, G, H, I, J, K, L and M, and note that A and M are adjacent in the circle. On her first move, she flips glasses {A, B, C}. On her second move, she shifts over by one and flips glasses {B, C, D}. On her third, she shifts by one again and flips {C, D, E}. She continues this until {K, L, M} and then finishes with {L, M, A} and {M, A, B}. This way, she has flipped each unique adjacent triplet exactly once.

When she has done this, every glass will have been flipped exactly three times. For example, glass D gets flipped when she flips {B, C, D}, {C, D, E}, and {D, E, F}, and then never again. Because every glass gets flipped an odd number of times, they will all end in the upright position.

We’d love to hear from you! E-mail us at games@sciam.com to share your experience.