← Home ← Mathematics

Permutation puzzles

This post builds further on God's number.

Yesterday, I put together a small tool to explore permutation groups and how they are structured with respect to generating the entire group from some base elements. Here are some thoughts and insights!

Symmetry

First, I tried a series of simple group elements; swapping two adjacent numbers. For example, 1 0 2 3, 0 2 1 3 and 0 1 3 2. These generate S4S_4 in its entirety. God's number for this puzzle is 6, and, perhaps unsurprisingly, the single "hardest" element to reach is 3 2 1 0. This element is the only one that requires the full 6 moves. In general, it seems that this type of choice of base elements in SnS_n leads to God's number being g=12n(n1)g = \tfrac12 n(n - 1) elements. Curiously, the amount of elements that need ii moves to be solved seems to be equal to the amount of elements that need gig - i. There is always one element the hardest to get, which is the identity written backwards. Quite satisfyingly, solving the group to the identity is just as hard as solving it to the reverse identity; the puzzle is completely symmetric. Initially, I thought; well, that kind of makes sense; the base elements we chose were entirely symmetric, so it's not surprising that the puzzle also is. But, as it turns out, that's not quite right. If we add the one element swapping the first and last number (in the example for S4S_4, 3 1 2 0) then the solution spaces are no longer symmetric, with elements needing a number of moves closer to God's number on average.

Perhaps the reason the specific choice of base elements leads to a symmetric puzzle is due to how the solutions are composed. The optimal solution turns out to be moving the numbers in the permutation from out- to inwards; for example, this is the steps we'd use to solve 3 2 1 0:

It doesn't matter which side we are completing; the goal is to reduce the puzzle to a simpler one. Once the 3 is in place, the move 0 1 3 2 becomes usless; it doesn't do anything that the other permutations can't do in the same (or fewer) number of moves. This also explains that God's numbers for these types of puzzle groups are triangle numbers; we can show this with induction.

Distance

We can define a "distance" d:G2Nd: G^2\to\mathbb{N} between two elements in a puzzle as the least amount of moves needed to get from one to the other. Since we consider powers of each move as moves themselves, this means d(a,b)=d(b,a)d(a, b) = d(b, a). This must be true, since if qq represents a series of moves m1,m2,,mim_1, m_2, \dots, m_i, then q1=mi1m11q^{-1} = m_i^{-1} \dots m_1^{-1} also represents a series of moves, and an equally long one at that. That means if aq=ba \cdot q = b then bq1=ab \cdot q^{-1} = a, proving that d(a,b)=d(b,a)d(a, b) = d(b, a).

We also know that d(a,b)gd(a, b) \leq g (where gg is God's number). This must be true since, if am1mi=ba \cdot m_1 \dots m_i = b, then b1am1mi=1b^{-1} a m_1 \dots m_i = 1. This shows that igi\leq g and therefore d(a,b)gd(a, b) \leq g for any a,bGa,b\in G.

The amount of moves needed to "solve" a specific state aa is then exactly d(a,1)d(a, 1). In general, d(a,b)=d(ca,cb)d(a, b) = d(c\cdot a, c\cdot b) since if qq is a solution to get from aa to bb, then aq=ba\cdot q = b, and therefore caq=cbc\cdot a\cdot q = c\cdot b. This is not (necessarily) true for right multiplication, i.e. d(a,b)d(a, b) is not always equal to d(ac,bc)d(a \cdot c, b \cdot c).

Lastly, like all well-behaving metric spaces, we find the triangle inequality

d(a,b)+d(b,c)d(a,c)d(a, b) + d(b, c) \geq d(a, c)

This is true since, if aq=ba \cdot q = b and br=cb \cdot r = c, then definitely aqr=ca\cdot q\cdot r = c. The shortest distance to get from aa to cc is therefore at most as long as qrq\cdot r, and potentially shorter.

With this notion of distance, we can define a sort of "absolute value" to be the distance to the solved state. That is, a:=d(a,1)|a| := d(a, 1). The triangle inequality then shows that a+bb1a|a| + |b| \geq |b^{-1}\cdot a|.

Loops

An interesting thing happens at some point down the line of generating solutions; a single state aa might have multiple distinct solutions. In formula, it means there are two different moves mm and kk such that both am<a|a\cdot m| < |a| and simultaneously ak<a|a\cdot k| < |a|. For the Rubik's cube, this does not happen until a=5|a| = 5. Specifically, we find:

(L1U1L2F1D1)(LDL2FU)=1(L^{-1}\cdot U^{-1}\cdot L^2\cdot F^{-1}\cdot D^{-1}) (L\cdot D\cdot L^2\cdot F\cdot U) = 1

After the first 5 moves, we can actually choose whether we do DD or LL, and both solve the cube optimally. This type of product can actually be quite useful in solving some groups optimally, since we can first find a solution of any length (this is not particularly hard) and then find sub-prodocts in the solution that resemble part of the product above. If a series of 6 moves coincides with above, then we can remove them in favor of the four moves that are equivalent. I'm not sure if that is a viable strategy, though; for a Rubik's cube, I imagine you'd need a lot of these types of products to reduce a long solution down to an optimal one.