# Proving the repeatedness in the sequence of moves for a Rubik's cube

I was trying to reason out in Rubik's cube why any specific set of moves works, like:

1. Showing that applying the sequence of moves $$\{R,D,R',D'\}$$ $$6$$ times will restore the cube back to originally it was. Symbols have the usual meaning.
2. Similairly like the moves $$\{M_{xy}, M_{xz}\}$$ applied $$12$$ times we get the cube restored back to originally it was, where $$M_{xy}$$ denotes moving the middle layer (which is between top and bottom side) in clockwise direction with respect to an observer seeing it from bottom layer. $$M_{xz}$$ represents middle layer which is between the right and left sides of the cube and moving it in clockwise direction with respect to right side.

Any hint/ideas as to how to prove both without much going deep into group theory ?

Starting from a completed cube, each time you perform your set of moves, you either get a state of the cube that you have seen before, or one that you haven't had before. As there are only finitely many states (even though this is a very big number), you must at some point get to a state you've had before. (Otherwise we'd always be finding a new state so there'd be infinitely many.)

Let's number the steps: 0 is the complete state we start from, applying the moves once gets you to 1, then again to 2, etc.

Then as we saw before, at some step $$n$$, we get a state we've seen before, say state $$m$$ (where $$m < n$$). By applying the reverse of the set of moves from here, we get state $$m-1$$ which is also state $$n-1$$. Since this was the first repeated state, we have to have $$m = 0$$, else $$n-1$$ would be an earlier repetition.

(By reverse, for instance if we had Down Left we'd do Left' Down', so taking moves back to front and flipping them from clockwise to counter clockwise.)

That means that after $$n$$ of the sets of moves you already had, we get the original state.

Group theory can help you formalise this, which can help to get the specific numbers (6, 12) for this and potentially other sets of moves.

• I understand the first part , can you explain with group theory details on how 6,12 is there ? Of repeating Commented Sep 7, 2022 at 2:14
• That's to do with the order of an element in a group, and for this particular group of move sequences and the elements RDR'D' and the middle one, the order is 6 and 12. All groups have an identity element e, which when you multiply an element by the identity it gives back the element. So for all $g$ in a group, $g \cdot e = e \cdot g = g$, and in a finite group all elements have an "order" which is the smallest positive integer $k$ such that $g^k = e$. For example if you look at integers mod 5 under multiplication, $2^4 = 16$ which is the same as 1 mod 5, and so the order of 2 is 4. Commented Sep 8, 2022 at 3:14
• I see understood Commented Sep 10, 2022 at 18:14

Maybe I'm misunderstanding but if your question is "Why does doing the same set of moves repeatedly always get the cube back to its original position?" then the answer is pretty simple.

The cube group is finite. I mean, it's really big with 43 quintillion elements but that's still finite. That means that when you keep applying your set of moves, EVENTUALLY there will be no new states left and you'll land on a state already seen.

Furthermore, we know that this state (the first state you land on that you've already seen) will be your original state. Why? In a nutshell, it's because moves are invertible. Meaning if you undo a move, you're guaranteed to go to your previous state, and not a new one.

Consider the following. Say you have your set of moves, and you start in position A. Then by applying your set of moves, we are now at B. Then applying the moves again, now we're at C, and so on:

$$A \rightarrow B \rightarrow C \rightarrow \ldots$$

Then eventually we'll get to the state right before we see a repeat, let's call in Z. Then Z MUST point to A. Because if it didn't, and pointed to another state (say) B, then both A and Z point to B. This is impossible, as each state can have at most one thing pointing to it. So we know the following must be the case:

$$A \rightarrow B \rightarrow C \rightarrow \ldots \rightarrow Z \rightarrow A$$

If your question is "Why do these particular algorithms repeat in 6, 12 moves?" then I don't have a great answer for you... just do it and see how long it takes lol!

There are some tricks though. For example take the algorithm $$RU$$. This repeats after 63 times. But if we do $$RU$$ only 7 times, we see that all the edges are back to their original spots. And if we do $$RU$$ two more times (so 9 in total) we see all the corners are back to their original spots. So $$RU$$ will repeat in $$7 \times 9 = 63$$ iterations.

Some other fun facts for you. The number of times you need to repeat an algorithm to get it back to the original state is called the order of the algorithm. So the order of $$RU$$ is 63. It turns out the maximum order of any algorithm is 1260. That means, that no matter what algorithm you pick, and you keep doing it, you'll end up at your original state in 1260 iterations or fewer.

Here is a website I found with how many algorithms have each order: https://www.jaapsch.net/puzzles/cubic3.htm#p34

It turns out that the most common order is 60, with about 10.6% of all elements of the cube group.