# Rubik’s Cube Math

Over the Christmas break, while on vacation with extended family, my son learned how to solve the Rubik’s Cube (a.k.a. magic cube) from his older cousin. He became somewhat obsessed and worked on it until he could solve it himself. One of the things he told me when he got his new cube was, “Mom, the colors can be arranged in over 43 quintillion ways!” This is why it is so hard to solve; there are too many different permutations. You’d never land on the solution by randomly turning the sides. The number of permutations is calculated with the equation:

The first term, 8!, comes from the fact that there are 8! (read 8 factorial) ways to arrange the 8 corner “cubies” (8! = 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1). The next term is 37, because there are 3 colors on a corner cubie and 7 of the corners can be oriented independently. (“Oriented” differs from “arranged” in that arranged refers to moving a cubies to different locations on the cube, while oriented refers to the cubie being at the same corner but rotated to show a different color on top.) The orientation of the eighth cubie depends on the preceding seven. The next term, 12!, is the number of ways to arrange the edges. This term must be divided by 2 because it is an even permutation. Eleven edge cubies (with 2 colors each) can be flipped independently, with 12th depending on the preceding ones, giving 211.

If you are interested in a more in-depth explanation, there is a powerpoint presentation here, and paper here.

Most people solve the Rubik’s cube by memorizing sequences of moves called “algorithms”. In mathematics, the term algorithm means a step-by-step procedure for calculations. Many algorithms, especially those used later in the solution, are designed to move a cubie to a specific spot without moving parts of the cube that have already been moved into place. If you are interested in learning basic algorithms for solving the cube, there is a solving guide available at Rubiks.com. People into “speedcubing” learn algorithms that make it possible to solve the cube in fewer moves, but requires learning more algorithms used with specific patterns on the cube.

Puzzles like the Rubik’s Cube can also be investigated through mathematical group theory. Group theory is the study of the algebraic  structures called groups. A group is a set of elements together with an operation that combines any two of its elements to form a third element also in the set while satisfying the group axioms (these are closure, associativity, identity and invertibility). For example, the set of integers together with the addition operation; the addition of any two integers forms another integer. The Rubik’s group is the group corresponding to possible moves.