aa r X i v : . [ m a t h . G R ] J un ALGEBRAIC STRUCTURE OF THE VARIKON BOX
JASON D’EON AND CHRYSTOPHER L. NEHANIVA
BSTRACT . The 15-Puzzle is a well studied permutation puzzle. This paper explores thegroup structure of a three-dimensional variant of the 15-Puzzle known as the Varikon Box,with the goal of providing a heuristic that would help a human solve it while minimizing thenumber of moves. First, we show by a parity argument which configurations of the puzzleare reachable. We define a generating set based on the three dimensions of movement,which generates a group that acts on the puzzle configurations, and we explore the structureof this group. Finally, we show a heuristic for solving the puzzle by writing an element ofthe symmetry group as a word in terms of a generating set, and we compute the shortestpossible word for each puzzle configuration.
1. I
NTRODUCTION
The 15-Puzzle is a permutation puzzle which consists of a 4 × × × × × × × × × IGURE
1. The Varikon Box. The left shows an example of a solvedconfiguration. The right shows two views of a piece inside the 2 × × The outline of the paper is as follows. Section 2 is a review of the classical analysis of15-Puzzle configurations which can be reached by valid moves. Section 3 covers whichproperties of the 15-Puzzle carry over to the 2 × × × × EVIEW OF THE
UZZLE
The 2 × × C the set of such reachableconfigurations of the 15-Puzzle. For convenience, we denote the solved configuration by ι . A sequence of valid moves permutes the pieces of the puzzle, but it is not the case thatevery permutation of the pieces is reachable. For example, Figure 2 shows a configurationwhich is well-known not to be in C . 1 2 3 45 6 7 89 10 11 1213 15 14F IGURE
2. An unsolvable configuration of the 15-Puzzle. There doesnot exist a sequence of moves that maps this configuration to the solvedstate.Now take the subset C fix of reachable configurations where the empty space is fixedin the bottom right corner. Configurations in C fix can also be thought of as permutationsin S , with respect to ι . For example, the configuration in Figure 2 corresponds with thepermutation (
14 15 ) , since performing this permutation on the pieces of ι would yield theconfiguration in the figure. The following lemma was first shown in [1]. Lemma 2.1.
For every c ∈ C fix , c must correspond with an even permutation.Proof. This can be seen by imagining the 4x4 grid as a black and white checkerboard.When considering moves that swap the empty space with an adjacent square, each movemust change the colour that the empty space is on. If we take two configurations c , c ∈ C fix , it must take an even number of transpositions to transition from c to c , since theempty space begins and ends on the same colour. (cid:3) To show that every even permutation is a reachable configuration, we adapt the prooffrom [2]. First, we introduce a notation for moves, which act as maps on the configurations.The definition for moves is based on the idea of sliding blocks to the right or left, as well asup or down. Unfortunately, not all moves are possible on all configurations. If the emptyspace is on the far left side of the grid, there is no piece to the right which can be movedto fill the space. To fix this issue, we define a “right” move, denoted R , to either meansliding a block to the right to fill the space, or if the space is on the far left, it means toslide the entire row to the left. Figure 3 shows that under this definition, R is equivalent to LGEBRAIC STRUCTURE OF THE VARIKON BOX 3 R ∶ ↦ ↥ ↧ ↤ IGURE
3. Applying the “right” move repeatedly cycles through four15-Puzzle configurations.the identity map on C , and R is what we might consider a “left” move. Similarly, we candefine U to be the “up” move, which slides a piece up, effectively moving the empty spacedown. Using this notation, moves can be written as a sequence of R ’s and U ’s.The diagram on the left in Figure 4 is in C fix , as it can be obtained by applying RU R U to ι , which is indicated by multiplication. Using the convention that moves are appliedfrom left to right, this sequence corresponds with the permutation (
11 12 15 ) . In order toshow that every even permutation is reachable, we will use the fact that A is generatedby the 3-cycles, (
11 12 i ) for all i ∈ { ,..., } other than 11 and 12. ι ⋅ ( RU R U ) = ι ⋅ ( U R ) = IGURE
4. Examples of sequences being applied to the solved config-uration of the 15-Puzzle. The left shows a 3-cycle in the bottom-rightquadrant, and the right shows the set-up sequence, U R , being appliedto ι .We start by performing a set-up sequence, U R , to the solved configuration, which wewill undo later (Figure 4). Following the set-up, we can then swap the empty space with thefollowing sequence of pieces: 7 → → → → → → → → → → → → → σ n = ( U R )( U R U R UR URUR U ) n ( U R ) − , where n ≥
0. Therefore, over all distinct choices of n , the sequence:(2) σ n ( RU R U ) σ − n , will correspond with permutations of the form (
11 12 i ) , for all i except i = ,
12. By theabove arguments, we have the following theorem.
JASON D’EON AND CHRYSTOPHER L. NEHANIV
Theorem 2.2. C fix corresponds precisely with even permutations of the fifteen pieces. A similar argument applies to any fixed position of the empty space. Therefore, thenumber of reachable configurations is 16 ⋅ ∣ A ∣ = . This is different than saying thereachable configurations are even permutations of the 16 squares. Rather, when the emptysquare is an even (or respectively, odd) number of swaps away from the bottom-right cor-ner, then the configuration is reachable if and only if the permutation is even (respectivelyodd). 3. R EACHABLE C ONFIGURATIONS OF THE V ARIKON B OX In this section, we describe some previously known results for the 2 × × × × Lemma 3.1.
Given a fixed starting configuration, the 2 × × On each individual piece, the red corner and blue corner must be opposite from eachother. Transitioning between candidate solutions would mean swapping every piece withthe contents of the opposite corner, which is an even permutation. However, any sequenceof moves that takes the empty space to the opposite corner will involve an odd numberof swaps. Therefore, it is not possible to transition between the two candidate solutions,making only one possible to reach. (cid:3)
According to Lemma 3.1, we can numerically label the pieces and define a solved con-figuration in terms of the labelling. Let us denote the set of reachable configurations of the2 × × V . We will reuse ι to indicate the solved configuration, shown inFigure 5. ι = ι ⋅ ( RBRB ) = F IGURE
5. Left: by labelling the pieces of the 2 × × ι . Right: an example of a 3-cycle on the bottom half of the 2 × × V fix be the set of configurationswhere the empty space is in its solved position. If v ∈ V fix , it must correspond with an evenpermutation of the 7 pieces: a fact which we already used in the proof of Lemma 3.1. Toprove that every even permutation is in V fix , we show that every cycle of the form ( i ) is in V fix , when i ≠ ,
6, as this will generate A . LGEBRAIC STRUCTURE OF THE VARIKON BOX 5
To describe sequences of swaps on the Varikon Box, we need three generators: R , U , B (right, up, and back, respectively), which act as according to Figure 6. We define R , U , and B to be the identity map to fix the issue of certain moves being impossible given theposition of the empty space. To get the permutation ( ) , one can perform sequence RBRB (Figure 5), but we can also replace the 7 with any of the other pieces, by swappingthe empty space with 4 → → → → →
4. By repeating the cycle, we can replace 7 withany other piece, in order to perform ( i ) for other i . R ∶ ↦ U ∶ ↦
37 4
24 6 B ∶ ↦ F IGURE
6. The three possible directions of movement for the 2 × × × × V fix correspond with even permutations of the 7 pieces. By symmetry, we can concludethat there are = ,
160 reachable configurations, since for every position of the emptyspace, we can perform any even permutation on the 7 pieces.4. G
ROUP S TRUCTURE OF THE × × ARIKON B OX We begin this section by observing that sequences of R , U , and B give rise to a group-like structure. Proposition 4.1.
Let s , s be two sequences of R , U , and B. We say s = s if for allc , c ∈ V , s ∶ c ↦ c if and only if s ∶ c ↦ c . Then with respect to composition, the setof sequences form a group and the mapping on the configurations is equivalent to a groupaction.Proof. Composition is associative and concatenating two sequences will produce anothervalid sequence. The empty sequence satisfies the properties of the identity. Every se-quence is invertible, since each element of the generating set { R , U , B } is an involution.The group operation is well-defined, since if x and y are sequences where x = y and s an-other sequence, then xs = ys , since for all c ∈ V , x and y map c to the same configuration,and performing additional moves will maintain equality. The mapping on configurations isclearly a group action, since the empty sequence leaves all configurations untouched, andthe group multiplication is defined to be compatible with the action. (cid:3) We now investigate the structure of this group, which we call G , and we show how toreduce it to a structure that will help us solve the 2 × × ι is trivial and the action of the group is transitive, which implies that ∣ G ∣ = , JASON D’EON AND CHRYSTOPHER L. NEHANIV
Interestingly, if we restrict G to the subgroup of sequences involving only R and U ,we get a copy of D , since R = e , ( RU ) = e , and RU ⋅ R = R ⋅ ( RU ) − . For any givenconfiguration, this gives a local picture around the configuration, since by alternating anytwo of R , U , and B , we obtain a copy of D , pictured in Figure 7.RU BRU BURURURU R U R B R B R B RBRBRBUB U B U B UBUF IGURE
7. Centered at a particular configuration, if one alternates be-tween R and U , between R and B , or between U and B , we get threecopies of the dihedral group of order 12.To help break down the size of the group, consider the group homomorphism, ϕ ∶ G → ( Z ) , where for g ∈ G the components of ϕ ( g ) correspond with the counts modulo 2 of R ’s, U ’s, and B ’s in g respectively. For example:(3) ϕ ( RUBUBR ) = ( , , ) , which also implies that RUBUBR fixes the empty space. It is clear to see that this is awell-defined group homomorphism by properties of modular arithmetic since each lettertoggles the position of the empty space in a different dimension. Consider K = ker ϕ , whichis a normal subgroup. By our definition of ϕ , K must correspond with sequences of moveswhich fix the empty space. By the extension of Lemma 2.1, K ≅ A , as it acts like A onthe configurations in V fix . Given that K is normal in G , the product, K ⟨ R ⟩ , is a subgroupof G , and since R ∉ K , we get that ∣ K ⟨ R ⟩∣ = , G .On the other hand, consider Z , the center of G . Computationally, we verified that ∣ Z ∣ = The configurations produced by applying these elements to ι are shown in Fig-ure 8. One can easily verify by inspection that the intersection of K ⟨ R ⟩ and Z is trivial, as The nontrivial elements of Z can be given by the sequences: ( RU ) ( RB ) UB ( RB ) UBRB , ( RU ) RB ( RU ) ( BU ) RURB , and ( RU ) BUBR ( BU ) BR ( BU ) . LGEBRAIC STRUCTURE OF THE VARIKON BOX 7 no element in K ⟨ R ⟩ will move the empty space far enough to reach the non-trivial config-urations in Figure 8. Furthermore,(4) ∣ K ⟨ R ⟩ Z ∣ = ∣ K ⟨ R ⟩∣ ⋅ ∣ Z ∣∣ K ⟨ R ⟩ ∩ Z ∣ = ⋅ = = ∣ G ∣ . Since K ⟨ R ⟩ Z ⩽ G , then K ⟨ R ⟩ Z = G . Therefore, since K ⟨ R ⟩ ∩ Z is trivial and Z commuteswith K ⟨ R ⟩ , we have that G ≅ K ⟨ R ⟩ × Z . By determining the structure of these components,we will then obtain the full structure of G .
74 3
62 4 F IGURE
8. The configurations obtained by applying elements of thecenter, Z , to ι . They correspond with ι itself, and 180 ○ rotations of theentire box, pivoting around the U , B , and R axes. Lemma 4.2. K ⟨ R ⟩ ≅ S , where K is the kernel of the group homomorphism ϕ .Proof. K is normal in K ⟨ R ⟩ and K ∩ ⟨ R ⟩ = { e } , so K ⟨ R ⟩ = K ⋊ ⟨ R ⟩ ≅ A ⋊ Z . It is wellknown that A ⋊ Z is isomorphic to either A × Z or S , so it remains to show the former isfalse. If it held, then K ⟨ R ⟩ would contain an element kR of order 2, with k ∈ K , commutingwith all of K ⟨ R ⟩ . Since Z is the center, then kR commutes with all of G = K ⟨ R ⟩ Z , and thus kR ∈ Z . This is a contradiction, since K ⟨ R ⟩ ∩ Z is trivial. This gives us K ⟨ R ⟩ ≅ S . (cid:3) Lemma 4.3.
The center Z of the Varikon box group is a Klein four-group ( Z ) .Proof. Note by Figure 8 that applying a 180 ○ rotation of the whole Varikon Box to anyconfiguration maintains the numbers aligned along the U , B , or R axes. From this it is clearthat sequences yielding these configurations commute with every other sequence, and eachnon-trivial element has order 2. It follows that Z ≅ ( Z ) . (cid:3) Theorem 4.4.
The group of the Varikon box G is isomorphic to S × ( Z ) .Proof. This follows trivially from Lemma 4.2 and Lemma 4.3. (cid:3)
5. T HE A AND A S HORTEST W ORD P ROBLEM
One way to proceed toward a solution heuristic is by limiting the configurations toreduce the size of the problem. In practice, it is simple to locate the piece belonging in theposition opposite of the empty space (the piece labelled 1) and solve it. If we only considerthe configurations in V fix where piece 1 is in the solved position, then we could solve theremaining pieces with ( ) , ( ) , and ( ) , by alternating between any two of R , U , and B . With these restrictions, we can visualize the puzzle as just these 3-cycles onpieces 2 , , , , , and 7, but for convenience, we will relabel these from 1 to 6, so that the The structure of K ⋊ ⟨ R ⟩ is given by the automorphism φ R of K defined by φ R ( k ) = RkR − . That is, for k , k ∈ K and r , r ∈ ⟨ R ⟩ , multiplication is defined as ( k , r ) ⋅ ( k , r ) ∶ = ( k r k r − , r r ) . JASON D’EON AND CHRYSTOPHER L. NEHANIV permutations are now ( ) , ( ) and ( ) . Figure 9 shows a visual representationof this simplified puzzle.One can easily verify that these 3-cycles generate A . This reduces the puzzle to a wordproblem: given a permutation in A , what is the shortest way to write it as a product of these3-cycles and their inverses? We can solve this sub-problem by performing the inverse ofthis product. We can even reduce it further, by solving piece 6 of the sub-problem (whichis easy in practice). This leaves us with solving the remaining 5 pieces using only the3-cycles ( ) and ( ) , which are enough to generate A (a visualization of this isshown in Figure 9). 123 4 56 123 4 5F IGURE
9. A visualization of the 2 × × A in terms of ( ) and ( ) . The worst-case found was the permutation ( )( ) , with a word-length of 6.Furthermore, it was the only permutation to have this length:(5) ( )( ) = ( ) − ( )( )( ) − ( ) − ( ) . We then computed the shortest-length product of permutations in A in terms of thegenerators ( ) , ( ) , and ( ) . We found 46 permutations achieve the maximumword-length of 5. Which corresponds with the permutation ( ) :(6) ( ) = ( )( ) − ( ) − ( )( ) − . F IGURE
10. Examples of the worst-cases for the two sub-problems. Theleft shows the A sub-problem, which takes 24 moves with this method.The right shows the A sub-problem, which takes 20 moves.These examples are shown in their puzzle-form in Figure 10. Setting up the A sub-problem takes at most 2 moves, since the orientation of the puzzle can be freely changed,and the worst-case scenario is when the piece labelled 1 starts adjacent to the empty space. LGEBRAIC STRUCTURE OF THE VARIKON BOX 9
Combining this with the worst-case for the A word sub-problem, it takes at most 22 movesto solve the Varikon Box with this method, assuming one can solve the shortest wordproblem. This is comparable to the known worst-case which is 19, found by a brute-forcemethod [3]. 6. C ONCLUSION AND F UTURE W ORK
We have analyzed the 2 × × S × ( Z ) . Addi-tionally, there exist larger versions of the Varikon Box (for example, 3 × × × × n × n × n Varikon Box. Moreabstractly, one could consider higher-dimensional variants: that is, a group generated by { X ,..., X k } , where X ni = e for each i , which could have further applications to discretedynamical systems in general. A CKNOWLEDGEMENTS
This work was supported by the Natural Sciences and Engineering Research Council ofCanada (NSERC), funding ref. RGPIN-2019-04669, and the University of Waterloo.R
EFERENCES1. William Woolsey Johnson and William E. Story,
Notes on the “15” Puzzle , American Journal of Mathematics ∼ jtmulhol/math302/notes/permutation-puzzles-book.pdf [Accessed 2 May 2020].3. Jaap Scherphuis, Jaap’s Puzzle Page: Varikon Box 2 × × ALHOUSIE U NIVERSITY , 6299 S
OUTH S TREET , H
ALIFAX , N
OVA S COTIA , C
ANADA
E-mail address : [email protected] U NIVERSITY OF W ATERLOO , 200 U
NIVERSITY A VENUE W EST , W
ATERLOO , O
NTARIO , C
ANADA
E-mail address ::