The Rubik’s Cube

And now for something completely different.  In my spare time I’ve been learning how to solve the Rubik’s Cube, almost entirely by following the beginner’s solution on Ryan Heise’s website. He gives a way to do it with only four different sequences you need to memorise, and the site has cool animations of the moves.  He also shows how to do it without memorisation and has a good page on the maths of the cube.

Here are my notes on his approach. They are not a sophisticated analysis, just an effort to record it so I can come back in a few years’ time and save some time relearning it.

I’ll use Singmaster notation for moves, where a clockwise turn of the frontwise face is labelled `F`, an anticlockwise turn `F'`, and the other faces are back `B`, left `L`, right `R`, up `U` and down `D`. (We won’t need `D`.)

Also, to take the “mirror image” of a sequence, just substitute:
`R` ↔ `L'`
`L` ↔ `R'`
`F` ↔ `F'`
`U` ↔ `U'`.

The first layer

You build up the completed cube by layers. The first layer is fun to work out without any memorised moves, but you can refer to earlier link for details. One useful strategy I learnt there is to focus first on the edge piece and then on the corner pieces.

The second layer

The second layer is where I have always got stuck in the past, as any moves you make cannot affect the first layer any more, making it much harder. I did work out my own way of moving an edge piece from the top layer down into the second layer; unfortunately it does affect one other piece in the second layer, so it can only ever be part of the solution.  For the record, to move the piece from the top-right edge to the front-right edge, in the same orientation, the sequence is:

`U2R2U2RU2R2`

But the better sequence in this situation (because it does not affect any other pieces in layer 2) is:

`(U'F'UF)(URU'R')`

Moves like `U'F'UF` are called commutators in group theory.  If `U` and `F` had no edges in common, then the sequence would have no effect. But because they do share an edge, this sequence winds up affecting three edges: the upper-left, the upper-front, and the front-right edges.

Then `URU'R'` affects the upper-back, upper-right and front-right edges.

For this move, we don’t really care what happens to the upper face, so it is only the impact on the front-right edge that matters, since it contains one corner of the first layer, and the edge piece we want to replace.  If you think through where that corner piece of the first layer goes, it gets caught by the moves: `(.F'UF)(U.U'R') = F'UFR'` . That’s interesting – we know this piece ends up where it started, but that is not obvious from this analysis. The mysteries of the cube!

If you can’t get any pieces on the right side in the correct orientation, you will need to do it on the left side using the mirror image of the above sequence.

The third layer

That brings us to the third layer, which will take four separate steps.

The cross

First, you want to form a cross on the top.  At this point, you are only aiming to get the upper colours correct, not the side colours. If you can make a little J on the top layer (i.e. the back and left edge pieces have the right colour on top), then use:

`R'(U'F'UF)R`

This flips the orientation of the front and right edges and rotates the left, front and back edge pieces anti-clockwise.  (It also plays havoc with the corners.)

You can see that it can only affect the top layer from my earlier reasoning: `U'F'UF` only affects the upper-left, upper-front, and front-right edges.  By enclosing it in `R'-R`, that front-right edge gets transformed into the upper-right edge – so the sequence affects only the upper-left, upper-front and upper-right edges (it leaves the single upper-back edge piece alone).

If you have a straight line instead of a J to start, put the straight line across from left to right and you can use this sequence to turn it into a J.

The whole face

I find this the trickiest step to remember, not because the sequence is hard, but because you need to orient the cube properly before you use it.

If you have just one corner with the right colour on top, then put it in the front-left position. Do you now have the top colour on the front face on the right, and on the right face at the back? If so, you can now do the sequence:

`(RUR')(U)(RU2R')`

This flips the three corners other than the front-left, and rotates all the corners 180 degrees around the upper face.  I know saying it “flips” the corners is not precise – there are three sides to the corners, so there are two ways they can flip.  That’s partly why I find it hard to remember how to use this move.

(The move also rotates the edge pieces, without flipping, like so: the front is unchanged while the others are rotated anti-clockwise around the upper face.  Ryan uses this fact to re-use this move for another purpose later.)

If you have just one corner with the right colour on top, but the sequence didn’t work, you will need to put that corner in the front-right and use the mirror image sequence.

If you have zero or two correct top colours on the corners, then you need to know what orientation to hold the cube before using it. This is harder to remember.  See Ryan Heise’s website for the correct orientations. I tend to just keep trying the move over and over, sometimes mirror-imaging it, until something works…

Position the corners

Now that the top face is all the right colour, it is just a matter of rotating the corners and edges around the top face.  Start with the corners.  This sequence will leave the edges untouched and the front-left corner untouched, and rotate the other three corners clockwise around the top face:

`R'(FR')(B2)(RF')R'(B2)R2`

This is pretty tricky, and the only way I can get my head around it is to think through how it affects each piece.

It’s also interesting that with this info, you can think of two ways to rotate the corners anti-clockwise: you could perform the mirror image of this move (starting with the correct corner in the front-right), or you could apply the inverse of this move (i.e. work backwards to undo the move you just did).  These are two very different sequences of moves that have the exact same effect on the cube. More mysteries of the cube!

Position the edges

You can rotate the three edge pieces, other than the back one, clockwise around the top face using the “whole-face” move above, then rotating the entire cube clockwise as viewed from above, and finally performing the mirror-image of the “whole-face” move, i.e.:

`(RUR')(U)(RU2R') [whole cube clockwise] (L'U'L)(U')(L'U2L)`

You have now solved the cube!

Conclusion

Writing this has helped me to understand a little better how these moves work, and certainly to remember them.  I hope it’s helped you too!  I’d love to hear if you’ve seen it explained better somewhere else – I’m just learning this as I go.  Also please let me know if you spot any errors in what I’ve written.

2 thoughts on “The Rubik’s Cube”

1. Oren says:

I bet it’s not nearly as easy