Mathematics
The Arrowed Rubik's Cube
- Group theory
- Permutations
In simple words
The middle square of each face of a Rubik's cube never leaves its face. It only spins in place, and because it is one plain colour, nobody notices. Draw an arrow on it and suddenly you can see the spin. Now try to solve the cube with every arrow pointing the right way.
Here is the surprise: you can never turn just one arrow by a quarter turn while everything else is solved. Every quarter turn of a face spins one arrow and, at the same time, moves four corners around in a loop, and the two always go together. So arrows can only be fixed two quarter turns at a time. Press Run below. After 105 repetitions of “turn the top, turn the right” every sticker is back home, yet two arrows are still turned.
A question from childhood
When I was young I was fascinated by my Rubik's cube, though not by solving it fast. I knew how to solve it, and the race for speed around me did not interest me much. Other questions did. How many positions are there? And what about the centres? They never leave their faces, they only spin in place. I imagined an arrow on each centre and tried to turn a single one by a quarter turn while every sticker stayed where it belonged. However long I tried, I could not. Years later I learned that the cube with marked centres is known as the supercube, and that my failure had nothing to do with skill. It is a theorem, and its proof fits in two lines. This page tells the story with the arrows drawn in.
Positions as group elements
Write for clockwise quarter turns of the up, right, front, down, left and back faces, for the counterclockwise turn and for the half turn. Every sequence of turns rearranges the stickers, and two sequences are equal when they rearrange them in the same way. With that rule the sequences form a group , the cube group, and each element of is one reachable position, the position it produces from the solved cube. Counting positions means counting group elements. The eight corners can be arranged in ways and twisted in (the last twist is forced), the twelve edges arranged in ways and flipped in (the last flip is forced), and only half of these combinations are reachable, because the corner and edge arrangements are always both even or both odd [1][2]:
Every one of these positions can be solved in at most 20 face turns, a bound settled by computer in 2010 and published in 2013 [3]. The picture-hanging puzzle is another toy whose secret is a group, there a free group.
Arrows on the centres
Face turns never move a centre, they only spin it. Record how often each centre has been turned,
counting quarter turns clockwise, modulo 4: a adds 1 to , a subtracts 1 and a adds 2. Because the centres stay in place, these counts simply add up, in whatever order the turns come, so the map that sends a sequence to its vector is a homomorphism onto the abelian group . An arrowed position is then a pair , the arrows together with the stickers, and the arrowed group is the set of pairs that sequences of turns can reach. Which pairs are these?
The parity rule
Let be 0 when position arranges the corners by an even permutation and 1 when the permutation is odd. Then every reachable arrowed position obeys
The proof is the two lines promised. Both sides are 0 for the solved cube. A quarter turn moves four corners around a 4-cycle, which is an odd permutation, and turns one centre by 1, so it changes both sides by one, and the two sides stay equal forever. A half turn is two quarter turns. Now suppose a single centre were turned a quarter turn with every sticker home. The left side would be 1 and the right side 0, which the rule forbids. That is the reason my childhood attempts failed. The same argument, applied to the 4-cycle of edges that every quarter turn makes as well, is the reason the corner and edge arrangements always share their parity.
Every allowed arrow pattern happens
The rule is the only obstacle. Take any sticker position and any arrows that satisfy it. Some sequence reaches , with arrows of the right parity, so the difference between and those arrows has an even sum. It is therefore enough to produce every even-sum pattern of arrows with all stickers home, and the demo already does it.
Its second word, , needs 105 repetitions to bring the stickers back. Under five corners travel around a 5-cycle and come back twisted, so they need rounds, a sixth corner stays in its place but twists, which takes 3, and seven edges travel around a 7-cycle without flipping. The stickers return after repetitions, and by then each of the two centres has been turned 105 times,
the U and R arrows both a quarter turn away from home. By the symmetry of the cube the same holds for any two neighbouring faces and : turns exactly those two arrows, which the site's tests check for all 24 ordered pairs. These twists are enough. A single centre turned by 180° follows from three of them, and a quarter turn of two opposite centres from two of them and one such half turn,
and any arrows with an even sum split into such pieces,
where the last coefficient is even, so its term is a multiple of . Put together, the arrowed cube is exactly
The factor 2048 has been quoted among puzzle enthusiasts for years [4]. The argument above proves it, and it uses nothing but the words of the demo. Two smaller groups sit inside. The pure centre twists, every sticker home, form the even-sum vectors of , 2048 of them, and forgetting the arrows maps onto with exactly these twists as its kernel. The positions with every arrow home, the kernel of , are the even half of . Both views give the same count, .
The three words of the demo
The word moves the stickers in eight 3-cycles and four 2-cycles, so it returns after repetitions. Its arrows go home even sooner, because vanishes after any even number of repetitions, so at both readouts turn green. The word is the one above: stickers home at 105 with two arrows turned, and stickers and arrows home together only at . The word moves two groups of three corners, each around a 3-cycle with a twist, and seven edges around a 7-cycle, so its stickers return after repetitions, with
the U arrow at +90° and the R arrow at −90°. Run and then , and the two R turns cancel while the two U turns add: every sticker is home and the U centre alone has turned by 180°, after 336 quarter turns. Much shorter routes exist. The twelve face turns do the same job.
Inside the code
The demo works on the 54 stickers directly. The move tables are not typed by hand, which is where such programs usually go wrong, but generated from the three-dimensional rotation of each layer:
// The moves are generated from geometry, not typed in. A clockwise quarter
// turn of face X rotates every sticker of X's layer by −90° about the outward
// normal k of X: positions and sticker normals alike.
const rotCW = (k, v) => add(scale(k, dot(k, v)), scale(cross(k, v), -1));
STICKERS.forEach((s, i) => {
if (dot(s.pos, k) !== 1) return; // not in this layer
const j = INDEX.get(key(rotCW(k, s.pos), rotCW(k, s.normal)));
from[j] = i; // sticker i lands on j
});Applying a turn is then a permutation of the stickers plus one addition, and that addition is the whole of the arrow bookkeeping:
// A turn permutes the 54 stickers and adds to its centre's count, mod 4.
// That last line is the homomorphism φ of the text.
for (let q = 0; q < quarterTurns; q++) {
scratch.set(cube.facelets);
for (let i = 0; i < 54; i++) cube.facelets[i] = scratch[from[i]];
}
cube.centres[fi] = (cube.centres[fi] + quarterTurns) % 4;The orders quoted on this page come from the cycle structure of the sticker permutation, with the same few lines that the tests use:
// The order of a move sequence is the lcm of the cycle lengths of its
// permutation: 105 for UR, whose stickers move in cycles of 15, 7, 7 and 3.
for (let i = 0; i < p.length; i++) {
if (seen[i]) continue;
let len = 0;
for (let j = i; !seen[j]; j = p[j]) { seen[j] = true; len++; }
order = (order / gcd(order, len)) * len;
}Try it yourself
Choose a word, press Run and watch the two readouts: Stickers tells you whether every sticker is home, and Centre arrows lists the arrows that are not. Run stops at the next multiple of N, so pressing it again carries on to 2N, 3N and beyond, and with you can watch the arrows come home at 420. The links below reload this page with a sequence already applied to the cube. First (UR)105, stickers home and two arrows turned. Then (U′R)63, with the arrows turned in opposite senses. Then the twelve turns that spin the U centre by 180°, and finally a single quarter turn of U: one arrow turned, and eight pieces out of place with it. Type your own sequences in the Move sequence box, where a final number repeats the whole sequence, and try to beat the parity rule. You will not.
References
- [1] D. Singmaster, Notes on Rubik’s ‘Magic Cube’ (Enslow, Hillside, NJ, 1981).
- [2] D. Joyner, Adventures in Group Theory: Rubik’s Cube, Merlin’s Machine, and Other Mathematical Toys, 2nd ed. (Johns Hopkins University Press, Baltimore, 2008).
- [3] T. Rokicki, H. Kociemba, M. Davidson, and J. Dethridge, The diameter of the Rubik’s cube group is twenty, SIAM J. Discrete Math. 27, 1082 (2013).
- [4] One-Answer Puzzle Theory Question Thread, SpeedSolving.com forum (the count 4⁶/2 = 2048 for the centres).