Please excuse any errors in terminology or notation, I am neither a mathematician nor do I play one on TV. I'm pretty sure this is a known problem, probably named, but I lack the background knowledge to even know where to start. All the searching I've done has gotten me advice on how to rotate my mattress, and information on different cycles -- carnot, nitrogen, biogeochemical, etc.

You're supposed to rotate and flip a mattress so that your head rests on one end 1/4 of the time. Let's label the mattress so that it has a top and a bottom, and a north side and a south side:

|       |

|       |
|       |
|       |
|       |

There are four states the mattress can be in: {TN, TS, BN, BS}. To flip a mattress exchanges (T,B), to rotate it exchanges (N,S). There is no combination of flipping and rotation that when continuously repeated will visit all the states -- if you flip the (N,S) state remains the same; if you rotate the (T,B) state remains the same; if you flip and rotate you still flip-flop between two states.

If I'm not mistaken the number of states you can achieve by cycling through substates with degrees $m, n, ...$ is $LCM(m, n, ...)$. What is the name of this property, and the fact that this will enumerate all states iff $m, n, ...$ are all co-prime?

  • $\begingroup$ Really, we'd need to add the E,W directions. Then each operation inverts two pairs and leaves one pair alone. The same operation twice inverts the same pairs twice, so you're back to the start. Two different operations inverts one pair twice, and two pairs once, so it's equivalent to whatever single operation was excluded. Three different operations inverts each pair twice, leaving you back to where you started. Four or more operations can't all be different, so it's just a convoluted combination of one to three operations. $\endgroup$
    – MichaelS
    Commented Mar 15, 2016 at 13:21

3 Answers 3


The rotations of the mattress can be represented by an algebraic structure called a group. This group in particular is called the Klein four-group and is isomorphic to the direct product of two copies of $\mathbb Z / 2\mathbb Z$. (One of those copies is the exchange (T,B), and the other is (N,S)). The group has the property that every operation (except for the trivial "do nothing" operation) has order $2$, i.e., any operation performed twice will bring the mattress to its original state.

If all the elements of a group can be attained by repeatedly applying one operation $g$, the group is said to be cyclic and can be generated by $g$. In the case of the mattress, since no operation has order 4, the group is not cyclic. It is generated by the two flips (T,B) and (N,S), but not by a single flip.

The result you are wondering about with the more general case of the direct product of $\mathbb Z / m\mathbb Z$ and $\mathbb Z / n\mathbb Z$ (i.e., "cycling through substates $m$ and $n$") is described in the Wikipedia article on the direct product of groups. In short, $\mathbb Z / m\mathbb Z \times \mathbb Z / n\mathbb Z$ is cyclic and generated by $(1,1)$ if and only if $\gcd(m,n) = 1$.

(thank you to @pjs36 for pointing out the missing critical terms!)

  • 10
    $\begingroup$ While this is all true (and lovely!), I just want to point out that in the succinct group theoretic terminology, one might say that "The group of symmetries of a mattress is not cyclic, that is, not generated by a single symmetry." $\endgroup$
    – pjs36
    Commented Mar 15, 2016 at 3:09

I can make a suggestion. Let us call this season Spring. So write the word Spring in permanent marker under where your head goes. In three months, put some other edge in that position, and write the word Summer there. Three months later, one of the edges not used yet, and write Autumn. Three months later, Winter.

After that, every three months, search for the corner that has the upcoming season.

If you move between the North and South hemispheres, buy a new mattress.

If you don't want to use marker, maybe embroidery. Cross-Stitch.

  • 5
    $\begingroup$ This is good practical advice but the OP is asking about a series of operations to be used, every three months, to conduct the search. If you are looking for Spring, there is no turning-flipping operation that is guaranteed to eventually bring Spring into the proper position. This is why mathematicians are often awake all night. $\endgroup$ Commented Mar 15, 2016 at 5:20
  • 1
    $\begingroup$ @A.I.Breveleri I assume there's some fancy mathematical name for the fact that you can't inspect the word written at the face-up foot of the bed. $\endgroup$
    – Random832
    Commented Mar 15, 2016 at 5:45

There is another symmetry operation possible, which is flipping over the long side. This exchanges both (T,B) and (N,S). The mattress has a D2H point group symmetry.

  • $\begingroup$ by "the long side" do you mean the mattress diagonal? But how does this answer the question anyway? Genuinely interested in your response! $\endgroup$
    – AndJM
    Commented Apr 5, 2019 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .