Devising an Algorithm for Solving Rubik's Cube
Abstract
If you're the kind of person who has taken apart your Rubik's cube in order to grease the inside parts so it will move more smoothly, this could be a great project for you. We'll show you three sets of move sequences that accomplish specific rearrangements of the cube. Can you devise a way to solve the cube using only these three move sequences?Summary
Andrew Olson, Ph.D., Science Buddies
Sources
This project is based on:
 Cao, C., 2002. A Simple Complexity, illumin 3(2), Fall, 2002. Retrieved December 19, 2006.
Objective
The goal of this project is to devise an algorithm for solving Rubik's cube, using three sets of moves that each accomplish a specific function.
Introduction
Rubik's cube is an interesting 3dimensional puzzle that challenges your spatial imagination and memory. The goal is to arrange the cube so that each side is a solid color, as shown in Figure 1.
Figure 1. Diagram of a solved Rubik's cube. The six sides are named in pairs—updown, frontback, and leftright. The up (U), front (F), and right (R) sides are visible. The remaining sides—left (L), back (B), and down (D)—are shown by the projected images.
Figure 1 also shows the labels we will be using when referring to sides of the cube. The six sides are named in pairs—updown, frontback, and leftright. To refer to a specific side, we'll use the oneletter abbreviations shown in Figure 1 (U, D, F, B, L, R).
The cube is built in such a way that each side, row, and column can rotate (see Figure 2). With a few turns, the colors can be thoroughly mixed up. How can you get all of the squares back to their original positions? It's quite a puzzle to get the colors arranged properly again!
Figure 2. Diagram of the core of a Rubik's cube. The core enables each side, row, and column of the cube to rotate.
In this project you'll learn three sequences of moves that accomplish specific rearrangements of the squares on the cube. Can you figure out how to use these three move sequences to solve the cube?
Before we present the moves, we need to introduce some more terminology, so that we can distinguish individual pieces on the cube. Rubik's cube is made of three different types of pieces. We will refer to them as center, corner, and edge pieces. The puzzle has six center pieces, one in the middle of each face. Each center piece has only one visible face. There are eight corner pieces on the puzzle. Each corner piece has three visible faces. The remaining twelve pieces are edge pieces, occupying the middle position along each edge of the cube. Each edge piece has two visible faces.
Center Piece  Corner Piece  Edge Piece  

Location 



# in entire cube  6  8  12 
Visible faces  1  3  2 
Now we're almost ready to present the move sequences. Remember that each move sequence accomplishes a specific rearrangement of the pieces in the cube. For each move sequence, we'll describe that specific rearrangement both with a diagram and with words. Then we'll describe the move sequence in words and in a shorthand notation. You'll soon find that the shorthand makes it easier to execute the moves quickly and memorize them.
The shorthand notation is easy to learn. There are just five rules you need to know.
 When a side is rotated clockwise one quarter turn, the shorthand notation for the move is simply the letter of the side. For example, if you're supposed to rotate the right side one quarter turn clockwise, the shorthand would be R.
 When a side is rotated counterclockwise one quarter turn, the shorthand notation for the move is the letter + an apostrophe ('). For example, if you're supposed to rotate the right side counterclockwise one quarter turn, the shorthand would be R'.
 When a side is rotated twice (direction does not matter in this case), the shorthand notation for the move is the letter + 2. For example, if you're supposed to rotate the front side twice, the shorthand would be F2.
 For some of the moves, you will be moving only the center column of a side. For a clockwise rotation of one quarter turn, the shorthand is the letter of the side, followed by 'c' (for center column). For example, if you're supposed to rotate the center column of the front side one quarter turn clockwise, the shorthand would be Fc.
 Finally, if you're supposed to rotate the center column of a side counterclockwise one turn, just add an apostrophe ('). For example, if you're supposed to rotate the center column of the front side one quarter turn counterclockwise, the shorthand would be Fc'.
If you are unfamiliar with the Rubik's Cube moves, an online Rubik's Cube solver like the one listed in the Bibliography might help you gain familiarity with the moves.
Move Sequence #1
The first exchanges the positions of three edge pieces at once, altering nothing else. The three affected edge pieces are all on the center column: the bottom and top edge on the left side, and the opposite edge on the top side (see Figure 3). Repeating this sequence three times will restore the cube to its original configuration.
Figure 3. Move sequence #1: exchanging three consecutive edge pieces in the center 'slice' of the cube (yellow arrows at left). No other pieces are altered by this move sequence. Repeating this sequence three times restores the cube to its original configuration.
Detailed move explanation:
 Hold the cube so that the edge pieces are arranged in the center slice as shown in Figure 3. (The fourth edge is in the bottom plane, away from you on the cube, and will not be altered by this sequence.) Note the white side is the front face in Figure 3.
 Rotate the left side clockwise.
 Rotate the right side counterclockwise.
 Rotate the front side twice.
 Rotate the left side counterclockwise.
 Rotate the right side clockwise.
 Rotate the upper side twice.
Shorthand: L R' F2 L' R U2
Move Sequence #2
The second sequence 'cycles' five corner pieces: the four corners of the front face, plus the upper right corner. It also exchanges the positions of three the front side edge pieces, as shown in Figure 4.
Figure 4. Move sequence #2: 'cycling' the four corner pieces of the front face. This sequence changes the positions of five corner pieces (yellow arrows) and three edge pieces (blue arrows). Compare the before and after pictures carefully. Repeating this sequence fifteen times restores the cube to it's original position.
Detailed move explanation:
 Hold the cube so that the corners you wish to rotate are on the front side (as shown above). Note the white side is the front face in Figure 4. The corner which you do not wish to rotate should be at the upper left of the front side.
 Rotate the upper side clockwise.
 Rotate the front side clockwise twice.
 Rotate the upper side counterclockwise.
 Rotate the front side clockwise.
 Rotate the upper side clockwise.
 Rotate the front side clockwise.
 Rotate the upper side counterclockwise.
 Rotate the front side clockwise twice.
Shorthand: U F2 U' F U F U' F2
Move Sequence #3
The third sequence 'flips' each of two opposite edge pieces in the upper layer without altering anything else on the cube, as shown in Figure 5. The two edge pieces wind up back in their original places, but with the original colors 'flipped.' Compare the before and after views to verify that this is true. Note that repeating this sequence twice restores the cube to the original position.
Figure 5. Move sequence #3: 'flipping' two opposite edge pieces (marked by *'s in the 'before' view). The effect of this sequence is to 'flip' each of these two opposite edge pieces, without altering anything else. The two pieces will be in their original positions, but with colors reversed. Repeating this sequence restores the cube to the original position.
Detailed move explanation:
 Hold the cube as shown, so that the edge pieces you want to 'flip' are on the upper side, in the front and back positions. Note the white side is the front face in Figure 5.
 Rotate the center column of the front side clockwise (up).
 Rotate the upper side counterclockwise.
 Repeat steps 2 and 3 two more times.
 Rotate the upper side counterclockwise.
 Rotate the center column of the front side counterclockwise (down).
 Repeat steps 5 and 6 two more times.
 Rotate the upper side counterclockwise two times.
Shorthand: L R' F' L R' D' L R' B2 L' R D' L' R F' L' R U2
Note: Move sequence #3 is much easier to remember (and can be done more quickly) if you move the center column of the front side (a center 'slice' of the cube) rather than moving the left and right sides. Try this out with your own cube and verify that it does the same thing. (Unfortunately, the Java applet used for the animated diagrams does not provide for movements of center slices, so we can't show you this alternate sequence with an animated diagram.) Here is the move sequence in shorthand, using center slice moves (Fc means to rotate the center slice 'up' and Fc' means to rotate the center slice 'down'):
Alternate shorthand: [Fc U'] 3 times, then [U' Fc'] 3 times, then U2.
Can you figure out how to solve Rubik's cube using only these three sequences of moves?
Terms and Concepts
To do this project, you should do research that enables you to understand the following terms and concepts:
 Rubik's cube:
 how it moves,
 terminology:
 corner pieces (8),
 edge pieces (12),
 center pieces (aka side pieces, 6);
 algorithm.
Questions
 How many visible faces does an edge piece have? A center piece? A corner piece?
 Which move sequences don't alter other pieces?
 Are the three move sequences presented sufficient to solve the puzzle?
Bibliography
 This project is based on the following article:
Cao, C., 2002. A Simple Complexity, illumin 3(2), Fall, 2002. Retrieved December 19, 2006.  For information on algorithms, see:
Wikipedia contributors, 2015. Algorithm, Wikipedia, The Free Encyclopedia. Retrieved April 2, 2014.
Potential spoiler alert! Here are some other ways to solve the cube, with stepbystep instructions. Consult these only if you're stuck. They may give you some ideas on alternative strategies:
 Ferenc, D. (n.d.). Online Rubik's Cube Solver Program. Retrieved February 4, 2016.
 Beust, C., 2003. A Rubik's Cube Solution That Is Easy to Memorize,. Retrieved December 19, 2006.
 Lee, J., n.d. Beginner Solution to the Rubik's Cube,. Retrieved April 29, 2009.
 Petrus, L. 1997. Solving Rubik's Cube for Speed,. Retrieved December 19, 2006.
 Youcandothecube.com. (n.d.). You CAN Do the Rubik's Cube. Retrieved November 23, 2010.
Materials and Equipment
To do this experiment you will need the following materials and equipment:
 A Rubik's cube
 Timer
Experimental Procedure
 Do your background research so that you are familiar with the terms, concepts, and questions, above.
 If you can already solve Rubik's cube before doing this project, your first step should be to measure your average solution time. Time yourself for each of 5–10 trials, and calculate your average solution time. The cube should be wellrandomized for each trial.
 Study the three sets of moves covered in the Introduction.
 Practice using each set of moves on your Rubik's cube.
 Verify that each sequence works as described.
 Become familiar enough with each set of moves so that you can step through the sequence in your imagination, without having the cube in your hands or within sight.
 Figure out a logical sequence for applying these three sets of moves in order to solve the cube systematically. In other words, use the three sets of moves as the basis for developing an algorithm to solve Rubik's cube.
 During this step, it is important to determine whether the three move sequences presented in the Introduction are sufficient to solve the cube. In other words, is it possible to solve the cube with only these three move sequences, or do you need additional move sequences?
 If you determine that additional move sequences are needed, be prepared to show why they are needed. Develop one or more move sequences to fill in the missing rearrangements needed to solve the cube.
 Once you have developed your algorithm, time yourself for 10 or more trials and see how long it takes you, on average, to solve the puzzle. The cube should be well randomized for each trial.
 If you could solve the puzzle before you started the project, did your average solution time improve?
Ask an Expert
Variations
 For a more basic Rubik's cube experiment, see the Science Buddies project, What's the Fastest Way to Solve Rubik's Cube?
 Can naive Rubik's cube players use your algorithm to solve the puzzle? Find volunteers with no experience solving Rubik's cube. See if they can solve the puzzle on their own. Record how long it takes them to solve the puzzle, or to give up. Teach them your algorithm, give them some time to practice it, and time them again. Do this for at least five volunteers. Did their solution times improve? By how much, on average?
 Advanced. Are there even faster ways to solve Rubik's cube? Practice on your own, or do some investigation online. How much can you improve your average solution time?
 Advanced. If you have skills in computer programming, learn how to use the Java applet to demonstrate how your algorithm works. The Java applet used to illustrate the moves in this project was written by Karl Hšrnell, Lars Petrus, and Matthew Smith. It can be obtained from: http://lar5.com/cube/downloads.html.
Careers
If you like this project, you might enjoy exploring these related careers: