Rubik's Cube & Abstract Algebra

My goal today is, hopefully, to have you understand a method by which you can solve the Rubik's Cube (and in fact, any one of what they call 'twisty puzzles' - so long as they are not 'deep cut') intuitively, without the need to memorize algorithms. The Rubik's Cube behaves in a predictable manner which can be characterized, mathematically, as a form of algebra - abstract algebra. Ideally, it'd be best if you had a Rubik's Cube in your hand, but even if you don't, I am convinced you will still be able to see the logic and come to realize that it really isn't hard at all (mostly just muscle memory).

Before diving in, I want to point out an aside on abstract algebra so the jargon will not be as daunting - which it really isn't. Specifically, I will be talking about the commutative property in algebra. Given two numbers, for example 2 and 5, we say addition is commutative because 2 + 5 = 5 + 2. That is, we can swap the variables in our operation and the outcome is the same. Similarly, multiplication is commutative, 2 × 5 = 5 × 2. Now this is not necessarily true - there are algebraic operations that aren't commutative, such as division (I leave that to you to think about).

The same concept applies in abstract algebra - we no longer assume operations are inherently commutative. In abstract algebra, there is a property of an algebraic operation called a Commutator which gives an "indication of the extent to which a binary operation fails to be commutative". The Commutator of two elements in an algebra, say, Q and P is [Q,P] = Q · P · Q-1 · P-1 where · denotes the operation concerned (not necessarily multiplication) and raising to the negative one power means the associated inverse of the element under that operation. For example, in standard algebra under the operation of addition with the elements 2 and 5 we would have [2,5] = 2 + 5 + (-2) + (-5) = 0. Or with multiplication we have [2,5] = 2 × 5 × (1/2) × (1/5) = 1.

Notice how, because addition and multiplication are commutative, the value of the commutator is equal to the Identity element associated with the operation. That is, the Identity element for addition is 0 and the identity element for multiplication is 1. The Identity element of an operation is the element for which when the operation is carried out between that element and any other element, will return the other element unchanged - so Q + 0 = Q, and Q × 1 = Q. In abstract algebra, specifically in the case of non-commutative operations, the commutator will most likely not be equal to the associated Identity element. And it is this deviation from the Identity element that indicates the extent to which the operation fails to be commutative.

In the case of the Rubik's Cube, our elements are no longer numbers, they are physical manipulations on the cube - say, rotating a face clockwise. And, in fact, they could be any number of manipulations concatenated together - which we refer to as an 'algorithm'. Let's take a look at one algorithm now.

Notice what this algorithm does, it flips one corner clockwise and another corner counterclockwise. Now let us dissect what is happening in the language of abstract algebra, specifically, that of commutators. I am going to break this algorithm up into four pieces - Q, P, Q-1, P-1. This is exactly the commutator I've been referring to, I will be performing [Q,P] = Q · P · Q-1 · P-1. Let me first demonstrate Q and its inverse Q-1.

What does Q do? Pay close attention to the video. Q rotates a corner clockwise and leaves the rest of that top face unchanged. However, it completely screws up the bottom two layers. So, what happens when I perform Q-1? Well, it's going to rotate that same corner on the top face back counterclockwise - fixing it's orientation - AND it's going to completely fix the bottom two layers as well, leaving us back with a solved cube. Let's see that again.

Notice how performing Q and then its inverse Q-1 right after, we are returned the solved cube as we should expect. Why? Because an inverse by definition will invert what was done irregardless of the whether or not an operation is commutative - that is the definition of an inverse. So Q · Q-1 will always be the Identity element - nothing is changed (Q · Q-1 = Identity).

Similarly, let me now show you P and its inverse P-1.

Hilariously short right? I'm just turning a face and then turning it back.

Now comes the heart of the trick, I will now perform the commutator [Q,P] = Q · P · Q-1 · P-1.

What happened? I just created the first algorithm I showed you! ORIENTATION MATTERS when performing manipulations. By performing P in between Q and Q-1, I am replacing the spot wherein the corner will be rotated counterclockwise in Q-1. Had I not performed P - that is rotating the top face - I would've just performed Q · Q-1 and be reverted back to the solved cube. After performing Q · P · Q-1, I've essentially rotated one corner clockwise and another counterclockwise. And performing P-1 just brings the top layer back to its original orientation. One more time.

Notice that this commutator is not the Identity because we are not returned a solved cube. But also notice, we've only made a very small change to the solved cube - that is we rotated one corner clockwise and another corner counterclockwise. If Rubik's cube manipulations were commutative, we would expect a solved cube after performing the commutator, but because the operation of Rubik's cube manipulations are not commutative, we instead get a 'small' deviation from the Identity element - a measure of the extent to which Rubik's cube manipulations fail to be commutative (not exactly pertinent information, just interesting).

This went waaayyy longer than I expected - for that, I apologize. Once again, if you've made it this far, thank you for reading, I truly appreciate it. I hope it was as fun of a read for you as it was for me to write. I will make a second part in the coming week (or two) to give you 3 more commutators with which you can solve the entire Rubik's cube. And with practice, you will learn to make your own and be able to solve any non-deep-cut twisty puzzles. As always - stay happy, stay strong, stay passionate, and take care of yourselves.