Solving Rubik's Cube

Dr. John F. Jarvis
USC Aiken, Dept. of Mathematical Sciences, retired




Preliminaries

The solution to be described is only for the original 3*3*3 Rubik's Cube. A solved cube is one with all six faces having the same color. The solution description doesn't depend on the coloring of the cube. This is necessary since Rubik's Cubes come with many color arrangements. The 3*3*3 cube can be viewed as 27 individual cubies. There are 6 face center cubies having a single visible color, 12 edge cubies (two visible colors), 8 corner cubies (three visible colors) and a single invisible or interior cubie. The face center cubies don't move with respect to each other thus define the solved face colors. There is only one correct place for each cubie in the solved cube. Edge cubies can have two orientations in their home positions while corner ones have three possible orientations. Both position and orientation must be correct. A slice is a layer of 9 cubies. A face can have a single color without the slice being solved. For all six faces to have uniform color all cubies must be correctly place with the correct orientation.

Solving the cube requires a series of moves, twists of a particular slice. The trick is to know the sequences of which slice to twist by how many quarter turns. Following is an explanation of how these sequences, to be referred to as processes, are described. Since cubes come in a large variety of color combinations processes are given in terms of face locations. Holding the cube in front of you and below eye level the faces are labeled UP for the top face or slice, DOWN for the bottom, FRONT and BACK where front faces the person and LEFT and RIGHT. The first letters of these face names are different (UDFBLR) and will be used to indicate which slice is to be rotated. To finish specifying an individual face move one of the numbers 1,2,3 is used to indicate how many quarter turns clockwise (CW) to rotate the slice. 3 indicates a quarter turn counterclockwise (CCW) which is the same as a ¾ turn CW. For example R3 indicates a quarter turn CCW of the Right face of the cube. Most processes require several moves. Very important: within a process the relationship between color and face location must not be changed. Individual cubies can be indicated by either two or three colors or face names, UDFBLR.

Example: the process R2L2U2D2F2B2 generates a “pretty pattern” called 6X from a solved cube. Repeating the same process will restore the solved the cube.

The solution proceeds in eight steps. In general as more of the cube is solved, the process for the next step becomes longer. Unsolved portions of the cube will generally change as the current process is executed.

Solution

Choose the first face (color) to be solved and orient the cube so the chosen face is in the U position.

Step 1 puts the U edge cubies into the correct position with the right orientation.

A) If there is a U edge cubie with the U color already in the U face rotate the U face to align the side color of this cubie with the matching face. Possibly more than one cubie could be correctly positioned by the operation. If there are incorrectly placed U cubies at this time they will be dealt with later.

B) If there is a cubie with the U color in the D face do a D rotation, if needed, to align it with the matching side face and rotate the cube to make the matching face the F face. Move the cubie from the D face to U face with F2. Repeat as applicable.

C) If there is a U face cubie in the middle slice rotate the cube until the U color is in the FR or FL position. If needed, rotate the U face to put the target position to either the L or R sides. If rotated to the R side use R1 to put the cubie in the U surface. If to the L side the move to do is L3. Now align the U surface with the face centers.

D) If there is a U face cubie in the D slice with the U color on one of the sides rotate the cube so the the matching side color becomes the F side. Use a D rotation to put the cubie in the FD position. Then do F3U3R1U1 .

E) A U slice cubie is in the U slice but is in the wrong position or has the wrong orientation is moved to the D slice and one of the preceding sequences, B or D, is used to put it where it belongs.

Apply the above substeps as needed and once all 4 U edge cubies are correctly placed and oriented Step 1 is completed.

Step 2 positions and orients the U corner cubies.

A) If there is a U corner cubie in the D slice with the U color on one of the side faces rotate the D slice to put the cubie to be moved to the U surface between the two matching sides and rotate the cube until the U color is in the F face. If the cubie is at FLD use D1L1D3L3. If the cubie to be moved to the U slice is at FRD use D3R3D1R1 .

B) If the cubie to be moved has the U color in the D face rotate the D layer so that it is between the two marching sides. Rotate the cube so the cubie being moved to the U slice is at FRD and do R3D1R1F1D2F3 .

C) If a U corner cubie is at the correct location but not oriented correctly use A) to move it to the D slice and correctly position it using A) or B).

Step 3 positions and orients the center slice edge cubies.

Rotate the D slice to align one of the center edge cubies with the matching side color. Rotate the cube to make this face color the F side. If the cubie at FD needs to be moved to FR use F3D2L3F3L1D2F1 and if it is to go to FL use F1D2R1F1R3D2F3.

After moving all center slice cubies in the D slice to the center slice if a center edge cubie is in the correct position but is flipped or is in a wrong center slice position, use one the preceding processes to move it to the D slice. Which D slice cubie moved to the center slice doesn't matter.

Continue until all four center edge cubies are in the correct positions and orientations. Only the D slice should unsolved at this time.

Step 4 is to invert the cube making the unsolved D slice the U slice.

The face color that is now the U face remains the U face until the cube is solved.

Step 5 puts the U edge cubies in the correct positions. If needed, they will flipped in step 6.

Rotate the U face until there are 0, 1 or 2 pairs of adjacent U edge cubies that need to be swapped to get all four into the correct positions. This is always possible. Obviously if no swaps are needed proceed to Step 6. To swap a pair of cubies rotate the cube until the pair is at UL and UB. Do the following process: R3F3U3F1U1R1U3. Repeat if there is another pair to be swapped.

Step 6 uses a process that flips a pair of the U edge cubies.

Depending on which, if any edge cubies are flipped 0, 1 or 2 applications of the following process are needed. If two adjacent cubies need to be flipped rotate the cube until they are in the UL and UB positions. Use the process: L3U3L2F3L3F2U3F3U2 to perform the flipping. If the cubies that need flipping are not adjacent apply the process anywhere which will result in a flipped pair being adjacent.

Step 7 place U corner cubies in correct positions. They will be rotated to finish the cube solution in step 8.

The process L3U1R1U3L1U1R3U3 moves the three cubies UFL->ULB->UBR->UFL. UFR is not moved. Obviously, when all four corner cubies are in their correct locations this step is finished.

If no U corner cubies are in the correct position apply the process once. Which side is F doesn't matter. Now there is at least one cubie in the correct position. Rotate the cube to put the correctly placed cubie at UFR. One or two more applications of the process will put all cubies in their correct positions.

Step 8 orients the U corner cubies completing the solution.

It is possible that the cube is solved at this point.

The process to be given for this step rotates one cubie CW and a second one CCW. To determine the rotation needed site down a diagonal through the cubie to the center of the cube. It will be obvious which way the rotation must be made.

The process: first orient the cube so cubie to get CW twist is at UFR. Then do R3D1R1F1D1F3. (After this half of the process the cube will appear to be much less solved.) Next rotate the U slice to put the cubie requiring CCW twist at UFR followed by F1D3F3R3D3R1. Finally, rotate U to match U edges with the side face center cubies. 

If only two cubies need to be oriented the application of the process is obvious. Orienting all four corners is also obvious, just apply the process twice.

If three cubies need to be oriented two applications will be needed. The first application will orient a single cubie leaving a pair with opposite twists for the second application.

The cube is now solved!

Other Information

The definitive written account of Rubik's cube is “Notes On Rubik's Magic Cube” by David Singmaster, Enslow, Hillside NJ, 1981. The processes in steps 5) to 8) are from this work.

Googling on “Rubik's Cube Solution” will provide more solutions than you can possibly review. All solutions are a compromise between the complexity of the solution and the number of moves required to restore the cube to the solved state. The solution given above requires a relatively short list of processes and takes a correspondingly larger number of moves. It is not the solution to use if you intend to compete in speed solving contests. A solution for the 3*3*3 cube similar to the one presented here as well as solutions for many other similar puzzles can be found at: http://www.puzzlesolver.com/

Technically, the solution presented is an algorithm – a list of conditions and operations to perform if the condition is satisfied. Algorithms can be carried out manually as described or implemented as a part of computer programs that can be used to instruct a robot to solve an actual cube or to support a graphical display showing a solution. Inventing an algorithm is much more challenging that using one supplied by someone else. The algorithm presented here depends heavily on the work of others.



Pretty Patterns

Following is a list from Singmaster. The names are suggestive of the pattern formed.

two X: F2R2B2L2F2R2B2L2F2R2B2L2
four +: F1B1R1L1F1B1R1L1F1B1R1L1R1L1F1B1R1L1F1B1R1L1F1B1
four X: F2B2L1F2U1D3R2B1R2L2F3L2U3D1B2R3
four spot: R2L2U1D3F2B2U1D3
four Z: F1B1R1L1F1B1R1L1F1B1R1L1U2D2
six-two L: F1B1U1D1R3L3F1B1
six spot: R1L3F1B3U1D3R1L3
six X: R2L2F2B2U2D2
eight flip: R1L1F1B1U1D1R1L1F1B1U1D1
tricolors : R2F1D1R2D3R1B2R3D1R2D3F3R2L2B1D1L2D3L1F2L3D1L2D3B3L2F2R2L2B2R1
zig-zag : F1B1R1L1F1B1R1L1F1B1R1L1
diagonal twist: R1D1R1F1D1F3U3F1D3F3R3D3R1U1R2

To undo a pretty pattern do the process in reverse substituting 1s for 3s and 3s for 1s.

Copyright 2005-2007 John F. Jarvis