How to find the order of a Rubik's cube algorithm?

For example, the algorithm $R U R' U'$ has an order of $6$, that is, repeat the algorithms $6$ times to return to the original position. How would I go about finding the order of any other algorithm?


Just in case you just want an easy calculator (just by inputting in the algorithm in written notation and getting the result) for the 2 $\times$2$\times$2 - 5$\times$5$\times$5, see Michael Gottlieb's Online Order Calculator. (Note: You must input the algorithm with prime symbols in the font like this: R U R' U'. Also, this notation is SiGN notation for the $3\times3\times3$.) You can also use CubeTwister.

But if you want to find it by hand (use a physical cube),

  • Label the corners 1 - 8 and the edges 1-12. Learn about cycle notation and permutations (specifically, cycle structures/cycle classes).
  • The order of an algorithm is defined as:

LCM(

length corner cycle_1 $\times C_1$,length of corner cycle_2 $\times C_2$, ... , length of corner cycle_$m \times C_m$

,

length of edge cycle_1 $\times E_1$, length of edge cycle_2 $\times E_2$, ... , length of edge cycle_$n \times E_n$

),

(We take the Least Common Multiple of the lengths of cycles, because when we execute an algorithm which generates a $k$-cycle exactly $k$ times (and not until then), it will return all pieces in the $k$-cycle to the identity permutation.)

Where:

  • There are $m$ disjoint corner cycles and $n$ disjoint edge cycles.
  • 1-cycles count as cycles for piece orientation.
  • Each and every $C_i$ has a value of 1 if its corresponding corner cycle's orientation sum is 0 (mod 3) or a value of 3 otherwise.
  • Each and every $E_j$ has a value of 1 if its corresponding edge cycle's orientation sum is 0 (mod 2) or a value of 2 otherwise.

Important note:

  • Michael Gottlieb's solver doesn't display duplicate cycle lengths to display to the user as the work. For example, if a corner cycle class is a two 2-cycle and a 3-cycle ({2,2,3}, and the edge cycle class is a 5-cycle, 3-cycle, and two 2-cycle ({5,3,2,2}), it would just show the LCM[{2,3,5}] and not the full LCM[{2,2,3,5,3,2,2}].)

In order to determine the orientation sum of corners and edges, obviously you need to establish an orientation convention.

  • One corner orientation convention (assuming that your cube has the Rubik's color scheme) is, when holding the cube so that the white face is on top and the yellow face is on bottom, all corners whose stickers are white OR yellow in the top OR bottom faces are correctly oriented. They are twisted otherwise. Just visualize in which direction they are rotated. If a corner is twisted clockwise, assign that corner an orientation value of 1. If a corner is twisted counterclockwise, assign that corner a value of 2. If a corner is not twisted, assign it an orientation value of 0.
  • One edge orientation convention is to have the same condition on the eight edges which have a white or yellow sticker. That is, if, say, the green-and-white edge is in the top face, and its white sticker is in the top face, it's oriented. If the green and white edge is neither in the top or bottom face (in the E-layer), if it can be put there with some combination of the moves {L,L',R,R',U,U',U2,D,D',D2} and its white sticker is in the top face, then it's correctly oriented. Assign that edge an orientation value of 0. Otherwise assign that edge an orientation value of 1.
  • For the remaining four edges (which have neither white nor yellow stickers), if when they are moved into the U or D faces (again, with some combination of the moves {L,L',R,R',U,U',U2,D,D',D2} ), if the color of its sticker in the U OR D face matches the color of the front OR back face, then it's correctly oriented. Assign it an orientation value of 0. Otherwise assign it an orientation value of 1.

Example

After labeling the corners 1-8, labeling the edges 1-12, apply R U R U to a solved cube.

  • The cycle structure you should get for the corners is a 5-cycle whose corner orientation sum is equivalent to $0 + 0 + 0 + 2 + 2$ (mod 3) $= 1$ (mod 3). So $C_1$ has a value of 3.
  • There is a corner in a 1-cycle (which still counts as a cycle in this context) which is twisted counterclockwise: 2 (mod 3). So $C_2$ has a value of 3.
  • The cycle structure you should get for the edges is a 7-cycle whose orientation sum is $0 + 0 + 0 + 0 + 0 + 0 + 0$ (mod 2) $= 0$ (mod 2). So $E_1$ has a value of 1.

Therefore, LCM($5\times3$,$1\times3$,$7\times1$) = LCM(15,3,7) $=15 \times 7 = 105$.