← Isaac Lee

Why repeating moves always brings the cube back

Speedcubing · Math

Claim: when starting with a solved cube, repeating the same sequence of moves eventually returns the cube to the solved state.

Most people in the cubing community generally know this to be true, but I was delighted to hear that there was a mathematical proof.

Also, there is a good chance that you have seen a video of a person doing the same two moves on a cube, and it magically gets solved. This is a very common myth, and from this proof we will know that the person who created the video started from a solved cube and scrambled it with those same moves.

1. Let's first show that there are finitely many scrambles of the cube

The easiest way to do this does not require an exact number of possible scrambles of the cube, since all we need to do is show that it is finite.

If we think of the cube as having 54 stickers (6 sides, 9 on each side), then we have

54! / (9!)6

possible orderings of the 54 stickers. We divide by (9!)6 because there are 6 colors with 9 stickers per color, and shuffling stickers of the same color among themselves doesn't change anything.

As a side note, if you are a fellow cuber, it should be obvious that we are overcounting the number of scrambles because many of the orderings we included are not possible on a cube. Again, the focus is the fact that the number is finite.

2. Let's introduce some definitions

Let m be a single move on the cube, and let M be the sequence of single moves m that we would like to repeat.

m is one of the following: { R, L, U, F, D, B, R', L', U', F', D', B' }, where each letter corresponds to turning that side clockwise (R: right, L: left, U: up, F: front, D: down, B: back) and the prime means counterclockwise.

M can be any sequence of these moves. One of the most popular is R U R' U', also known as the "sexy move" (I'm not joking), which takes 6 repetitions to go back to the solved state.

Let C be the set of all possible scrambles of the cube. Let N = |C| be the number of all possible scrambles, which we have shown to be finite.

Let P be some scramble of the cube, where P is an element of C.

Let's define the function f(P) as the result of doing the sequence of moves M on P. We know that f: C → C.

Let's also use the notation f2(P) to mean f(f(P)), which means doing M twice, f3(P) to mean doing M 3 times, and so on. f0(P) means doing M 0 times, so nothing changes on the cube.

Let's call the solved state of the cube S. We want to prove that

fn(S) = S for some n ≥ 1.

3. Now let's show that any sequence of moves can be undone

Any single turn can obviously be reversed. Do the move R, then R' to reverse it.

Now let's say M is m1, m2, …, mt. To undo the sequence, we do mt', mt−1', …, m1'. This is like a stack data structure, where the last in is first out.

Let's call this undo sequence M', and let the function g: C → C mean performing M'.

So we know that g(f(P)) = P for any scramble P. It follows that

gk(fk(P)) = P, and gj(fk(P)) = fk−j(P) for any j ≤ k.

4. Putting it all together

Now the more fun part: let's actually do M, N times.

We start at f0(S) = S, then f1(S), f2(S), …, fN(S). We have visited N + 1 scrambles, because the exponents go from 0 to N. But there are only N unique scrambles of the cube, since |C| = N.

By the pigeonhole principle, there exist integers 0 ≤ j < k ≤ N such that fj(S) = fk(S). In other words, doing M j times and k times results in the same scramble.

Now take fj(S) = fk(S) and apply the function g, j times, to both sides. That gets us to

S = fk−j(S).

Notice that we really need step 3 here. Without being able to undo moves, pigeonhole would only tell us the cube eventually repeats some scramble, not that it gets back to S.

And since j < k, we know that k − j ≥ 1, so we really did do M at least once.

So in conclusion, doing M (k − j) times gets us back to the solved state!

As a side note, you might have noticed that the cube being solved does not actually change anything. We have proven that doing the same moves returns the cube to the starting state. Whether that starting state is solved or not does not matter!