Computer Science Entertainment Issue II

A Simple Complexity

About the Author: Charles Cao

In Fall 2002, Charles Cao was a sophomore in the Class of 2004 and was majoring in Computer Engineering and Computer Science and minoring in Multimedia at the University of Southern California.

Created as a teaching toy twenty years ago, Erno Rubik’s cube quickly became a popular toy that entertained, challenged, and confounded millions of people. The cube consists of a core and attached outer cubes designed to allow rotation on three axes. Rubik’s cube can be used to study permutations and algorithms, as well as serving as a test for artificial intelligence systems to learn and develop their own algorithm. Three distinct types of movements can help players solve the cube.


Kleiner/Wikimedia Commons
Figure 1: The modern Rubik’s cube.

There exists a simple toy that captures the interest of countless people, regardless of age, gender, or education, a toy that requires no batteries or electricity and costs only a few dollars to produce. What type of toy could possibly encompass all of these elements? The answer is deceptively simple: a cube.

Erno Rubik’s cube has sparked curiosity around the world for nearly a generation (Fig. 1). Individuals of all ages have spent weeks trying to solve the puzzles. Those who succeed often spend even more time trying to create new patterns in the colors of the cube. Professors have written entire papers totally dedicated to the mathematics behind the cube.
So, what exactly is the cube? Rubik’s cube is an engineering marvel that demonstrates mathematic and computer science concepts. This paper will discuss the origin of the cube, the engineering principles at work in the cube, and simple techniques that can ultimately solve Rubik’s puzzling toy.

History of Rubik’s Cube

Erno Rubik is a native Hungarian born to a poet and an aircraft engineer [1]. In college, Rubik studied sculpture and later went to study architecture at the Academy of Applied Arts and Crafts in Budapest. After graduating, Rubik stayed at the Academy to teach interior design . As a teacher, Rubik developed a habit of creating models to demonstrate his designs to students [1].
Rubik’s cube was conceived as a teaching tool, not a toy. He wanted to demonstrate structural design by creating a three dimensional object that could rotate on all three axes. Furthermore, he wanted the object to stay intact as it rotated [2]. Rubik originally experimented with a 2x2x2 cube to figure out how to make such a mechanism. To keep the pieces together, Rubik tried several techniques: elastic rubbers, magnets, and a system of grooves. Unfortunately, all these methods failed . He then came up with the idea of using the shapes of the individual pieces to hold the object together. This led to a success; Rubik created his rotatable cube.
Rubik marked the sides with adhesive paper and tested the cube by rotating several sides. He became captivated by how beautifully the colors mixed, apparently at random. However, when finished testing the cube, Rubik noticed he could not figure his way back to the original configuration. Rubik found that randomly rotating the cube would never bring back the original design. He decided that the only way to solve this cube was to make calculated moves, each with a specified purpose. After a month of experimenting, Rubik solved the cube. He then demonstrated the cube to his students, with whom the cube became extremely popular. The legacy of Rubik’s cube spread from this small group of students to the 1979 Nuremberg Toy Fair and eventually to the entire world.

Rubik’s Mechanics

It is difficult to understand the mechanics of the cube without first understanding the component parts. Rubik’s cube consists of two distinct components: the core and the outer cubes. The shape of the core can be envisioned as a central cube with six attached octagons, one on each face (Fig. 2). Each octagon is attached to allow free rotation in either direction.
Fi​gure 2: The shape of the core can be envisioned as a central cube with six attached octagons, one on each face..

The face of each octagon is parallel to the face of the imaginary central cube. The eight sides of each octagon are perpendicular to that imaginary cube. These will be referred to as the sides of the octagon.

Attached to this core piece are the outer cubes, of which there are three types: the sides, the edges, and the corners. There are a total of six side pieces (Fig. 3), each has only one visible face in the final construction of the cube. Each side piece attaches to one of the octagons of the core; side pieces are only pieces that never move in relation to the core.
Fi​gure 3: There are only six side pieces in a Rubik’s cube.

There are twelve edge pieces total (Fig. 4), each with two visible faces. There is an extension off the non-visible faces of each edge piece to connect it to the core. This extension’s shape is similar to a smaller cube.

Finally, there are the eight corner pieces (Fig. 5). They each have three visible faces. There is also an extension on each corner piece. This extension looks similar to a small cube with a corner cut off. Again, the connecting extension is positioned on the non-visible back corner.
Fi​gure 4: There are twelve edge pieces in a Rubik’s cube.

Figure 5: There are eight corner pieces in a Rubik’s cube.

One side piece, four corner pieces, and four edge pieces fit together to form one face of a Rubik’s cube. Each face is labeled with a unique solid color. The side piece is the center of the face, and the edge and corner pieces become the edges and corners of the face. The extension off the side piece fits directly on to the core’s octagonal face. The other extensions fit on to the edges of the octagon.

Together, these twenty-six pieces make up Rubik’s cube. The extensions connect tightly to the octagons of the core, which allow it to lock to the adjacent pieces. Because each octagon can rotate, the edges of the cube can be rotated from their original position. When one of the core’s octagons turns, it rotates the nine connected outer cubes with it. As rotation occurs, these cubes are locked with each other and the core. After sufficient specific rotation, the cube can be returned to its original shape, though not its original position. After just a few random rotations of different sides, the colors of the edges and corners may be very well scrambled.

As a Mathematics Teaching Tool

The variations of possible cube configurations have inspired mathematicians to study Rubik’s cube. However, the most common type of cube study focuses on permutations and algorithms. Permutation is the ordering of a series of elements, in this case, the ordering of the faces of the cube. An algorithm is a step-by-step guide that outlines the procedure for a task.
University professors have often used Rubik’s cube as a case study for permutations. Rubik’s cube acts as an example of what the complex counting equations can be used for. These equations show that the number of permutations of Rubik’s cube exceeds 43 quintillion [3]! Rubik’s cube demonstrates the usefulness of these equations, as it would be impossible for any one person to physically count each permutation.
Rubik’s cube has also been used to teach algorithms. More often than not, these algorithms are generic and work not only for Rubik’s cube, but for several other problems as well. One such example is the “Bestfind” algorithm. This algorithm creates a coordinate grid to label each face. It then notes the effects of each of the twelve different possible moves5. Using this data and a series of formulas, the “Bestfind” algorithm calculates an efficient method of solving Rubik’s cube. This system of coordinates can then be transferred to any number of applications, such as Internet search engines.

Rubik’s Cube in Computer Science

Mathematics is not the only field benefiting from Rubik’s cube. Computer scientists have programmed online games of the cube, and use Rubik’s cube to test artificial intelligence.
Programmers have already begun to translate the physical cube to an online variation. It is not uncommon to see Rubik’s cube as an assignment to advance a programmer’s logical development. It can also improve graphics and animation programming skills. As a result, several students have programmed virtual Rubik’s cubes and several copies of the code can be found online for studying.​
Fig​ure 6: Adjusting a Cube.

Rubik’s cube has also been a useful tool to measure artificial intelligence, otherwise known as AI. AI learns new material by computing different inputs with different weights to gain a result [3]. Weights are numerical values that determine how much emphasis an input has on the output. By comparing the calculated result to the desired result, in this case a solved cube, the AI should modify the weights to get closer to the desired result [3]. The Rubik’s cube has been used as a test for the AI to learn and develop its own algorithm. Programmers will give the AI a scrambled virtual cube and observe its attempts at
solving the cube.

Solving Rubik’s Cube​
Fig​ure 7: Swapping Two Cubes.

Solving Rubik’s cube by reading step-by-step instructions is too easy. It takes the challenge out of the cube, and with it, the fun. Instead of listing out steps to solve the puzzle, try these three different moves that help in solving the puzzle by switching or adjusting different pieces. Adjusting a piece means to rotate the direction a color faces on a piece (Fig. 6). Switching pieces refers to swapping the position of two different pieces (Fig. 7). A row is one of the three horizontal divisions of the cube. A column is one of the three vertical divisions of the cube.​
Fig​ure 8: Move #1.

Move #1 – a move to adjust two consecutive edge pieces (alters nothing else) (Fig. 8)
1. Hold the cube so that the two edge pieces being adjusted are vertical on the top face
2. Rotate the center column up
3. Rotate the top row left
4. Repeat steps 2 and 3 two more times
5. Rotate the top row left
6. Rotate the center column down.
7. Repeat steps 5 and 6 two more times
8. Rotate the top row left two times.​
Fig​ure 9: Move #2.

Move #2 – a move to adjust three corners of a face (alters adjacent edge pieces) (Fig. 9)
1. Hold the cube so that the corners are facing you and the unaltered corner is to the top right
2. Rotate the top row right
3. Rotate the forward face clockwise twice
4. Rotate the top row left
5. Rotate the forward face clockwise
6. Rotate the top row right
7. Rotate the forward face clockwise
8. Rotate the top row left
9. Rotate the forward face clockwise twice​
Fig​ure 10: Move #3.

Move #3 — a move to switch the positions of three edges on the same plane (alters nothing else) (Fig. 10)
1. Hold the cube so that the plane to be altered is the center column
2. Position the fourth edge in the plane to the bottom position away from you on the cube
3. Rotate the center column up
4. Rotate the top row left twice
5. Rotate the center column down
6. Rotate the top row left twice


Erno Rubik’s cube has undoubtedly sparked the interest of anyone who has handled it. This single cube has inspired professors to write papers and articles. It has inspired mathematicians to calculate its every characteristic. It has demonstrated mathematics and computer science concepts to students. It has brought entertainment to countless people across the globe. Whether inspiring amusement, thought, or bewilderment, Erno Rubik’s cube has riddled the world for an entire generation, and could do so for many more


    • [1] M. Bellis. (19, Mar. 2002) Rubik and the Cube [Online]. Available: http://inventors.min​​ekly/aa040497.htm
    • [2] “The Novelty Toy Hall of Fame.” Maxim, Apr. 2001, pp. 146-147.
    • [3] A. Billard. Class lecture. Computer Science 499. University of Southern California. Hedco Neurological Building. March 2002.
    • [4] (20, Mar. 2002) “Brief History of the Cube.” Rubik’s Online [Online]. Available:​behistory.html
    • [5] W.D Joyner. (20, Mar. 2002) “Lecture Notes on the Mathematics of Rubik’s Cube,” [Online]. Available:​.mil/~wdj/rubik_nts.​htm
    • [6] D. L. W. Miller. “Solving Rubik’s Cube” [Online]. Available: http://www.sunyit.ed​u/~millerd1/RUBIK.HT​M
    • [7] Encyclopedia Britannica Online. (20, Mar. 2002). “Rubik, Erno” Encyclopedia Britannica. Encyclopedia Britannica Online. Search: Rubik, Erno [Online]. Available: http://www.britannic​

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *