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 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 leads to God's number being elements. Curiously, the amount of elements that need moves to be solved seems to be equal to the amount of elements that need . 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 , 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
:
3 2 1 0
2 3 1 0
2 1 3 0
2 1 0 3
(now the puzzle is essentially reduced to the one in )
1 2 0 3
1 0 2 3
(reduced to )
0 1 2 3
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" 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 . This must be true, since if represents a series of moves , then also represents a series of moves, and an equally long one at that. That means if then , proving that .
We also know that (where is God's number). This must be true since, if , then . This shows that and therefore for any .
The amount of moves needed to "solve" a specific state is then exactly . In general, since if is a solution to get from to , then , and therefore . This is not (necessarily) true for right multiplication, i.e. is not always equal to .
Lastly, like all well-behaving metric spaces, we find the triangle inequality
This is true since, if and , then definitely . The shortest distance to get from to is therefore at most as long as , 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, . The triangle inequality then shows that .
Loops
An interesting thing happens at some point down the line of generating solutions; a single state might have multiple distinct solutions. In formula, it means there are two different moves and such that both and simultaneously . For the Rubik's cube, this does not happen until . Specifically, we find:
After the first 5 moves, we can actually choose whether we do or , 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.