A Gentle Guide to Rubik's Cube Kenneth Sloan 4 April 2008 Rubik's Cube is, like Algol 60, "an improvement over all of its successors". It's a classic. Why? Because it's simple enough to master, but complex enough to allow for many competing points of view. Many guides to the the Cube offer detailed recipes for a solution. A few provide some insight into what's actually going on. A distressing number give an algorithm - but little commentary on why it works. At least one simply says (over and over again) "at this point there are 14 cases to memorize - look here for the correct sequence of moves to apply in each of these 14 cases". In this "gentle guide", the goal is to provide just enough information so that the reader can solve the Cube - while still leaving a few puzzles to solve along the way. We will start by giving the absolute minimum number of "macros" (canned sequences of primitive moves) to get the reader started. Then, we provide an outline for a (tedious) method of solving the Cube using only these essential macros. Once the reader can solve the Cube (slowly), we introduce a few more macros. These are either designed to handle special cases which crop up during a solution, or are just interesting in their own right. As we add non-essential macros, we consider alternate paths to a solution. First, we hint at modifications to the original (tedious) method. Next, we consider radically different points of view. And finally, we consider rotations of the center cubies - which only matters if you have a Cube with pictures on the sides instead of uniformly colored sides. Notation The Cube is manipulated by rotating a slab of 9 "cubies" as a unit. There are nine (9) such units. Each unit can rotate either clockwise, or counter-clockwise. To notate a primitive move, we use the first letter of the slab being rotated. An uppercase letter indicates a clockwise rotation; a lowercase letter indicates a counter-clockwise rotation. Six of these slabs are the faces of the Cube: Left, Right, Up, Down, Front, Back. Left and Right are from the point of view of the person holding the Cube. Front faces the holder; Back faces away. Three of these slabs include the center of the Cube: Vertical, Horizontal, Middle Vertical is flanked by Left and Right. Horizontal is flanked by Up and Down. Middle is flanked by Front and Back. V rotates the Vertical slab in the same direction as R; H rotates like U; M rotates like F. V, H, and M are somewhat more difficult to do, so we tend not to use them. When absolutely necessary (or in the rare case where it is more elegant), we rotate a central slab (usually V). Some sequences of rotations are best thought of as units - but aren't important enough to give names to. So, we use () as punctuation. The () are just hints - feel free to ignore them, or to group differently. Instead of rotating a central layer, we may rotate the two flanking layers. For example: V = (Lr) + rotate the entire Cube in the "R" direction H = (Ud) + rotate the entire Cube in the "D" direction M = (Fb) + rotate the entire Cube in the "B" direction When you see one of these pairs of parallel rotations, feel free to do them in either order. In other words, L commutes with r. Beware: in general, rotations do NOT commute! (Lu <> uL) We sometimes rotate the same face twice. We could write either (UU) or (uu). There are various reasons to prefer one over the other. Sometimes the direction of motion is a hint that helps us remember the overall effect of the macro. Sometimes we prefer to stress the fact that one piece of a macro is the inverse of an earlier piece. For exemple: ...UU...uu... Note that when we rotate a central layer by rotating the two layers on either side, we also change the "pose" of the Cube. Most of the time, this is not a problem, and in fact we prefer the change in pose. Sometimes (Lr) is more natural, and sometimes V is more natural. Cubie types: There are three distinct classes of cubies. FACES are fixed in position (the only way to change position is to change the pose of the Cube). Note that FACES can rotate, so if we are paying close attention we need to keep track of their orientation. However, in the usual 6-colored Cube these orientations are invisible. We will generally ignore them. EDGES can travel to 12 different locations. At each location, there are 2 possible orientations. CORNERS can travel to 8 different locations. At each location there are 3 orientations. Essential Macros There are 18 primitive operations (LlRrUuDdFfBbVvHhMm). In theory, the optimal solution to any scrambled Cube is simply a sequence of these primitive operations. Humans aren't very good at this, so we use heuristics and milestones to guide us from the scrambled Cube to the solved state. The milestones generally involve achieving some interesting property of the Cube and then maintaining that property as we work on other properties. The different flavors of solutions involve different choices for the properties we are trying to keep invariant. It's impossible to keep most interesting properties invariant after every primitive operation, so instead we define macros. The macros take larger steps toward a solution than the primitive operations, and, more importantly, we don't look too closely at the state of the Cube during the execution of the macro. In general, the macros: 1) modify 2 or 3 cubies in the way we want to move towards the goal, 2) modify other cubies as side effects. The side effects don't move us towards the goal, but (if we are careful) don't destroy the invariants we are trying to maintain, and 3) may disrupt invariants while in progress. Some macros have an obvious two-phase structure, in which invariants are trashed in the first phase and restored in the second. The more macros you have "in your fingers", the more choices there are in solving the Cube. But, it's interesting to ask what the minimal set of macros might be. At the same time, we should consider what invariants are worth achieving and maintaining, and what the milestones should be. Many guides to solving the Cube teach you to proceed by layers. This is attractive because: 1) any idiot can solve a single layer; there are simple macros which handle the simple problems found in the first level. 2) it's relatively easy to track your progress when the cubies fall into place layer-by-layer. The problem is that the number of macros you need is a bit large (different macros to solve similar problems in each level). Also, the layer-by-layer progress doesn't help to illuminate the deep mathematical structures inherent in the Cube. On the third hand, it will turn out that some sort of layer-by-layer approach is useful from time to time - to make sure you aren't looping. We will start with a method which is a little difficult for people to track, but which uses only 4 macros. Even better, the 4 macros we use make mathematical sense. The relevant concepts are: position and orientation of CORNERS and EDGES. It turns out that everyone needs to learn these 4 macros eventually (in most other methods, these are used only to solve the last layer). Why not learn them FIRST...and learn the special-case shortcuts later? Well...because the essential macros are like scales and arpeggios. Advanced players know how important it is to have these things "in your fingers" - but beginners want to get on with it and play "real music". If you want a simple recipe to memorize - you've come to the wrong place. Here, you have to practice your scales - in all 12 keys. Here are the 4 essential macros: a) Flip two EDGES (front-up and left-up): -leaves everything else unchanged. Flip = F(Ud)(LL)(UUdd)R{u}r(DDuu)(ll)(Du)f{U} Notice the operations grouped by (). (Ud) is our way of rotating the Horizontal slice (and changing the pose of the Cube). We could have written: Flip = Fh(FF)(hh)F{u}f(hh)(ff)HfU but this version doesn't feel very natural. (LL) is just a double rotation. (UUdd) = (UdUd) is just (hh) + a change of pose. And so on. This macro looks complicated at first glance, but it's very easy to understand (which is why we learn it first!). Watch carefully what happens to the front-up EDGE and the two neighboring CORNERS during the first half of the macro, and then watch how the (originally) left-up EDGE replaces the (originally) front-up EDGE and travels back to the right place, at its new orientation. Practice this macro until it it "in your fingers". Ideally, you should do this with a solved Cube so that it's easier to see what's going on. But, in practice, you'll probably make a few mistakes and scramble the Cube. Not to worry - you'll get it back to the original state, eventually. DO NOT move on to the next step until you can perform "Flip" flawlessly without looking at the Cube. Performing "Flip" flawlessly is a bit like juggling one ball. It's not very impressive to watch - but if you can't do it how can you even think of tackling anything harder? Exercise: consider the {u} and {U}. Modify the operation to flip the up-back up-right EDGE instead of the up-left EDGE. And again to flip the up-back EDGE. Question: Clearly, Flip = Flip^-1. Can you prove this algebraically? b) Twist the two CORNERS at the front of the up face. -leaves everything else unchanged. Twist = (rDR)(FDf){u}(Fdf)(rdR){U} Notice that the front-right-up CORNER rotates clockwise and the front-left-up CORNER rotates counter-clockwise. Practice, as above. "DO NOT move on ..." Question: what does Twist^2 do? For what n is Twist^n = I? c) Rotate three EDGES (left, back, right in the up face) clockwise: -keeps all other CORNERS and EDGES in the same location and orientation -changes the orientation of two of the three EDGES participating in the rotation Rot = (Lr)F(Rl)(UU)(Lr)F(Rl) of course, to rotate the three EDGES counter-clockwise, we use: Rot^-1 = (Lr)f(Rl)(uu)(Lr)f(Rl) instead of Rot^2. Again, practice until Rotate is "in your fingers". "DO NOT move on..." Notice that (uu) is preferred over (UU) because it helps re-inforce muscle memory about the direction of rotation. On the other hand, it's hard to choose between (lR) and (Rl). I tend to use (Lr) and (lR). Again, (Lr) is the same as "V + rotate the entire Cube so that the old Front face is the new Up face". So, we could write: Rot = VUvUUVUv and Rot^-1 = VuvuuVuv This version looks more elegant than the first version, and (with a little practice) is actually easier to do. I originally learned the first version, but now prefer the second version. Exercise: carefully observe the orientations of the three EDGES participating in the rotation. Which EDGES simply rotate, and which EDGES both rotate and flip? Question: does Rot^3 = I? Why, or why not? Prove it. Suppose we care about the orientation of the FACES. Is Rot^3 = I? d) Swap two CORNERS at the back of the up face: -keeps all other CORNERS in the same locations -twists (clockwise) the other two CORNERS in the up face -rotates (clockwise) the four EDGES in the up face Swap = (FubU)(fuBU)U Practice, practice, practice... "DO NOT move on..." What does Swap^2 do? Note that Swap^2 <> I, because of the side effects. For what value of n is S^n = I? SOLVING THE CUBE You now have a suffficient set of transformations to actually solve the Cube. WARNING: it's moderately difficult for humans to monitor their progress along the way. But, I recommend learning to do it this way, without using any other transformations. It's harder at the beginning, but it will pay off in the end. Plan on making mistakes halfway through the solution and going back to square one - over, and over, and over again. Step 1: Use Swap (and Swap only) to position the 8 CORNERS. Don't worry about orientation - just position. This will be tedious (you'll be tempted to look for shortcuts - resist the temptation for the moment). Practice until you can do this quickly. Then, look for ways to get all 8 CORNERS in position using shortcuts. You'll still need Swap to finish the job, but you can get close (faster) with ad hoc sequences of primitive operations. (For example, it should be very easy to put the first CORNER in the correct location, and the second should be almost as easy!) On the other hand, there are no shortcuts to placing the last two CORNERS - you'll have to use Swap for those two, no matter how clever you are. Aren't you glad you learned Swap? Step 2: Use Rot (and Rot^-1 - but nothing else) to position the 12 EDGES. Don't worry about orientation - just position. Unlike Step 1, this can be tricky (because you are moving 3 EDGES at each step.) Also, notice that you can't use ad hoc sequences as you could in Step 1, because you must maintain the positions of all of the CORNERS, and Rot is just about the only way to move EDGES around while leaving all of the CORNERS undisturbed. Remember to double-check the positions of the CORNERS from time to time. Develop a particular order in which to tackle the EDGES. You will eventually discover that you can easily loop forever as fixing one EDGE will destroy another. Practice until you figure out where the sticking point is. Then solve that problem. Practice until this step is "in your fingers". There are a few non-essential macros which could be used to get you past the sticking point in Step 2 - but I think it's better to solve the problem of getting all the EDGES in place (while keeping the CORNERS in the right place!) by using Rot only. Besides, that gives you a (fairly easy) puzzle to solve on your own. HINT: sometime you want to move two EDGES and don't care where the third one goes - while at other times you want to move all three EDGES to specific locations. And (extra hint) sometimes you may have to move an EDGE that is already in the right place, to set up a situation where you simultaneously re-place that EDGE and place a different EDGE. Practice until you have enough experience so that the previous sentence makes sense to you. Step 3: Use Twist to orient the 8 CORNERS. As in Step 2, you will occasionally make a mistake and accidentally destroy the work you've done in Steps 1 and 2. So, periodically double check to see that all cubies are still in the correct locations. Step 4: Use Flip to orient the 12 EDGES. You will very occasionally run across a small problem. Practice until you run across this "small problem"...and then solve it. Note that the order of some of the Steps above is arbitrary. Step 3 can be done after Step 1. In fact, you could even orient each CORNER when you position it - this would blend Steps 1 and 3. On the other hand, some of the above Steps must be done in the order given. If you try to do Step 2 (position EDGES) first, you will discover that using Swap to position the CORNERS will (as a side effect) move the EDGES. [It will eventually turn out that we can, indeed, place the EDGES first and then tackle the CORNERS - but let's save that for later...much later. If you are looking for a real challenge, try to figure out how to do this before reading any further. Good luck!] Summarizing, our first method is: Step 1 - position CORNERS using Swap = (FubU)(fuBU)U Step 2 - position EDGES using Rot = VUvUUVUv Step 3 - orient CORNERS using Twist = (rDR)(FDf){u}(Fdf)(rdR){U} Step 4 - orient EDGES using Flip = F(Ud)(LL)(UUdd)R{u}r(DDuu)(ll)(Du)f{U} Non-essential macros Here, we'll collect some non-essential macros that may lead to shortcuts and solve "sticking points". Swapping in an EDGE EdgeSwap1 = (FUUR)UU(ruuf) EdgeSwap2 = (luub)UU(BUUL) These two macros move an EDGE from the up face to the left EDGE of the front face. EdgeSwap1 brings in the EDGE that starts at up-back. EdgeSwap2 brings in the EDGE that starts up-right. Alas, they also completely scramble the entire up face. Consider EdgeSwap1: -the front two CORNERS are swapped -the back two CORNERS are swapped and twisted. -the front and right EDGES are swapped and flipped. Clearly, this is a mess if you are trying to maintain CORNER positions. It's not a problem if you are solving layer-by-layer and haven't done anything to the top layer, yet. (See Method 2, below) Pay close attention to the orientation of the EDGE that you bring into the middle layer. Note that you have a choice. Consider that it might be easier to put this EDGE in the right place and at the correct orientation in one step - leaving you with less work in the final "flipping" stage. Yet Another EdgeSwap EdgeSwap3 = FUfuluL EdgeSwap4 = fuFURUr These two macros move the up-back EDGE to the front face. EdgeSwap3 moves up-back to front-left. EdgeSwap4 moves up-back to front-right. In both cases, the old up color moves to the front. They also completely scramble the entire up face. Consider EdgeSwap3: -the front two CORNERS are swapped -the back-right and (new) front-left CORNERS are twisted -the front and right EDGES are swapped and flipped I prefer EdgeSwap1/2 over EdgeSwap3/4, primarily because EdgeSwap1/2 always fills the front-left EDGE. I also think that there's a certain logic to it which only becomes apparent after much practice. The last reason is suspect, because I have more experience with EdgeSwap1/2 than with EdgeSwap3/4, so I'm probably biased. If we count individual twists, EdgeSwap1/2 take 10 while EdgeSwap3/4 taks only 7. But, if you count (uu) and (UU) as one action, then you are back to 7 each. Functionally, they are equivalent. They place (and orient) an EDGE in the middle layer. They trash the top layer - but they are both intended to be used in situations where nothing has yet been done to that layer. Yet Still Another EdgeSwap EdgeSwap5 = FufulUL EdgeSwap6 = fUFURur These are very similar to EdgeSwap3/4. The difference is in how the up face is scrambled. Consider EdgeSwap5, which does the same "up-back to front-left" EDGE movement. As side effects, it: -moves front-left EDGE to up-right -moves up-right EDGE to up-left -moves up-left EDGE to up-back (and flips it) -twists up-right-back CORNER -swaps up-left-back and up-left-front, while twisting the new up-left-back There's a nice Group Theory story to tell about EdgeSwap3/4, having to do with commutators and 3-cycles. I'm not sure if there's a similar story for EdgeSwap5/6. In any event, my comments on EdgeSwap1/2 vs EdgeSwap3/4 apply here, too. Another Twist Rotate3Corners Rotate (counter-clockwise) the left-front, right-front, and right-back CORNERS -flips all three CORNERS as they rotate -keeps all other CORNERS and EDGES in the same location and orientation Rotate3Corners = (FubU)(fuBU) The alert reader will note that: Swap = (Rotate3Corners)U Exercise: think about the relationship between "swap two corners" and "rotate three corners". Go back and tackle the task of positioning all of the CORNERS using only Rotate3Corners. This will turn out to be very useful, I promise! Some sources prefer to rotate the left-back, left-front, and right-back CORNERS, and give: Rotate3Corners' = (URul)(UruL) Note that: Rotate3Corners = (UU)(Rotate3Corners')(UU) One early source gave *both* FubUfuBUU (for Swap) and URulUruL (for Rotate3Corners'). I think it's best to use FubUfuBUU and FubUfuBU. Your milage may vary. Exercise: work out the relationship between (URul)(UruL) and (FubU)(fuBU) Another Rotate Rotate three EDGES (left, back, right in the up face) clockwise: -keeps all other CORNERS and EDGES in the same location and orientation -keeps the same orientation of the EDGES participating in the rotation, in the sense that the faces in the up face remain in the up face Rot2 = (BB)U(lR)(BB)(Lr)U(BB) To rotate counter-clockwise: Rot2^-1 = (BB)u(lR)BB)(Lr)u(BB) Rot2 looks better than Rot, because it doesn't flip the EDGES. But, we rarely care about the orientations of the EDGES when rotating, and the original Rot just *feels* better to me. It seems to me to be easier to remember, and easier to perform. Your milage may vary. Yet Another Rotate? Rotate three EDGES (left, back, right in the up face) clockwise: -keeps the same orientation of the EDGES participating in the rotation, in the sense that the faces in the up face remain in the up face -swaps diagonal diagonal CORNERS, flipping 3 of them! Rot3 = RUUruRur To rotate counter-clockwise: Rot3^-1 = RUrURuur The question is...is this an operation on the EDGES or on the CORNERS? I've presented it as a way to rotate three EDGES - but the inventor considers it as a method of re-arranging the CORNERS. Note that whichever way you look at it, you are re-arranging *both* CORNERS *and* EDGES. Rot is clearly more versatile as a way to rotate EDGES (because it does not disturb the CORNERS). Rotate3Corners is more versatile as a way to re-arrange CORNERS, because it does not disturb the EDGES. but, Rot3 may come in handy if you are using a "CORNERS and then EDGES" or an "EDGES and then CORNERS" approach. Swap Diagonal CORNERS and scramble EDGES in the up face Swap the front-left and back-right CORNERS of the up face -Keeps everything in the bottom two layers untouched -swaps front-left-up with back-right-up -flips the new front-left and back-left CORNERS -moves EDGES in the up face from right to back to front to left to right. -flips the new front-up and back-up EDGES SwapD = UFURurf This is useful when moving corners around - when you don't care about EDGE locations or any orientations. It's much: faster than the three ordinary Swap macros that would otherwise be required. But...it should not be very high on your list of macros to memorize! Also, consider the massive side-effects. It's only really useful if you are positioning CORNERS without regard to the positions of the EDGES (or, if you are solving layer-by-layer and haven't positioned any EDGES in the top layer). Flip opposite edges Attributed to Rubik himself, this macro requires V - rotate the Vertical layer inbetween Left and Right. I find it easiest to do this by rotating V and R together (keeping L stationary) and then rotating R back again. FlipOpposite flips the front and back EDGES in the up face -all other CORNERS and EDGES keep the same orientation FlipOpposite = VUVUVUUvUvUvUU Exercise: What happens to the 6 FACES? Twist EDGES around a CORNER Moves the up-front, front-left, and left-up EDGES clockwise around the up-front-left CORNER. -up-front to front-left to left-up to up-front -swaps and flips up-right-front and down-left-front -swaps up-front-left with up-back-left, while flipping the new up-back-left EDGESaroundCORNER = lULu Question: for what n is (lULu)^n = I? HINT: it's not 3. Another Twist Twists the up-right-front CORNER clockwise and the up-left-front CORNER counter-clockwise. Twist2 = (FDfd)(FDfd){u}(DFdf)(DFdf){U} As above, modify the {u} and {U} to rotate a different CORNER counter-clockwise. Yet Another Twist Twists the up-right-front CORNER clockwise and the up-left CORNER counter-clockwise. Twist3 = F(DD)fr(dd)R{u}r(dd)RF(DD)f{U} As above, modify the {u} and {U} to rotate a different CORNER counter-clockwise. For all of the Twists, pay special attention to the path taken by the CORNER being twisted. Twist sends the twisting CORNER to the right and back, and then to the left and back. Twist2 uses the same basic motion for the twisting CORNER, but applies the other motions in a different order. Notice the ...d{u}D... in the middle of Twist2. Is it clear that this can be re-written as simply ...{u}? So...why is it there? For mathematical "beauty", perhaps. (FDfd) makes such a nice, tidy unit. (DFdf) is (FDfd)^-1. Hacking out the unnecessary d...D makes the operation a bit faster - but not as pretty. Twist3, on the other hand, sends the CORNER being twisted on a very different route. After being brought to the Down layer, it is tucked far away from the main action while the Right and Front layers are re-arranged. In some ways, Twist3 is much simpler than Twist and Twist2. Probably because I learned it first, I use Twist. It is a bit shorter (but is it faster?) than Twist2 (even if hacked) and Twist3). But, Twist3 seems easier for the novice to remember. Twist2 is only attractive to Group Theory nerds. More Solutions There are many paths to Rome. It all depends on what you consider to be useful milestones along the way. Method 2 - Prototypical layer-by-layer Step 1 - completely solve the top layer Step 2 - turn the Cube over and solve the second layer Step 3 - solve the third layer - now at the top. We leave Step 1 as an Exercise - except to note that you should position (and orient) the EDGES first. With practice, this is nearly trivial. Positioning (and orienting at the same time) the CORNERS in the first layer is easy, but there are a few tricks, which you will pick up with enough practice. We give one hint: to move (and position) a right-front-down cubie which is "face-down", use rDRFddf. Note that this flips the front-right EDGE and does massive violence to the bottom layer. But...in Step 1 we only care about the top layer. Step 2 involves repeated application of EdgeSwap1 and EdgeSwap2. This Step is, in fact, the main reason to define EdgeSwap1 and EdgeSwap2. Note that the main advantage of EdgeSwap1 and 2 is that there are no side effects for the bottom two layers. All of the problems are pushed into the (new) top layer. Step 3 is also left as an exercise. You will need to position and orient the CORNERS and then the EDGES. You already have the necessary macros "in your fingers". Aren't you glad you practiced your scales? More methods will be collected here...RealSoonNow The last solution is perhaps the most elegant, and appears to be the current favorite of "official" sources. ULTIMATE SOLUTION Step 1 - Position and orient all EDGES. Step 2 - Position and orient all CORNERS Wasn't that easy? OK, here are a few details: Step 1 proceeds by layers: Layer 1 - Position and orient EDGES in the top layer - this is trivial. Layer 2 - Use EDGESaroundCORNER = lULu (and either UluL or FufU) to position and orient the middle layer EDGES. (HINT: you really only need lUL , and Fuf) Layer 3 - (again, this is now the top level) Use Rot (and Rot^-1) to position the EDGES. Then, use Flip to orient them. Step 2 Use Rotate3Corners to position the CORNERS (note that - unlike Swap - Rotate3Corners does not disturb the EDGES). Then, use Twist to orient the CORNERS. Step 2 has several variants, depending on how much you can keep track of at once. The easiest way is to not worry at all about orientations and to first simply sort the CORNERS by "top" vs. "bottom". If you are lucky, you can then work on the top layer and then finish by working on the bottom layer. Alas, there is a trap here. Practice until you find the trap. Then, solve it. HINT: you have to stop thinking of 2-layers and instead think of 4-sides. Finally, if you are exceedingly clever, you might try to position AND orient CORNERS using only Rotate3Corners. To do that, you'll have to pay attention to how CORNERS are flipped as they are Rotated. In my opinion, it may actually be faster to avoid this "optimization", and instead get very good at first positioning and then orienting the CORNERS. Note that it's different when positioning the EDGES (especially in the first two layers). There, it is so easy to orient as you position that it would be silly not to do so. In Step 2, however, there is so much to keep track of that it might well be faster to concentrate on getting Rotate3Corners and Twist "into your fingers", and to not spend any time analying to choose among several choices while positioning. You may do more operations, but each operation will be blazingly fast. That is, if you practiced your scales... Rotating the center cubies If your Cube has pictures on the side rather than uniformly colored sides, you will discover that you are not done, yet. You have positioned and oriented the EDGES and CORNERS, but the CENTERS may be rotated. Of course, the CENTERS are positioned perfectly (you can't move them!) There are two macros to rotate CENTERS. One rotates a pair of CENTERS by 90 degrees each (one CENTER goes counter-clockwise and the other goes clockwise). The second macro rotates a single CENTER by 180 degrees. Rotate Two Centers Rotates the left CENTER 90 degrees clockwise. Rotates the top CENTER 90 degrees counter-clockwise. RotateTwoCenters = vhVUvHVu Rotate One Center Rotates the top CENTER 180 degrees. RotateOneCenter = URLUUrlURLUUrl