Rubik's Cube and other Cuboid Puzzles
Robert's Cubehacking Pages
Contents:
This page is organized in a roughly chronological manner, because I am trying to document my own history with the cubes. I tried to develop my own solution techniques and this resulted in nonoptimal, but nevertheless interesting, solutions.
Those unfamiliar with the basics of these puzzles or how they work can read the Wikipedia entry on Rubik's Cube.
1981: The 3×3×3 Cube
This is the original "Rubik's Cube" from the early 1980's. I learned about it from the first Hofstadter article on the topic (in Scientific American, March 1981) and a few friends at school got the cubes that same year.
The article introduced the "Singmaster notation" (also described in [1]) which is fairly obvious and easy to learn (and therefore has persisted). In this notation the 6 sides of the cube are named after the first letters of the English words Up, Down, Front, Back, Left, and Right. A letter by itself means to turn that side of the cube clockwise by 90^{o} (and only one "layer", that is, turning 1/3 of the cube while holding the other 2/3 still). A 180^{o} turn is indicated with a superscript 2, thus F^{2} means to turn the front side 180 degrees. A 90^[o} counterclockwise turn is indicated with a "prime" or single quote character, so L' means to turn the left side "away" from you.
Singmaster's notation also names the pieces of the cube (or more accurately, the positions they occupy when solved). Each piece is named with 1, 2 or 3 letters corresponding to the color or colors that appear on that piece (but with letters still indicating the sides of the cube, not the actual names of colors). Thus, for example, the corner piece in the upperrightfront corner is caleld URF, and the edge piece along the left side of the front face is called FL. The order of these letters is important too: FL and LF are the same piece, but in opposite orientations. A corner piece has three possible orientations, like URF, RFU and FUR. By convention the three parts of the corner piece are named in clockwise order (as if viewed with that corner pointing directly towards you).
My work in 1982
I augmented the Singmaster notation in two ways:
 A letter inside brackets means to rotate the whole cube. For example, [R] means turn the whole cube 90^{o} clockwise as seen from the right side.
 I needed a way to describe a middle "slice" of the cube in a more abbreviated way than (for example) [R]R'L. I decided to use R_{s} for this. This is notably different from Singmaster's "R_{s}", which means RL'.
First Solving Methods
I began by trying to work out as much of the puzzle as I could on my own. This resulted in an initial solving method that used five algorithms of my own design/discovery plus one from another student, most of them rather long and cumbersome to use. Using these I could solve the cube in about 6 minutes.

* These 4 algorithms were used in my original solving technique, which took about 6 minutes.
+ These 6 algorithms were used in my later 3minute solving technique.
Apple ][ Cube Emulator
Around the same time I was developing the 3×3×3 technique, I created this emulator for the 3×3×3 cube that ran on an Apple II. The coloring reflects that of the original Ideal Toy version of the cube, which has blue opposite white, yellow opposite green, and red opposite orange, with yellow/red/blue in clockwise order.
My Apple II cube emulator
The 2×2×2 Cube
This puzzle came out in the summer of 1982 under the name "Rubik's Pocket Cube", also by Ideal Toy Corp. The presentday "Rubik's Ice Cube" and the "Junior Cube" are physically equivalent. Solving is equivalent to just the corners of a 3×3×3 cube. You can swap a single pair of corners, but the rotations must add up to a multiple of 360^{o}.
Notation is similar: R, F, U, etc. indicate turning one side (half of the puzzle) clockwise 90^{o}. There is no fixed orientation because there are no centers, and a move sequence like RL' moves the whole cube without changing its pattern.
I got the Pocket Cube as soon as it was available. I didn't do much with it except try to find a pretty pattern similar to the Pons Asinorum (checkerboards on all six sides). I did not find one, but did discover the fourcheckerboard pattern produced by (for example) F^{2}R^{2}F^{2}U^{2}.
The 4×4×4 Cube
The 4×4×4 puzzle also became available in 1982, under the name "Rubik's Revenge", again by Ideal Toy Corp. It became available on the east coast of the U.S. before the west coast. (Bernard S Greenberg reported that the puzzle was available for $15 at Games People Play in Cambridge MA, in a message to the CubeLovers at MITMC mailing list on May 13^{th}.) I bought mine on May 21^{st}, at the Tech Coop shop at M.I.T. Since I was a high school student with no contact with anyone else who had this puzzle, I developed my own notation and solving algorithm. I explain how I did this in this video tutorial.
Extended Singmaster Notation
I recognized right away that I would want a notation that was compatible with the existing Singmaster notation for the 3×3×3 cube and also provided for future expansion to 5×5×5 and larger puzzles in the future:
R = Rotate the rightmost layer (1/4 of the cube) clockwise as seen
from the right side
R_{1} = same as R
R_{2} = rotate the secondtorightmost layer (again, 1/4 of the cube)
clockwise as seen from the right
R_{12} = Rotate R_{1} and R_{2} layers together (i.e. turning the
right half of the cube)
R_{1234} = Rotate the whole cube, same as [R] (clockwise 90^{o}
as seen from the right, i.e. the D face will become F, and the R
face stays in the same direction.)
R', R_{1}', R_{2}' = Inverse of R, R_{1} and R_{2} (turning
the same slice(s) in the other direction)
R_{3} = same as L_{2}'
In addition, for the 3×3×3 cube:
R_{s} = RL' as used by Singmaster, discarding my earlier use of "R_{s}" which is now replaced by R_{2}.
I still use this notation today. It is similar to the Dan Hoey notation[3] and more easily adapted to larger puzzles than the more recent system using lowercase letters.
I decided to pair up the edges first, then solve like a 3×3×3 cube (ignoring the centers) and fix the centers last. As a result I ended up developing algorithms to move the centers without disrupting anything else, and my edgepairing technique does not bother to preserve the centers. My method was similar to what is now known as the "cage method", except I didn't even solve one center to start.
Munafo's Rubik's Revenge solution technique (from 1982)
1. Pair up the edges. [ 2 edge pair swap: B^{2}R_{2}B^{2}R_{2}'B^{2} (5s) ]
2. Solve in 3×3×3 emulation mode (ignore the centers, and use the corner pieces to figure out which color belongs on each side).
3. (if necessary) Swap single edge pair: [ (R_{2}^{2}B^{2})^{2}R_{2}^{2} (5s) ]
4. (if necessary) Single edge pair flip [ use (R_{2}BR_{2}'B)^{4}R_{2} then U^{2}R_{2}U^{2}R_{2}'U^{2} (26s total) and go back to step 2 ]
5. Group centers in twos, then in fours [ (R_{2}B^{2}R_{2}'B^{2})^{5} (20s) and (R_{2}^{2}F_{2}^{2})^{2} (4s) ]
This technique was not too efficient, and took me 25:46, 16:51 and 14:04 the 2^{nd}, 3^{rd} and 4^{th} times I used it.
1989: My 2^{nd} period of work
In 1989 I was living in Boston permanently and decided to take up the Cube again. I bought a second Rubik's Revenge so I would have spare parts (My first had broken twice in the same way, indicating a weakness in the design. Having a second cube gave me spare parts.) {After 20 more years, none of my new cubes have broken, so I suspect the problem was isolated to the early Revenge cubes.}
During this period I added to the notebook I originally used for my 1982 notes, using pages 6264.
On Feb 13^{th} I created my second computer program, RubikHack. This was a random search of positions on the 2×2×2 cube. I made it to search specifically for a "pons asinorum" pattern. After much searching, in which it only found the 4checkerboard patterns, I realized that the pattern I sought was impossible.
RubikHack reporting a match
Sixcheckerboard Pattern on Even Cubes
A pattern analogous to Pons Asinorum is not possible in the 2×2×2 case. This is because the only methodical way to assign faces to colors is to leave 4 corners in their start position, and to move the others as a unit (the corners of a tetrahedron). There are 12 ways to do this (4 corners of a tetrahedron, 3 orientations once the corner has been chosen), but 2 out of 3 are illegal rotations (sum of corner twists is nonintegral). The remaining 4 positions are I, F^{2}R^{2}B^{2}D^{2}, D^{2}R^{2}U^{2}B^{2}, and U^{2}F^{2}D^{2}R^{2}.
Naming System for the 4×4×4 Cube
 Corners are named the same way as on the 3×3×3.
 For backwards compatibility with the 3×3×3, the old names for edges are used to refer to two edges of the 4×4×4 taken together. {When solved, they are a matched pair.}
 Edges taken alone are named with a subscript, e.g. UR_{F}, UR_{B} for the front and back halves of UR.
 Center pieces are similarly named, e.g. U_{LF}, U_{RF}, etc.
 When an edge piece moves, it is often flipped by necessity to occupy its new position. This is represented in a manner analogous to Singmaster's notation, e.g. when UR_{F} and UR_{B} exchange places, it is indicated by (UR_{F}, RU_{B}). Note that this is the same as (UR)_{+}, because all of the 3×3×3 notation has meaning in the 4×4×4 as well.
R_{2}'U_{2}R_{2} U R_{2}'U_{2}'R_{2} U' = (U_{RB}, U_{LB}, R_{UB})
R_{2}'U_{3}R_{2} U R_{2}'U_{3}'R_{2} U' = (U_{RF}, U_{RB}, R_{DB})
R_{2}'D'R_{2} U R_{2}'DR_{2} U' = (UF_{R}, UR_{B}, RD_{B})
R^{2}F_{2}R^{2}F_{2}' = (UL_{F}, RD_{B}, UR_{B}, DR_{F}, RU_{F}) (U_{LF}, R_{BD}) (U_{RF}, R_{BU})
(Useful for "pairing up edges": we desire to move UL_{F} and UR_{B} together, which in fact we do. We also put UL_{B} and UR_{F} together; so in this sense we are swapping a pair of edge pieces.)
Number of combinations of the 4×4×4 cube
= 8! permutation of corners
× 24! permutation of edges
× 24! permutation of centers
/ 2 combination of permutations must be even
× 3^{8} orientations of corners
/ 3 total orientation of corners must be zero
× 1 (orientations of edges and centers are determined by their position)
/ 24 no particular orientation of the cube is "special"; alternatively
we can assume that the orientation is special by leaving one
corner piece fixed
/ (4!)^{6} each of the four center pieces of a given color is
indistinguishable
× 2 due to the fact that center pieces are indistinguishable, we can
achieve what appears to be an odd permutation of the other pieces
in the cube by "hiding" a transposition within the center pieces
of one face.
= 7 40119 68415 64901 86987 40939 74498 57433 60000 00000
≈ 7.4012×10^{45}
(24! = 620448401733239439360000)
More algorithms that affect edge pieces
F_{2}^{2}R^{2}F_{2}^{2}R^{2}F_{2}^{2} = (UR_{F},DR_{B})(UR_{B},DR_{F}) (also moves 4 centers)
U_{2}'RU_{2}R = (FL_{U}, RB_{D}, RF_{U}, RF_{D}, RB_{U}, DR_{B}, UR_{F}, UR_{B}, DR_{F}) (4cycle of corners) (even permutation of centers) {My original handwritten notes omit "RF_{U}" from this list}
R_{2}'D'R_{2}UR_{2}'DR_{2}U' = (UR_{B}, DR_{B}, UF_{R}) {This is a simple adaptation of a similar algorithm on the 3×3×3}
R_{2}'D'R_{2}UR_{2}'DR_{2}U' R^{2} R_{3}'D'R_{3}UR_{3}'DR_{3}U' R^{2} = (UF_{R}, UF_{L}, DR_{B})
R_{2}'U^{2}B'R' {This was clearly meant to be the beginning of a longer algorithm}
R_{3}'UF_{2}R_{3} R_{3}'D'R_{3}UR_{3}'DR_{3}U' R_{3}'F_{2}'U'R_{3} = (UF_{L}, FU_{r}, UB_{r})
F_{2} LF UR_{3}'D'R_{3}U'R_{3}'DR_{3} F'L' = (DR_{F}, LD_{F}) (lots of centers moved)
U' R_{3}D' R_{2}'D'R_{2}UR_{2}'DR_{2}U' DR_{3}' U = (UL_{F}, UF_{R}, UR_{B})
(The following algorithm uses F_{2}U^{2}L'F_{2}'LF_{2}^{2} to place UR_{F} and UR_{B} in positions DR_{F}, LD_{F})
(F_{2}U^{2}L'F_{2}'LF_{2}^{2}) F_{2} LF UR_{3}'D'R_{3}U'R_{3}'DR_{3} F'L' (F_{2}^{2}L'F_{2}LU^{2}F_{2}') = F_{2}U^{2}L'F_{2}'LF_{2}' LF UR_{3}'D'R_{3}U'R_{3}'DR_{3} F'L' F_{2}^{2}L'F_{2}LU^{2}F_{2}' = (UR_{F}, RU_{B}) (lots of centers moved) {This is a singleedgepair flip, although there are much shorter ways to do this and that don't move the centers}
1991: 3^{rd} period of work
4×4×4 "pretty patterns"
(R_{13}^{2}U_{1234})^{3}F_{1234}'R_{13}^{2} — produces checkerboard pattern on 4 faces
There are lots of pretty patterns in the "13generator" group [R_{13}, L_{13}, U_{13}, D_{13}, F_{13}, B_{13}]. All look like the following figure on each face:
+++++  a  b  a  b  +++++  c  d  c  d  +++++  a  b  a  b  +++++  c  d  c  d  +++++although the correspondence between one face and another is essentially arbitrary. In fact, the patterns generated by this group correspond exactly to the patterns generated by the [R, L, U, D, F, B] group on a 2×2×2 cube. Warning: If you apply randomlyselected 13generator moves, you will get a pattern which is difficult to solve within the 13generator group. Solving a random 13generator pattern is essentially equivalent to solving the corresponding pattern on a 2×2×2 cube.
1995: 4^{th} period of work
Although the 5×5×5 had been avaialble for a while, 1995 was the first time I saw it in local shop. I bought 5×5×5 cubes on May 25^{th} and June 20^{th}. (The second cube was mainly for spare parts in case the first one broke). I also ordered the book [6].
I began adding a bit to my 1989 search program, with the goal of being able to search for algorithms, but the effort didn't get very far.
As with the 4×4×4, I created my own notation for the 5×5×5. I was able to continue using the notation for moves that I developed in 1982, but augmented it a bit with the R_{I} and R_{n} forms.
Notation for the 5×5×5
The pieces and positions on the 5×5×5 are named similarly to the 3×3×3 and 4×4×4. I use lowercase subscripts this time, which allows the names for the 4×4×4's pieces to be used in the same discussion as those of the 5×5×5's pieces without ambiguity. Also, the true centers and central edge pieces have the same names as their counterparts on a 3×3×3 cube. Any algorithm from the 3×3×3 cube, when performed on the 5×5×5, results in exactly the same manipulations of these pieces.
The true (nonmoving) center pieces are named with a single uppercase letter, as in the 3×3×3. The central edge pieces (12 in number) are named with two uppercase letters, just like their counterparts on the 3×3×3.
Surrounding each true center on each face are eight more center pieces. The four immediately adjacent to an edge are named with a lowercase subscript, e.g. U_{r} for the piece that is between U and UR. The four that are closer to the corners are named with twoletter lowercase subscript, like U_{rf} for the piece that is halfway along the diagonal from U to URF.
On either side of a central edge piece are two more edge pieces with the same two colors. These are named with a single lowercase letter subscript, e.g. UR_{f} for the piece that is between UR and URF.
Moves are named as described above for the 4×4×4, only now a 5^{th} layer exists. R_{1} or R is a normal turn of the outermost slice. R_{2} turns the next slice in, and R_{3}, also called R_{S}, turns the central slice. R_{4}=L_{2}' and R_{5}=L'.
As before, multiple parallel slices can be combined together, for example R_{24} = R_{2}R_{4}.
Moving the entire cube can be indicated by R_{12345}, which is abbreviated R_{I}. (The "I" is for "identity" because such a move does not change the pattern on the cube.) This abbreviated notation allows wholecube moves to be included in algorithms that are not specific to a particular size of cube.
The 3×3×3 can be emulated either by using moves from the set [R, L, F, B, U, D] or from [R_{12}, L_{12}, F_{12}, B_{12}, U_{12}, D_{12}]. The latter can also be thought of as a "dirty" emulation of the 2×2×2; it is "dirty" because you have to ignore all the centerslice pieces.
2002: 5^{th} period of work
Although I made a note of having picked up the Cube again in 2002, I did not record any other details.
2009: 6^{th} period of work
The VCUBE 6 became available at my local puzzle shop sometime in the spring of 2009, but I didn't notice it until July. I bought the puzzle soon after, then decided to begin a new software effort (the third, counting the Apple II program and RubikHack). This program is rubik3.
This new program uses a meetinthemiddle search technique to test N positions in O(sqrt(N)) time. The program is able to enumerate all positions of the 2×2×2 in less than a minute, and to solve an arbitrary position of the 2×2×2 in less than 10 milliseconds. It is also quite facile with the 3×3×3 and limited searches on the 4×4×4.
2009 Aug 13 :
2×2×2 singlepair swap
To exchange the pieces at UFL and UFR, do one of the following:
R^{2} F R F' R^{2} F U' R U F^{2} (10f) (keeps U sides on U face)
U' F U^{2} R F' R' F' U^{2} F' U R (11f) (moves U sides to F face)
U^{2} R^{2} U' F' U R^{2} U' F U' F' (10f) (moves U sides to L and R faces)
All three are selfinverse (repeating the same sequence puts the cube back the way it was). The second sequence represents one of the 2644 states of the 2×2×2 cube that are a maximal distance from solved by the faceturn metric (11 face turns is the most it ever takes to solve the 2×2×2 by "God's algorithm").
Local Maxima patterns
A "local maximum" is a position from which any move takes you closed to the solved state. For example, the above 11move pair swap, the one that starts with U'F, is a local maximum because it is one of the 2644 positions that are 11 moves from the start, and as it happens none of these positions is reachable from each other in a single turn — so any turn will take you to a position that is only 10 turns from the solved state.
What comes as a surprise to those unfamiliar with the mathematics of group theory is that there are local maximum patterns only 4 moves from the solved state. From these positions, any move will take you to a position that is only 3 moves from a solved state:
4turn local maxima

There are also 8 local maximum positions that are 5 moves from start:
5turn local maxima

4×4×4 doublepair swap
Two algorithms mentioned above can be combined to make this simple, pure double edge pair swap: (R^{2}F_{12}^{2})^{2} R^{2}F^{2} R_{2}^{2}F_{2}^{2}R_{2}^{2} (9s) (Exchanges the edgepair at UF with that at DF). (But, see my later improvement on Aug 27^{th}, below).
Emulation of Small NonCube puzzles
I have begun working on the descriptions (on the following pages) of several of the smaller noncube puzzles, such as the 2×2×3. I used rubik3 to enumerate them and generate optimal algorithms. My overall goal is to unite all the different solution techniques by reusing algorithms from smaller puzzles whenever possible.
2009 Aug 25
I have decided to perform a stickerswap on my newest (1989) 4×4×4 Rubik's Revenge and one of my 5×5×5 Professor clones. Algorithms exist to rearrange most of the stickers just by turning the puzzle; I used the ones here.
It is interesting to note that the optimal algorithm for swapping two adjacent faces on the 4×4×4 can be found by emulating a 2×3×3 on a 3×3×3. Using the command:
rubik3 N3 GUF2f2L2R2 \ PWWWWWWWWWOOOGGGRRRBBBOOOGGGRRRBBBYYYYYYYYY \ PWWWWWWWWYOOOGRRGGRBBBOOOGRRGGRBBBYYWYYYYYY exactThe program gives the solution U^{2} F^{2} U' F^{2} U^{2} F^{2} U R^{2} U F^{2} U' R^{2} U R^{2} U^{2} (15f). Translating this to a 4×4×4, the algorithm becomes U_{12}^{2} F^{2} U_{12}' F^{2} U_{12}^{2} F^{2} U_{12} R^{2} U_{12} F^{2} U_{12}' R^{2} U_{12} R^{2} U_{12}^{2} (23s).
2009 Aug 27
My original algorithm for 3×3×3 corner positioning was the one from the Cranston West student:
To cycle (URF → LFD → UFL), use L' RFR'F' L FRF'R' (10f)
Translating this to work on the D layer, it is:
To cycle (FRD → LDB → FDL), use L' RDR'D' L DRD'R' (10f)
But a quicker algorithm that doesn't care about edges on the D layer is:
To cycle (DRF → DLF → DLB), use F'RF' L^{2} FR'F' L^{2} F^{2} (9f)
Translating this for use on the U layer, it is:
To cycle (ULF → URF → URB), use F'LF' R^{2} FL'F' R^{2} F^{2} (9f)
These are also useful for solving the 2×2×2.
Improved 4×4×4 doublepair swap
For a long time I have been using the algorithm (R^{2}F_{2}^{2})^{3} R^{2} (7s) to exchange the edgepair at UR with that at DR. This algorithm also moves two centers from U to D and viceversa. The centers can be put back with (F_{2}^{2}R_{2}^{2})^{2} (4s), making (11s) total. As reported earlier, there is a combined algorithm using F_{12} moves that does it in (9s). However, today I realize that it is better to use F_{2} moves. This yields the improved algorithm:
F_{2}^{2}R^{2} F_{2}^{2}R_{13}^{2} F_{2}^{2}R_{3}^{2} (7s) (Exchanges the edgepair at UF with that at DF).
Improved 4×4×4 dedge flip
Using rubik3, limiting the moves to those that are possible on a 3×3×4, I found the following algorithm to exchange the pieces at FR_{D} and FR_{U} (also called a "dedge flip" because the two pieces together are a "dedge" or "double edge"): D_{2}'R^{2}D_{2}R^{2} U_{2}'R^{2}U_{2}^{2} F^{2}D_{2}F^{2}D_{3} R^{2}F^{2}D_{2}^{2}F^{2} (15s).
2009 Aug 28
Yesterday I found an algorithm for the 4×4×4 to to exchange the edgepair at UF with that at DF (F_{2}^{2}R^{2} F_{2}^{2}R_{13}^{2} F_{2}^{2}R_{3}^{2}). It is even easier if you change the R_{13} to R_{12} and R_{3} to R_{2}: F_{2}^{2}R^{2} F_{2}^{2}R_{12}^{2} F_{2}^{2}R_{2}^{2} (7s)
Here is an algorithm for resolving a flipped edge pair from "AndrewG" (on twistypuzzles forum, 20081223) R_{2}' U^{2}R_{2}U^{2}R_{2}' F^{2}R_{2}F^{2}R_{2}' B^{2}R_{2}'B^{2}R_{2} (13s). It moves four of the edgepairs around and also flips just one of them. Any of the standard 3×3×3 edgemoving algorithms, plus the 7s UFDF swap, and the parity will stay fixed.
2009 Aug 29
. . . Forward to page 2 . . . Last page (page 6)
s.13