Four in a Row

Cube Maths and Group Theory

The cube is a favourite toy of mathematicians. Its moves form a group, one of the central ideas in modern maths, and it shows ideas like permutations, parity and order in a way you can hold in your hand.

The cube as a group

A group is a set of actions you can combine, where every action can be undone, and doing nothing counts as an action. Cube moves fit perfectly: do R then U and you get another action (“R U”); every move has an inverse (R’ undoes R); and doing nothing leaves the cube alone. The order matters, though: R then U is not the same as U then R. Groups like this are called non-commutative.

Counting positions

There are 8 corners and 12 edges. If you took the cube apart and rebuilt it at random, you could arrange the corners in 8! ways and twist each in 3 ways, and arrange the edges in 12! ways and flip each in 2 ways. That gives 8! × 38 × 12! × 212 assemblies. But turning faces can’t do everything:

So only 1 in 12 random assemblies can be solved, leaving 43,252,003,274,489,856,000 positions. There’s more on our combinations page.

Parity

Every quarter turn swaps pieces round in two 4-cycles: one of corners and one of edges. A 4-cycle is an odd permutation (it takes three swaps), so each turn changes the “parity” of both corners and edges at once. That is why a lone swap of two corners can never happen on a 3x3. On a 4x4 the inner layers break this link, which is where 4x4 parity comes from.

Repeat a move and you come back

Do any sequence enough times and the cube returns to solved. The number of repeats is the sequence’s order. We worked these out with our cube model:

SequenceRepeats to get back to solved
R4
R U R' U'6
R2 U26
R U'63
R U105
R U2 D' B D'1,260 (the largest order any single sequence can have)

Try it: do R U R' U' six times on the 3D cube and watch it come back.

Commutators and conjugates

Many algorithms are built from two patterns. A commutator is “A B A’ B’”: do A, do B, undo A, undo B. If A and B only overlap on a few pieces, only those pieces move. R U R' U' is the simplest example. A conjugate is “A B A’”: set up with A, do something useful with B, then put things back with A’. The corner cycle in the beginner’s method is a commutator, and slotting edges in on a 4x4 uses conjugates.

God’s number

In 2010 a team using Google’s computers proved that every position can be solved in 20 moves or fewer, counting half turns as one move. This is God’s number. Counting only quarter turns, the answer is 26, proved in 2014. For the 2x2 it is 11 (or 14 quarter turns).

Questions people ask

What is group theory?

The maths of actions that can be combined and undone, like cube moves. The set of all cube positions, with moves as the way of combining them, forms a group.

Why can’t you swap just two pieces on a cube?

Every quarter turn changes the parity of both the corners and the edges at once, so they always stay linked. A single swap would change just one.

What is the order of R U?

105. Repeat R U 105 times and the cube is back to solved.