# Rubik's Cube Puzzle

A Rubik's Cube is a 3-dimensional mechanical puzzle invented in 1974 by Erno Rubik. The device is a cube, where each side is subdivided further into nine more smaller cubes in a 3-by-3 grid. There are a total of 26 of these smaller cubes, also affectionately referred to as cubies. There are 8 corner cubies which lie on the corners of three faces. There are 12 edge cubies which each lie on the edges of 2 faces, and 6 center faces, which each lie on only one face.

Each face of each cubie has one of 6 different colors.

Looking at any one of the 6 faces, face on, you can divide the cube into 3 planes, where the plane closest to you contains 9 cubies, the plane farthest away also contains 9 cubies, and the plane in the middle contains 8 cubies. You get such a decomposition from any of 6 ways of orienting the cube, but they come in pairs, which are the same. Each plane, from any orientation can be independently rotated any multiple of ninety degrees, permuting the cubies and the colors on the cubies.

The puzzle is considered solved when each face has only one color on it.

It is possible to solve a Rubik's cube with the center cubies rotated. Since a normal Rubik's cube has only a single color to a side, it is impossible to tell if a center cubie has been rotated in place. Some Rubik's Cubes have pictures on their faces instead of solid colors, and with these, one must get the orientations of the central cubies corrected, as well as everything else. These puzzles are much harder to do.

## How Solve a Rubik's Cube

There are a multitude of ways to solve a Rubik's Cube. The way that we will discuss is called solving by layer, and is conceptually one of the easiest ways to solve the cube. However, it is far from the quickest.

First we will need a way to talk about places on the cube and rotation of the cube.

We fix an orientation of the cube and hold it constant for the whole time. The 6 central cubies (one per side) will not move while we solve it.

- F - front face or 90 degree clockwise rotation thereof
- B - back face or 90 degree clockwise rotation thereof
- L - left face or 90 degree clockwise rotation thereof
- R - right face or 90 degree clockwise rotation thereof
- U - top face or 90 degree clockwise rotation thereof
- D - bottom face or 90 degree clockwise rotation thereof

We will solve the Rubik's cube layer-by-layer. We solve the top layer first, then the middle layer, and then the bottom. The reason that this is such a slow way to solve the cube is that once we get the first layer into place, in order to make any more progress, we must disrupt what we have already built, shuffle some stuff around, and then reconstitute what we broke up.

The essence of this solution is to find combinations of moves which leave most of the cube invariant.

### Top Layer

#### Top Edges

You have to get the top edge pieces into position before the corner pieces

Get the selected edge piece into position, and rotate it to the top.

#### Top Corners

To get a corner into position, rotate the side face where you want to corner to go by 90 degrees so that that corner is on the bottom. Rotate the selected corner cubie into that face. Rotate that face back into its original position. Now the selected corner is in position without disrupting anything else on the top layer. Repeat for the other four corners. If the corner piece you want is already in the top layer, repeat the trick to dislodge the selected corner piece without disrupting anything else.

### Middle Layer

On the middle layer, we only need to get the edges into position because we consider the central faces to be stationary.

#### Middle Edges

Orient the cube so that the edge you want to place into the middle layer is on the bottom below and to the right of where it should go. Also the edge should have the correct color on the front face. If this is impossible, then simply do the mirror image of the following instructions.

Do the following moves: DLDDDLLLDDDFFFDF. Now that edge is in the correct position.

If the edge you want is already in the middle layer, but in the wrong position or orientation, then use this sequence of moves to dislodge it into the bottom layer, and then put it back correctly.

### Bottom Layer

The bottom layer is the hardest, because we have two full layers on top that cannot be disturbed.

#### Orient Bottom Edges

Look at the bottom face. Now consider it the top face. The object is to get the right color facing up. If you need to get to rotate two opposite edge pieces, on on the top and one on the bottom, do FURUUURRRFFF. If you need to rotate the cubie on the right and bottom, use FURUUURRRFFF.

#### Permute the Bottom Corners

To swap the two corners in the front right and the back right, use LUUURRRULLLUUURUU.

Any other combination of swaps can be achieved by using this move repeatedly.

#### Orient the Bottom Corners

Twist three corners on the last layer by using RRRUUURUUURRRUURUU. This permutes the front-right, front-left, and back-right edges. Using this move repeatedly will orient the bottom corners correctly

#### Permute the Bottom Edges

Permute the front, back, and right edges by using RRUFBBBRRFFFBURR. Again, use this move until the edges are in the correct positions.

And now the cube is solved!