Rubik's Cube Theory: Commutators

Learn how commutators work on the Rubik's Cube to move or flip specific pieces without memorizing algorithms. The video covers corner cycles, edge permutations, and corner flips using group theory and the setup-move approach.
Chapters
I wanted to give you guys a quick introduction to some of the theory behind the Rubik's Cube. There is a branch of mathematics called the group theory, which is concerned with sets of states and their transitions, and the Rubik's Cube falls perfectly within its definition. So this video will not be about speedcubing. Instead, I'll show you some very cool things that you can do with the Rubik's Cube. I'll basically teach you how to solve it without using any algorithms at all. I categorize this video as an advanced video, but really even a beginner should be able to understand the general concept. The only thing required is a strong familiarity with the notation and some Rubik's Cube common sense. Alright, so before we begin, we have to go over some important things. You have to understand the notion of algorithm inverses. Given an algorithm, for example, F R' U2, we can find its inverse. Now, if we denote this algorithm to be P, Then the inverse of this algorithm, called P', will be just the algorithm that reverses the cube to the state that it was in before we applied P. So in this case, if I apply P', it will just make the cube go back to its solved state. The inverse of P will be U2 R F'. Now, how did I get this sequence? I just read P backwards and I negated everything. So U2 becomes U2, R' becomes R, F becomes F', and that's the inverse of the algorithm. Okay, I'm now going to introduce the notion of commutators. I will first work through an example to show the basic idea, and then I'll talk about it in a more general way. So let's see, I'm going to present you with this random algorithm, which appears to come from nowhere, but just bear with me. I've got this algorithm that completely messes up the top. And it flips this bottom edge. Okay, that's all it does to the bottom layer. So if I were to now apply the inverse of this algorithm, it will just lead me to back, back to a solved state. So what does that inverse do? Well, it will flip this edge back and it will correct the top, right? Well, okay, well, what if I do a D' first now? The inverse will flip this edge and correct the top, right? Well, let's see. If I apply the inverse, flip this edge, correct the top, and look now. It basically flipped these two edges on the Rubik's Cube, and that's all it did. Everything else is left solved. Okay, so that was an example of a commutator. In general, commutators have the form PQP'Q'. In our example, P was the algorithm that flipped the edge in the bottom layer and messed up the top. Q was just D'. Now, P' just flipped that edge and corrected the top, and Q' was just D, which reversed the Q that we did before. So this was just an example, but in general, what you wanna do is you wanna find a series of moves P that modify a small portion of the cube in some way So for us, that change was that we flipped one piece in the entire D layer. That was what the P did. It also messed up everything else, but we don't care about that at all. Then we used Q to somehow modify that portion of the cube in some way, so I just twisted it. That was Q. And then when you undo P' and Q', they will fix everything, and you will have some changes happening in the the portion of the cube that you care about. So that's the general idea. Before you run off and try to make up your own commutators, you should know what you can and can't do to a Rubik's Cube. For example, you can't flip a single edge. Likewise, you can't flip a single corner. Lastly, you cannot perform an odd number of swaps preserving orientation. For example, if you were to just swap these two, that's illegal. You can't find a move that does that. That's why we only have 3 cycles of edges, which are actually made up of 2 swaps of edges, and that's the best you can do on a Rubik's Cube. Okay, now I'm going to show you some other commutators. For example, as it turns out, we can do 3 cycles of corners, of arbitrary corners on the entire Rubik's Cube. So a commutator for cycling 3 corners is pretty easy. For example, R U R' will insert a stick— a corner from the top into the bottom layer, and that's all it does to the bottom layer. So now if I modify the bottom layer slightly, that's my cue, and I'll undo those two. The result, as you can see, is a 3-cycle of corners. So we can use this to do arbitrary 3-cycles on the entire cube if we just use setup moves. So, um, let's see exactly what what this algorithm did. It cycled these 3 pieces, but we have to more specifically look at how it cycled the stickers, not the pieces themselves. This orange sticker used to be here, and this green sticker used to be here, so these 3 stickers are cycled. Similarly, this white sticker used to be here, and this white sticker used to be here, so these 3 stickers are also cycled. So let's choose one of those 3 sticker cycles. Let's choose this, this, and this. So these 3 stickers are cycled. Now we're trying to— we're going to try to recreate the corner 3-cycle. What 3 stickers do we need to cycle to recreate this 3-cycle? We need to cycle these 3 stickers here. So this will basically preserve the orientation and cycle those 3 pieces. So what we need to do is we need to put yellow stickers in these 2 positions and here, perform the algorithm, and then undo those setup moves, and that will give us, that should give us 3-cycle corners. So let's see, I have an algorithm that will do the job. It's pretty long, but it doesn't matter how long they are, it just matters that it works. For example, R' U B' b' u' puts two yellow stickers here and here. So now if we do that algorithm, that commutator, we cycle those three stickers, and now I just have to undo those setup moves that I made, which was u b u' r. As you can see, the result is indeed a 3-corner cycle. I'm now going to show you how to make this 3-cycle of corners using commutators in a different way that is much more cleaner and it doesn't involve any setup moves or things like that. So in that sense, it's much better, I think. So I've got this algorithm that basically— I'm going to show you what it does. It basically just like totally messes up the bottom and the middle, but I don't care about that at all. What I care about is that it swaps these two corners on the top layer. This corner used to be here, this one used to be here, and I preserved their own orientation. So now if I do U and I do the inverses, what do you think is going to be the result? It's going to swap these two and correct the bottom. Well, let's see. As you can see, the result is a 3-corner cycle. Um, you can get another permutation out of this. Let me apply that same algorithm again. Okay, so I've got these two corners swapped, and now instead of just doing U, let me do U2. So it's going to swap these two and correct the bottom. What do you think is now going to be the result? As you can see, this is the E permutation, I think. Swaps these two and these two. So you can get two permutations out of commutators if you just understand how they work, and this is all intuitive, basically. So I've only been talking about corner permutations and stuff so far, but you can do everything that I've talked about with edges as well. You can do edges, edge permutations around the entire cube. You can derive the edge 3-cycles one way, the other way. You can derive the Z permutation You can derive the H permutation, which swaps these two and these two. You can derive all of these things using commentaries as well. For example, find a way that swaps this edge with this edge, preserving the orientation, and messes up the bottom in whatever ways, doesn't matter. Then set your Q to be U or U' or U2. See what they give you, see what you can get. Experiment. I'm leaving this as an exercise to you. So the final thing I want to show you guys is a corner flipper. What I'm going to do is I'm going to take out this corner and put it back in the wrong way. People familiar with F2L should be very comfortable doing this. Now I'm going to do a D' because that's the only thing I changed in the entire down layer, and I'm going to invert all my moves. The result is a corner flipper like this. Changes orientation of two corners but leaves them in place. So, um, that's another cool thing. So anyways, I hope I convinced you that commutators are very interesting sets of moves that are well worth playing around with. They take some time getting used to, but after some practice you will get a very good intuition for them and you'll be able to predict outcomes of different commutators even before you apply them and things like that. I'm putting two links that deal with commentators into the video description if you choose to try and learn more about them. And that's all for now. Bye-bye.
More from Andrej

Skill Issue: Andrej Karpathy on Code Agents, AutoResearch, and the Loopy Era of AI

Andrej Karpathy: Tesla AI, Self-Driving, Optimus, Aliens, and AGI | Lex Fridman Podcast #333








