The moves of a Rubik's cube form a nonabelian group $G$ of permutations of its 48 movable stickers, generated by six quarter turns; only turns of opposite faces commute. A move's order is the least common multiple of its cycle lengths on the cubies, tripled for a twisted corner cycle and doubled for a flipped edge cycle: 105 for $RU$, 6 for $R U R' U'$, at most 1260. A position is reachable exactly when the corner and edge permutations have equal parity, the corner twists sum to 0 mod 3 and the edge flips to 0 mod 2 (necessity proved here, sufficiency by a Schreier-Sims computation). So $\lvert G \rvert = 43{,}252{,}003{,}274{,}489{,}856{,}000$, one random assembly in twelve. Twenty face turns always suffice (Rokicki and coauthors, 2013); only a lower bound of 18 is proved here.
A Rubik's cube in any position can be returned to its solved state, and a solved cube can be scrambled into any of a very large number of positions. Several facts about it are familiar to anyone who has taken one apart.
- A cube reassembled at random usually cannot be solved.
- A single corner piece twisted in place makes it unsolvable, and so does a single edge piece flipped over, or two edge pieces swapped.
- Repeating any fixed sequence of turns long enough always brings the cube back to where it started, sometimes only after more than a thousand repetitions.
A twisted corner is beyond repair although every corner can be moved anywhere, and some sequences must be repeated a great many times. This article gives the reason for both.
Each of these facts is a theorem about a group. The elements are the moves of the cube, two moves count as equal when they have the same effect, and the operation is doing one move after another. This group is generated by six quarter turns, it is far from abelian, and it has exactly 43,252,003,274,489,856,000 elements.
First we build the group as a group of permutations of the cube's stickers, and see which turns commute. Then we compute the orders of some moves from how they cycle the pieces. Next we prove the three conditions a reachable position must satisfy, and use them, with a computer check, to count the positions. Finally we look at subgroups, at the commutators and conjugates that solvers use, and at the proof that 20 turns always suffice.
This is the third article of Groups. It assumes the definition of a group and of the order of an element (Groups: Definition and First Examples), and uses Dihedral Groups for comparison. The cube is not in the course text; the class sessions used it as a running example of a nonabelian group alongside the dihedral groups. A standard mathematical account is Joyner's (1997, Chapter 10; published in expanded form as Adventures in Group Theory). The record of the search for the shortest solutions is Rokicki, Kociemba, Davidson and Dethridge (2013). Every number below is computed by the script for this article, which models the cube from scratch.
The statements below are of four kinds, and the text says which is which.
- Proved here: that the moves form a group; that the three conditions of the theorem on reachable positions are necessary, with the twist and flip amounts of each turn read from the model; the count of the assemblies that satisfy them; and the lower bound of 18 turns, with the script's count of sequences.
- Computed by the script, not proved by hand: the order of the group by the Schreier-Sims algorithm, on which the sufficiency of the three conditions rests; the orders of the larger subgroups in the table (the orders 4, 16 and 8 are proved by hand); the cycles and orders of particular moves, and the cubies and facets they move; which pairs of face turns commute, and how $FR$ and $RF$ differ; the agreement of the rule for reading an order with the facet permutation on 200 random moves, and of the rule for adding twists and flips on 300 random positions; that 1260 is the largest order; the count of reduced sequences of at most 17 turns; that the stated 20-turn sequence produces the superflip, and that the superflip commutes with each quarter turn.
- Cited, not proved: Singmaster's statement of the largest order; Joyner's outline of a proof by hand that the three conditions are sufficient; Reid's result that the superflip needs 20 turns; and the theorem of Rokicki and coauthors that 20 turns always suffice, with their subgroup and its number of cosets.
- Used from later articles: the parity of a permutation, the count $n!/2$ of even permutations, the order of a product of disjoint cycles and the relabelling rule for conjugates (Symmetric Groups and Permutations); the rule $(ab)^{-1} = b^{-1}a^{-1}$ and the finiteness of orders in a finite group (Basic Properties of Groups); subgroups, generators and the center (Subgroups and Cyclic Groups); homomorphisms (Group Homomorphisms and Isomorphisms); Lagrange's theorem, cosets and the orbit-stabilizer relation (Cosets and Lagrange's Theorem); and normal subgroups (Normal Subgroups and Quotient Groups), named only as where conjugation is studied further.
Pieces, stickers and moves
The cube is built from 26 visible pieces, called cubies.
- The 6 center cubies, one in the middle of each face, have one sticker each and only turn in place. They fix the color of each face, and the cube is always held with the same centers up, front and so on.
- The 8 corner cubies have three stickers each.
- The 12 edge cubies have two.
That makes $8 \cdot 3 + 12 \cdot 2 = 48$ movable stickers, called facets, in 48 positions on the surface.
The faces are named Up, Down, Left, Right, Front and Back. In the standard notation, introduced by David Singmaster (Joyner, 1997, §4.5), the letters $U$, $D$, $L$, $R$, $F$, $B$ also denote the quarter turns. $U$ turns the up face 90 degrees clockwise as seen when looking at that face from outside the cube. Each of $D$, $L$, $R$, $F$ and $B$ likewise turns its own face 90 degrees clockwise as seen from outside the cube, looking at that face. A cubie is named by the faces it touches: the corner $UFR$ sits where the up, front and right faces meet.
Moves as permutations. A face turn carries the facet in each of the 48 positions to some position, possibly the same one, and different facets to different positions. So it is a permutation of the 48 facet positions. A move is any sequence of face turns, and it too acts as a permutation of the facet positions. Two sequences are regarded as the same move when they produce the same permutation. On a real cube this is the same as producing the same pattern from the solved cube, because every facet can be identified by its colors. The cubies have different sets of colors, and each facet is the one of its cubie's colors that it shows. Looking at the cube therefore tells exactly where every facet went.
Each quarter turn moves 20 facets in five cycles of length 4. Three are cycles of corner facets (the 4 corners of the turning layer have 12 facets) and two of edge facets (the 4 edges have 8). The first panel of the figure below shows them for $U$.
The group. Let $G$ be the set of all permutations of the 48 facet positions produced by sequences of face turns, with "do one move, then the other" as the operation. It is a group, and each axiom has a plain meaning on the cube.
- Closure: doing one sequence of face turns and then another is a sequence of face turns.
- Associativity: composition of permutations is associative.
- Identity: the empty sequence, which leaves every facet in place, written $1$.
- Inverses: a quarter turn $X$ has order 4, since four quarter turns of a face restore it, so $X^{-1} = X^3$ is again a sequence of face turns. The inverse of a sequence $X_1 X_2 \cdots X_k$ is $X_k^{-1} \cdots X_2^{-1} X_1^{-1}$: undo the last turn first. This is the rule $(ab)^{-1} = b^{-1}a^{-1}$, proved for every group in Basic Properties of Groups.
The inverse quarter turn $X^{-1}$ is written $X'$ and turns the face counterclockwise; the half turn $X^2$ is written $X2$. The group is said to be generated by $U, D, L, R, F, B$, since every element is a product of these and their inverses. Generators are discussed further in Subgroups and Cyclic Groups.
Reading left to right. Cube notation is read in the order the turns are made: $RU$ means "turn $R$, then turn $U$". So in this article the product $MN$ of two moves means $M$ first, then $N$. This is the opposite of the convention for composing functions, where $f \circ g$ applies $g$ first. This unit uses the function convention for Dihedral Groups and Symmetric Groups and Permutations. If $m$ and $n$ denote the permutations of facet positions produced by $M$ and $N$, then $MN$ produces $n \circ m$. The choice does not affect whether the axioms hold, since associativity, the identity and inverses do not depend on which factor is written first. It keeps the article consistent with every book and website about the cube.
Example (the inverse of $RU$). In cube notation the inverse of the move $RU$ is $U' R'$, not $R' U'$. The move $RU$ turns $R$ and then $U$, so undoing it must undo the $U$ turn first: $R U U' R' = R R' = 1$ and $U' R' R U = 1$. The common first answer $R' U'$ undoes the turns in the order they were made, which is a different move; the script confirms that $U' R'$ restores the cube and $R' U'$ does not.
A model of the cube. The script for this article builds the cube from coordinates rather than from a hand-drawn diagram. Each cubie sits at a point with coordinates in $\{-1, 0, 1\}$, with $x$ pointing right, $y$ up and $z$ toward the viewer. Each facet is a pair (cubie position, outward direction). A quarter turn of the face whose outward direction is $a$ rotates every facet of that layer through $-90$ degrees about $a$, which is clockwise as seen from outside. This produces the six generators as permutations of 48 numbered facets, and every claim below is checked by computing with them.
Not abelian, but partly
With the group defined, the first fact about it is that the order of the turns matters. Turning the front and then the right face is not the same as turning them in the other order: $FR \neq RF$. The model shows how they differ. The up-facing sticker of the $UFR$ corner ends on the right face under $FR$, but on the back face under $RF$. Altogether 18 of the 48 facets end in different places. So $G$ is nonabelian.
Some pairs of moves do commute. Turns of opposite faces, such as $U$ and $D$, move disjoint sets of facets. Moves that touch disjoint sets of facets commute, just as disjoint cycles commute. The proof is short. Let $M$ move only facet positions in a set $A$ and $N$ only positions in a set $B$, with $A$ and $B$ disjoint. As permutations, $M$ carries $A$ onto $A$ and fixes every position outside it, and $N$ does so for $B$. A position in $A$ is carried by $M$ to a position in $A$, and $N$ fixes both, so $MN$ and $NM$ both send it where $M$ does. A position in $B$ is carried by $N$ to a position in $B$, and $M$ fixes both, so $MN$ and $NM$ both send it where $N$ does. A position in neither set is fixed by both products. The script finds that the only commuting pairs of distinct face turns are the three pairs of opposite faces, $\{U, D\}$, $\{F, B\}$ and $\{R, L\}$. Every two adjacent faces share a row of cubies, and their turns do not commute.
Example (half turns). $U$ commutes with the half turn $D2$ but not with the half turn $R2$. It commutes with $D2$ because $D2$ moves only facets of the down layer, which $U$ never touches. It does not commute with $R2$: the two layers share the cubies $UFR$, $UR$ and $UBR$, and the script confirms that the two orders differ.
Orders of moves
The opening claimed that repeating a move always returns the cube to its start, sometimes only after a thousand repetitions. The number of repetitions a move needs is its order. The order of a move $M$ is the least positive $k$ with $M^k = 1$ (Groups: Definition and First Examples). Every move has finite order, because $G$ is a finite group of permutations. The general fact that every element of a finite group has finite order is proved in Basic Properties of Groups. A quarter turn has order 4 and a half turn order 2. Products of turns can have much larger orders, and their orders can be read from what they do to the cubies.
How to read an order. Here is the idea in one sentence. The cubies run on separate clocks, one for each cycle, and the move's order is the first time all the clocks agree. A move permutes the corner cubies among the corner positions and the edge cubies among the edge positions, and it may also turn a cubie as it moves it.
- Corners. Follow the corner cubies in one cycle of length $L$. After $L$ repetitions of the move, each of them is back in its own position, turned by the same total amount. That amount is the net twist of the cycle, 0, 1 or 2 thirds of a full turn. If the net twist is 0, the facets of these corners return after $L$ repetitions. Otherwise they need $3L$, since three trips around the cycle add up the twist to a whole turn.
- Edges. Follow the edge cubies in one cycle of length $L$. After $L$ repetitions each of them is back in its own position, and each has been flipped the same number of times modulo 2, the net flip of the cycle, 0 or 1. If the net flip is 0, the facets of these edges return after $L$ repetitions. Otherwise they need $2L$, since two trips around the cycle flip each edge twice.
- Cubies that stay in place. A corner twisted in place, or an edge flipped in place, is a cycle of length $L = 1$ with nonzero net twist or flip, and needs 3 or 2 repetitions.
The total is the same for every cubie of a cycle for the following reason. The amount by which a move twists or flips a cubie depends only on the move and on the position the cubie starts in. The proof of the theorem below shows this for a single turn, and a move is a sequence of turns. In $L$ repetitions each cubie of the cycle visits every position of the cycle once, so each collects the same amounts in a different order.
The order of the move is the least common multiple of these numbers over all its cycles, by the rule for the order of a product of disjoint cycles (Symmetric Groups and Permutations). The script compares this rule with the order of the facet permutation for 200 random moves and finds agreement in every case.
The move $RU$. It moves five corners in a cycle ($UBL$, $UFL$, $DBR$, $DFR$, $UBR$ in some order) that returns twisted, so their 15 facets form one cycle of length 15. It twists the corner $UFR$ in place, a facet cycle of length 3. It moves seven edges in a cycle that returns unflipped, giving two facet cycles of length 7. Altogether 32 facets move, and
$$\lvert RU \rvert = \operatorname{lcm}(15, 3, 7) = 105.$$
The powers of $RU$ show the separate clocks running at once:
| Power | Corners home | Corners home and untwisted | Edges home |
|---|---|---|---|
| $(RU)^5$ | 8 | 2 | 5 |
| $(RU)^7$ | 3 | 2 | 12 |
| $(RU)^{15}$ | 8 | 8 | 5 |
| $(RU)^{35}$ | 8 | 2 | 12 |
| $(RU)^{105}$ | 8 | 8 | 12 |
After 35 repetitions every cubie is back in its place, but six corners are twisted; only at the 105th does the cube return to its starting state. The move $FR$ has the same order, 105, and so does $RF$. In fact $RF$ is a relabelled version of $FR$: $F'(FR)F = RF$. Elements related in this way, called conjugates, always have the same order (the reason is given below).
The move $R U R' U'$. This sequence, popular with speedcubers, moves only 7 cubies and 18 facets. It exchanges two pairs of corners, and both pairs come back twisted. It moves three edges in a cycle that comes back unflipped.
Example (the order of $R U R' U'$). The order of $R U R' U'$ is 6, and it can be read from that description alone. Three repetitions put every edge back in its own position, since the edges travel around a 3-cycle. Two put every corner back in its own position, ignoring twists, since a second exchange swaps each pair back. Neither number is the order of the move, because after two repetitions the corners are home but twisted. Each twisted pair of corners needs $3 \cdot 2 = 6$ repetitions, so its six facets form a cycle of length 6. The three edges need 3, giving two facet cycles of length 3 (the second panel of the figure). So the order is $\operatorname{lcm}(6, 3) = 6$. Its square leaves every corner in place, four of them twisted, and moves three edges. Its cube restores every edge and leaves the two pairs of corners exchanged. Its inverse is $(R U R' U')^{-1} = U R U' R'$, by reversing the sequence and inverting each turn, and it has the same order 6.
The largest order. The move $R U2 D' B D'$ has order 1260.
- On the corners it has a cycle of length 5 and a cycle of length 3, both twisted, which need 15 and 9 repetitions. So the corners need $\operatorname{lcm}(15, 9) = 45$.
- On the edges it has a flipped cycle of length 7 (14 repetitions), a flipped cycle of length 2 (4 repetitions) and an unflipped cycle of length 2 (2 repetitions). So the edges need 28.
Then $\operatorname{lcm}(45, 28) = 1260$. Singmaster stated that 1260 is the largest order of any element of the cube group (Joyner, 1997, Chapter 5). The script confirms it. It runs through every way of splitting the 8 corners and the 12 edges into cycles, with every choice of which cycles are twisted or flipped. It keeps those allowed by the three conditions proved below, and finds that the largest least common multiple is 1260.
Twisting and flipping clearly matter to orders. Those three conditions, proved next, say exactly which twists and flips a move can produce.
The three invariants
A position of the cube is described by four pieces of data:
- the corner permutation $\sigma$, a permutation of the 8 corner positions, telling which corner cubie sits where;
- the edge permutation $\tau$, a permutation of the 12 edge positions;
- the twist of each corner cubie, a number in $\mathbb{Z}_3$;
- the flip of each edge cubie, a number in $\mathbb{Z}_2$.
To define twists and flips, give each position a reference facet.
- For a corner position, it is the facet on the up or down face.
- For an edge position, it is the facet on the up or down face if it has one, and otherwise (for the four edges of the middle layer) the facet on the front or back face.
Every cubie likewise has a reference sticker, the one that sits on the reference facet of its home position when the cube is solved. The twist of a corner cubie is the number of clockwise thirds of a turn (as seen from outside the corner) from the reference facet of its current position to the facet carrying its reference sticker. The flip of an edge cubie is 0 if its reference sticker is on the reference facet of its current position and 1 otherwise. In the solved cube every twist and every flip is 0.
The twists of the eight corners form an element of the direct product $\mathbb{Z}_3^8 = \mathbb{Z}_3 \times \cdots \times \mathbb{Z}_3$, and the flips an element of $\mathbb{Z}_2^{12}$ (direct products). If the cube is taken apart and reassembled, every corner can go to any corner position in any of 3 orientations, and every edge to any edge position in either of 2. So there are
$$8! \cdot 3^8 \cdot 12! \cdot 2^{12} = 519{,}024{,}039{,}293{,}878{,}272{,}000$$
possible assemblies. Each is determined by its data $(\sigma, \text{twists}, \tau, \text{flips})$, and each determines where every facet is. The theorem below says which of them can be reached by turning the faces.
Theorem. A position of the cube can be reached from the solved cube by face turns if and only if
- $\sigma$ and $\tau$ have the same parity (both even or both odd);
- the twists of the corners add up to 0 in $\mathbb{Z}_3$;
- the flips of the edges add up to 0 in $\mathbb{Z}_2$.
This is the "second fundamental theorem of cube theory" in Joyner's notes (1997, Theorem 202), where it is credited to Ann Scott. Even and odd permutations are defined in Symmetric Groups and Permutations. A permutation is even or odd according as it is a product of an even or an odd number of transpositions, and the sign of a product is the product of the signs.
Here is the plan of the proof. The three conditions are invariants: quantities that no face turn can change. Necessity is proved by checking each of the six turns against each condition. Sufficiency is harder, and is settled by a count together with a computer calculation of $\lvert G \rvert$.
Proof that the conditions are necessary. The solved cube satisfies all three conditions, and every reachable position is reached by a sequence of face turns. So it suffices to show that each face turn preserves all three.
(1) A quarter turn $X$ moves the four corner cubies of its layer in a 4-cycle of corner positions and the four edge cubies in a 4-cycle of edge positions. A 4-cycle is odd. So $X$ changes the parity of the corner permutation and of the edge permutation together: if they were equal before the turn, they are equal after it.
(2) Consider a corner cubie in position $p$ and a quarter turn $X$ that moves it. The turn rigidly rotates the cubie into its new position $X(p)$, and rotations preserve the cyclic order of the three facets around a corner. So the cubie's twist increases by an amount $t_X(p)$ that depends only on $X$ and $p$. It is the number of clockwise thirds from the reference facet of $X(p)$ to the facet that the turn carries the reference facet of $p$ onto. Computing these amounts from the model gives:
| Turn | Increases of twist for the 4 corners moved | Total |
|---|---|---|
| $U$, $D$ | 0, 0, 0, 0 | 0 |
| $F$, $B$, $R$, $L$ | 1, 1, 2, 2 | 6 |
A turn of the up or down face keeps every reference sticker in the up or down face, so it twists nothing. A turn of a side face changes the sum of the twists by 6, which is 0 in $\mathbb{Z}_3$. So the total twist stays 0.
(3) Consider an edge cubie in position $p$ and a quarter turn $X$ that moves it. The turn rigidly carries the cubie into its new position $X(p)$, and the two facets of $p$ onto the two facets of $X(p)$. So the cubie's flip changes by an amount $f_X(p)$ that depends only on $X$ and $p$. It is 0 if the turn carries the reference facet of $p$ onto the reference facet of $X(p)$, and 1 if it carries it onto the other facet. Computing these amounts from the model: the quarter turns $U$, $D$, $R$ and $L$ flip no edges with the chosen reference facets. $F$ and $B$ flip all four edges they move, changing the total flip by 4, which is 0 in $\mathbb{Z}_2$. $\blacksquare$
The script checks the lemma behind (2) and (3), that orientations add in this way, on 300 random positions, and checks the three conditions on each.
Example (twisted cycles come at least in pairs). No move has exactly one twisted corner cycle, with every other corner returning untwisted. The move of order 1260 had two. Starting from the solved cube, the net twist of a cycle is the sum of the twists that one application of the move gives the corners in it. So the net twists of all the cycles add up to the total twist of the position the move produces, which is 0 by condition 2. One nonzero net twist with all the others 0 would add up to 1 or 2. Twisted corner cycles come at least in pairs. Flipped edge cycles come in even numbers: the net flips of all the edge cycles add up to the total flip of the position, which is 0 in $\mathbb{Z}_2$ by condition 3, and each flipped cycle contributes 1. Here a corner twisted in place, or an edge flipped in place, counts as a cycle of length 1. The script's search for the largest order uses exactly these restrictions.
Proof that the conditions are sufficient. This half is not proved by hand here. Joyner (1997, §10.2) outlines a constructive proof.
- He gives explicit sequences of turns that twist exactly two corners or flip exactly two edges.
- He states that moves cycling any three corners or any three edges also exist, leaving their verification and one further step as exercises.
- He argues that these moves and their conjugates reach every position satisfying the conditions.
This article instead counts, and lets a computer supply the one number the count needs. Exactly one assembly in two satisfies condition 1, one in three satisfies condition 2 and one in two satisfies condition 3, and the three conditions concern separate parts of the data. In detail:
- The corner permutation $\sigma$ may be any of the $8!$. Of the $12!$ edge permutations, exactly half are even and half odd (Symmetric Groups and Permutations proves that the even permutations number $n!/2$). So $12!/2$ choices of $\tau$ have the parity of $\sigma$.
- The twists of seven corners may be chosen freely, in $3^7$ ways, and then exactly one twist of the eighth makes the sum 0 in $\mathbb{Z}_3$.
- The flips of eleven edges may be chosen freely, in $2^{11}$ ways, and then exactly one flip of the twelfth makes the sum 0 in $\mathbb{Z}_2$.
So the number of assemblies satisfying all three is $8! \cdot (12!/2) \cdot 3^7 \cdot 2^{11}$, which is
$$\frac{8! \cdot 3^8 \cdot 12! \cdot 2^{12}}{2 \cdot 3 \cdot 2} = 43{,}252{,}003{,}274{,}489{,}856{,}000.$$
The necessity proof shows that every element of $G$ gives one of these assemblies. Different elements of $G$ give different assemblies, since an assembly determines where every facet goes. So $\lvert G \rvert$ is at most this number, with equality exactly when every such assembly is reachable. A computer calculation of $\lvert G \rvert$ from the six generators, described next, gives exactly this number, which completes the proof. It is a computer-assisted proof, resting on that calculation. $\blacksquare$
The order of the group
Corollary. The Rubik's cube group has order
$$\lvert G \rvert = 8! \cdot 3^7 \cdot 12! \cdot 2^{10} = 43{,}252{,}003{,}274{,}489{,}856{,}000 = 2^{27} \cdot 3^{14} \cdot 5^3 \cdot 7^2 \cdot 11.$$
Each factor has a meaning:
- $8!$ arrangements of the corners;
- $3^7$ twists, since the eighth corner's twist is forced by the other seven;
- $12!/2$ arrangements of the edges, since the parity is forced by the corners;
- $2^{11}$ flips, since the twelfth is forced.
The same factorization reappears in The First Isomorphism Theorem for Groups as kernel times image: the $8! \cdot 12!/2$ arrangements of the cubies form the image of a homomorphism, and the $3^7 \cdot 2^{11}$ moves that only turn cubies in place form its kernel.
The total is about $4.3 \times 10^{19}$, the figure given by Rokicki and coauthors (2013). A reassembled cube is solvable with probability exactly $1/12$, the fraction of assemblies that satisfy the three conditions. This is why a cube that has been taken apart and put back together at random usually cannot be solved.
Example (corners only). Suppose only the eight corners are taken out and put back at random, and the edges are left in their solved places. The chance that the cube can still be solved is one in six. With the edges solved, $\tau$ is the identity, which is even, so $\sigma$ must be even: one chance in two. The twists must add to 0: one chance in three. Flips are already 0. The script counts $8! \cdot 3^8 = 264{,}539{,}520$ corner assemblies, of which $44{,}089{,}920$ are solvable, exactly one in six.
How can a computer find $\lvert G \rvert$ when the group is far too large to list? It can be computed from the six generators by the Schreier-Sims algorithm, which the script implements. The idea is a chain of counts. The first is the number of positions to which the facet in position 0 can be carried. The second is the number of positions to which a second chosen facet can be carried by the moves that leave the first facet in place. The chain continues until only the identity is left. The counts multiply to $\lvert G \rvert$. For the cube the algorithm finds the sequence
$$24, 21, 18, 15, 12, 24, 22, 9, 20, 6, 18, 16, 14, 12, 10, 8, 6, 2,$$
whose product is 43,252,003,274,489,856,000, in agreement with the count. That the product of these orbit sizes is the order of the group is an instance of the orbit-stabilizer relation, a consequence of Lagrange's theorem. That relation belongs to the next unit and is used here without proof.
The theorem explains the facts of the opening. A twisted corner can be moved anywhere, but the sum of the twists cannot change.
- A single twisted corner violates condition 2.
- A single flipped edge violates condition 3.
- Two swapped edges with everything else solved violate condition 1, an odd edge permutation with an even corner permutation.
None of these can be undone by turning the faces.
Subgroups
What if only some of the turns are allowed? Restricting the generators gives smaller groups inside $G$, examples of the subgroups studied in Subgroups and Cyclic Groups. The script computes their orders by the same algorithm.
| Generated by | Order |
|---|---|
| $U$ | 4 |
| $U$ and $D$ | 16 |
| $U2$, $D2$, $F2$, $B2$, $R2$, $L2$ (half turns only) | 663,552 |
| $R$ and $U$ | 73,483,200 |
| $U$, $D$, $R2$, $L2$, $F2$, $B2$ | 19,508,428,800 |
| all six quarter turns | 43,252,003,274,489,856,000 |
The group generated by $U$ and $D$ has order $4 \cdot 4 = 16$. The two turns commute, so every product of $U$, $D$ and their inverses can be rearranged into the form $U^a D^b$ with $0 \le a, b \le 3$, using $U^4 = D^4 = 1$. These sixteen moves are all different. The move $U^a D^b$ acts on the facets of the up layer as $U^a$ does and on those of the down layer as $D^b$ does, and the four powers of a quarter turn act differently on its layer. So the move determines $a$ and $b$. The last subgroup before $G$ is the one used by Rokicki and coauthors (2013, §4). Its moves never twist a corner or flip an edge, and its order is $8! \cdot 8! \cdot 4!/2$. $G$ splits into $2{,}217{,}093{,}120$ copies of it, called cosets, which served as the units of their search. Every order in the table divides $\lvert G \rvert$, as Lagrange's theorem requires of the order of any subgroup of a finite group.
Example (a subgroup of order 8). The subgroup generated by $U$ and the half turn $D2$ has order $4 \cdot 2 = 8$. The two moves commute, and $U^4 = (D2)^2 = 1$, so every product of $U$, $D2$ and their inverses can be rearranged into the form $U^a (D2)^b$ with $0 \le a \le 3$ and $0 \le b \le 1$. These eight moves are all different, because $U^a (D2)^b$ acts on the up layer as $U^a$ and on the down layer as $(D2)^b$. The script's Schreier-Sims computation gives 8.
Commutators and conjugates
How do solvers fix a few pieces without disturbing the rest? They use two group-theoretic constructions constantly.
A commutator is a move of the form $M N M^{-1} N^{-1}$, such as $R U R' U'$. If $M$ and $N$ commute it is the identity, since then $M N M^{-1} N^{-1} = N M M^{-1} N^{-1} = N N^{-1} = 1$. If they overlap only a little it moves only the pieces near the overlap. Each of $R$ and $U$ moves 8 cubies, but their commutator moves 7. More delicate commutators move only three pieces, which is what a solver needs at the end of a solution, when most of the cube is already solved.
A conjugate is a move of the form $X M X^{-1}$: a setup move $X$, then $M$, then the setup undone. It does the work of $M$ on whichever pieces $X$ brought into $M$'s working area. For example, $R' D' R D$ moves the corners $DBL$, $DBR$, $DFR$ and $UFR$ (with three edges). The conjugate $U (R' D' R D) U'$ moves $DBL$, $DBR$, $DFR$ and $UBR$ instead. The setup move $U$ carries the cubie at $UBR$ into the position $UFR$, where $R' D' R D$ acts on it. A conjugate has the same cycle structure as the move it conjugates, and hence the same order. For permutations this is the relabelling rule proved in Symmetric Groups and Permutations: conjugating a cycle renames the objects in it. The equality of orders also has a direct proof. In the product of $k$ copies of $X M X^{-1}$, each inner pair $X^{-1} X$ cancels, so $(X M X^{-1})^k = X M^k X^{-1}$. This is the identity exactly when $M^k = 1$: if $M^k = 1$ it is $X X^{-1} = 1$, and if $X M^k X^{-1} = 1$ then $M^k = X^{-1} X = 1$. So the two moves have the same least such $k$. Conjugation is studied further with normal subgroups.
Example (another setup move). The conjugate $U' (R' D' R D) U$ moves the four corners $DBL$, $DBR$, $DFR$ and $UFL$. The setup move is now $U'$, which turns the up face the other way and so carries the cubie at $UFL$ into the position $UFR$. The script confirms the answer.
God's number
Every position can be solved in at most 20 turns, and some positions need all 20. This section says what is counted and where the two bounds come from; only the weaker lower bound of 18 is proved here. The distance of a position from the solved cube is the least number of face turns that reaches it, counting a quarter turn or a half turn of any face as one turn (the half-turn metric). The largest distance of any position is known among cubers as God's number. (Group theorists call it the diameter of the group's Cayley graph, the graph whose vertices are the elements of $G$, with an edge joining two elements that differ by one face turn.)
A lower bound follows from counting. Call a sequence of face turns reduced if it never turns the same face twice in a row, and never turns the second face of an opposite pair immediately before the first, where $U$, $F$ and $R$ are taken as the first faces of their pairs. (Turns of opposite faces commute, so their order can be fixed.) Every move is produced by a reduced sequence of the least possible length. To see this, take a sequence of least length producing the move. It never turns the same face twice in a row, since two consecutive turns of one face combine into a single turn of that face or cancel, which would shorten the sequence. Whenever a turn of a second face comes immediately before a turn of the opposite first face, exchange the two; they commute, so the move and the length are unchanged. Each exchange lowers by one the number of pairs of turns, adjacent or not, in which a second-face turn comes earlier than a first-face turn, so the exchanges stop. The result still has the least length, so it still never turns a face twice in a row, and it is reduced. The script counts 19,973,266,111,335,481,264 reduced sequences of at most 17 turns, fewer than $\lvert G \rvert$. Every position at distance 17 or less is produced by one of them, so some position needs at least 18 turns; Rokicki and coauthors (2013, §2) report that this counting bound was understood by 1980.
In 1995 Michael Reid showed that the superflip needs 20 turns (Rokicki et al., 2013, §2). It is the position with every cubie in place and all twelve edges flipped, which condition 3 allows since 12 is even. The superflip has order 2, since flipping every edge twice restores the cube. The script checks that it commutes with each of the six quarter turns. It therefore commutes with their inverses, which are their third powers, and so with every move, which is a product of quarter turns and inverses. So it lies in the center of $G$, the set of elements that commute with everything (Subgroups and Cyclic Groups). It is reached by the 20-turn sequence
$$U \, R2 \, F \, B \, R \, B2 \, R \, U2 \, L \, B2 \, R \, U' \, D' \, R2 \, F \, R' \, L \, B2 \, U2 \, F2,$$
which the script confirms.
The matching upper bound took three decades. Rokicki, Kociemba, Davidson and Dethridge (2013) proved that every position can be solved in 20 face turns or fewer, so God's number is 20. Their proof had three steps.
- It partitioned the $4.3 \times 10^{19}$ positions into the cosets of the subgroup in the table above.
- It reduced the work by the symmetries of the cube.
- It solved the remaining cosets with about one billion seconds of donated computer time.
Worked problems
These problems are from the course's assignment introducing groups. Each is solved in full from the results of this unit. The assignment suggests following the pieces on an online cube; here the script's model does that, and the cycles quoted below are computed by it, not derived by hand.
Problem 1. Find the order of each of the following elements of the Rubik's cube group: (a) $R^{10}$; (b) $R U R^{-1} U$; (c) $R U^{-1} F^{-1} U$.
The moves are read left to right, as everywhere in this article, and $R^{-1}$ is the turn written $R'$ above. One fact serves for (b) and (c). Suppose every facet that a move $M$ displaces lies in a cycle of the same length $L$ of the facet permutation. After $k$ repetitions a facet in such a cycle has moved $k$ steps around it, and it is back in its place exactly when $L$ divides $k$. The facets that $M$ leaves in place stay in place. So $M^k = 1$ exactly when $L \mid k$, and the order of $M$ is $L$.
(a) The order is 2. A quarter turn has order 4, so $R^4 = 1$ and $R^{10} = (R^4)^2 R^2 = R^2$, the half turn of the right face. It is not the identity, because $R$ has order 4 and not 2, and $(R^2)^2 = R^4 = 1$.
(b) The order is 5. The move $R U R' U$ carries five corner cubies around one cycle of positions,
$$UBL \to UFL \to UBR \to UFR \to DFR \to UBL,$$
with net twist 0, and five edge cubies around one cycle,
$$UL \to UR \to UF \to UB \to FR \to UL,$$
with net flip 0. The other three corners and seven edges stay in place and are not turned. So the $5 \cdot 3 = 15$ corner facets move in three cycles of length 5 and the $5 \cdot 2 = 10$ edge facets in two cycles of length 5. All 25 displaced facets lie in cycles of length 5, and the order is 5. The script confirms it directly: $(R U R' U)^k$ is not the identity for $k = 1, 2, 3, 4$, and it is for $k = 5$.
(c) The order is 7. The move $R U' F' U$ carries seven corner cubies around one cycle,
$$DFL \to DFR \to UFR \to UBR \to DBR \to UFL \to UBL \to DFL,$$
with net twist 0, and seven edge cubies around one cycle,
$$FL \to DF \to FR \to UR \to BR \to DR \to UL \to FL,$$
with net flip 0. The corner $DBL$ and the edges $UF$, $UB$, $DL$, $DB$ and $BL$ stay in place and are not turned. So the 21 corner facets move in three cycles of length 7 and the 14 edge facets in two cycles of length 7. All 35 displaced facets lie in cycles of length 7, and the order is 7. The script confirms that $(R U' F' U)^k$ is the identity for $k = 7$ and for no smaller positive $k$.
All three orders are at most 10, as the assignment's hint says.
Where it leads
- The rules used informally here, that $(ab)^{-1} = b^{-1}a^{-1}$ and that every element of a finite group has finite order, are proved in Basic Properties of Groups.
- Generators, the subgroups of the table and the center are defined in Subgroups and Cyclic Groups.
- Parity, cycle structure and the relabelling rule for conjugates are proved in Symmetric Groups and Permutations. The corner and edge permutations of a move give examples of Group Homomorphisms and Isomorphisms from $G$ to $S_8$ and $S_{12}$, once the conventions are matched. For a move $M$, let $c_M$ be the permutation of the corner positions that sends each position to the position where $M$ puts the cubie sitting there. Since $MN$ means $M$ first, $c_{MN} = c_N \circ c_M$, which in $S_8$, where the right factor acts first, is the product $c_N c_M$: the map $M \mapsto c_M$ reverses products. The map $M \mapsto c_M^{-1}$, which records where the cubie arriving in each position came from, is a homomorphism, because $c_{MN}^{-1} = (c_N \circ c_M)^{-1} = c_M^{-1} \circ c_N^{-1}$, the product $c_M^{-1} c_N^{-1}$ in $S_8$. The edge positions give a homomorphism to $S_{12}$ by the same definition, $M \mapsto e_M^{-1}$ with $e_{MN}^{-1} = e_M^{-1} e_N^{-1}$. Inverting a permutation keeps its cycle lengths, so it keeps its sign and order; nothing said above about cycles, parity or orders depends on which of $c_M$ and $c_M^{-1}$ is used.
- That every subgroup's order divides $\lvert G \rvert$, and the cosets used in the proof of God's number, are the subject of Cosets and Lagrange's Theorem.
What we have learned
The moves of the cube form a nonabelian group of permutations of 48 facets, generated by six quarter turns. Only turns of opposite faces commute. A move's order is the least common multiple of its cycle lengths, each multiplied by 3 or 2 when the cycle returns twisted or flipped. That gives 105 for $RU$, and 1260 at most. Three invariants (equal corner and edge parity, total twist 0, total flip 0) decide which assemblies are reachable. With a Schreier-Sims computation they give $\lvert G \rvert = 43{,}252{,}003{,}274{,}489{,}856{,}000$, one assembly in twelve. That is why a twisted corner cannot be fixed.
The first of the three invariants, the parity of a permutation, was taken on trust here. The next article, Symmetric Groups and Permutations, develops the cycle notation used above and proves that every permutation is either even or odd, and never both.
References
- Joyner, W. D. (1997). Mathematics of the Rubik's Cube. Lecture notes, United States Naval Academy, Spring semester 1996 to 1997. §4.5 (the Rubik's cubes as permutation puzzles; Singmaster notation; the generators as permutations of facets); Chapter 5 (Singmaster's statement that the largest order of an element of the cube group is 1260); Chapter 10 (the cube moves as permutations and orientations of corners and edges; Theorem 202, the second fundamental theorem of cube theory, credited to Ann Scott; explicit moves twisting two corners and flipping two edges). Later published as Adventures in Group Theory: Rubik's Cube, Merlin's Magic and Other Mathematical Toys (2nd ed., Johns Hopkins University Press, 2008). record · 3 pages
- Rokicki, T., Kociemba, H., Davidson, M., and Dethridge, J. (2013). The diameter of the Rubik's cube group is twenty. SIAM Journal on Discrete Mathematics, 27(2), 1082 to 1105. https://doi.org/10.1137/120867366. §1 (every position solvable in 20 face turns in the half-turn metric; about $4.3 \times 10^{19}$ positions); §2 (history: the counting lower bound of 18 known by 1980, Reid's 1995 proof that the superflip needs 20 turns); §4 (the subgroup generated by $U$, $D$ and the half turns of the other faces, of order 19,508,428,800, and its 2,217,093,120 cosets). record · 3 pages
Reviewed: verified, 16 Nov 2026 · editorial review, 23 Nov 2026 · 6 revisions