The solution to Rubik’s cube relies on two main principles.

- Break the problem down into simpler subproblems. We chose the one dubbed
**layer by layer**. - To solve each subproblem,
**recognize the position**, then**alter the position**to bring it one step closer to the solution.

We already outlined a possible implementation of the first, as an useful preface to the Moves section.

### Layer by Layer

As we said, the layer by layer approach breaks down the cube into layers. As you look at the cube, having chosen a top side, you can cut the cube into two horizontal slices, which form three layers. These are the layers we will solve in order. Solve the top layer, then solve the middle layer, then solve the bottom layer and you’ve solved the whole cube. With a catch, of course. When you solve the second layer, you have to make sure not to “un-solve” the first layer. And, when you solve the third layer, you must be careful not to “un-solve” the first and second layers. “But how in the world will I do that?”, you may ask. Well, that’s why I’m writing this article, ain’t it?

### Recognizing a Position

This step involves concentrating on the cubie that you want to move to complete the next of your solution and ignoring the other cubies. Though simple, it is a very important step, as it avoids overwhelming you with the complexity of the cube. You must ignore the cubies that don’t interest you for your layer. When you solve the top layer, you pretty much concentrate on the cubies that include the color you chose as top side color, and ignore the rest. Similarly, in solving the middle layer, you will focus on cubies that are a part of this layer.

Sometimes, a position must be massaged to correspond to the conditions of the move to be performed next. For example, your move cannot be applied as presented, because you can’t trivially place the cubie in the desired position for your move. The trick here is to find situations that are a **mirror** of the situation you want to find yourself in, so that you can apply a mirror version of the move. Or, you may be solving the middle layer and the cubie you need to put in place next is already in the middle layer. In this case, you must perform a move that brings the cubie to the bottom layer, before you can actually put it in place.

It will soon become apparent that most moves work on groups of three cubies. They swap three cubies at a time, or rotate in place three cubies at a time. You may be discouraged to find that there exist positions where you have only two cubies that are not in position. But worry not! As in all these cases, you solve the condition by applying your move multiple times, each time changing three cubies. For example, assume that, out of cubies 1, 2, 3 and 4, only cubies 1 and 2 are not in position. Apply your move to cubies 1, 3 and 4 such that cubie 1 is in position. Now, cubies 2, 3 and 4 will be in the wrong position, and as you can see, you’re back to a “group of 3” situation that you just solve trivially using your move.

### Altering a Position

That’s why we invented moves. The top layer corresponds to simple moves and, hopefully, you can solve any one side on the cube already. The middle and bottom layers, however, must be solved without disturbing the top layer. Based on this condition, I devised the following move discovery heuristic to learn new moves while keeping things simple. Try moving some cubies from the top layer to one of the other layers, by performing a few rotations, then try to bring the cubies back in place. When you put the cubies back in place, you undo the rotations you used, only you already know that doing so will not cause any changes to the cube. Or, you can try to place them back with slightly different rotations, which has a great chance of changing something in the cube at the end of the move. And, because you’re putting the cubies back in their layer, your top layer remains unaffected by the move.

#### Top Layer

OK, while I hope my audience has no difficulty with this layer, I have to come up with something for exhaustiveness’ sake.

- Choose a side.
- Find the center cubie that corresponds to that side.
- Start placing edge cubies around the center cubie by performing simple rotations. Do not worry about the other layers.
- Start placing corner cubies around the center cubie, while not disturbing the edge cubies already in place. You typically do so by moving a group of three cubies to the lateral side, just in place for the corner cubie to slide in, and then bringing the augmented group back.

When placing the cubies, honor the positions that they will occupy in the final state. That is, guide yourself by the center cubies of the lateral sides to ensure the top layer forms a lateral belt corresponding to the final state of the cube.

#### Middle Layer

The second layer is only a bit harder, as you must keep the first layer intact. Of course, it is not about keeping the top layer intact with each rotation you perform, after all, it’s clear that there are only a few *rotations* that leave the first layer intact — rotations of the belt and rotations of the third, bottom layer — and these can’t possibly solve the cube by themselves. No, it’s not about that, it’s about making sure that the layer is intact **at the end of each move**. Yes, you may upset the top layer in the middle of a move, but by the time your move is complete, the layer must be back in position. This is this principle that forms the basis of our solutions to the second and third layers.

Solving the middle layer involves a smaller arsenal of moves than the other two layers. The reasons are at hand. First of all, the center cubies are already in place, on their final side. There are only edge cubies to worry about. Such cubies can be on the third layer, or on the second layer, but in the wrong position. If a cubie is on the third layer, you must bring it near its correct location, by rotating the bottom side. Then, apply Move 1. If the cubie is on the middle layer, apply Move 1 to replace it with a different cubie. Your cubie will then end up on the bottom layer and you will be able to apply Move 1 as usually.

#### Bottom Layer

There are four important steps involving the bottom layer. I always do them in this order:

- Put the corner cubies in their position (though they may not be rotated correctly yet).
- Rotate the corner cubies in place without changing their place. (Now you’re done with the corners.)
- Put the edge cubies in place (though they may not yet be rotated correctly).
- Rotate the edge cubies, without changing their place. (Now you’re done with the edge cubies.)

To address step 1, use Move 2. Perform step 2 using Move 3. Perform step 3 using Move 4 or Move 5, at your choosing. The last step requires a composition of both Move 4 and Move 5, as they have slightly different effects. Be sure to recognize composite positions, where, for example, a swapping that appears to involve only two cubies is actually a composition of swappings of three cubies. Reread “Recognizing a Position” above.