# Commutator

A **commutator** is a sequence of moves that consists of doing a sequence A, then a sequence B, then the inverse of the sequence A (*aka A'*) and finally the inverse of the sequence B (*aka B'*). As a result, only specific pieces are affected. It allows one to finish the cube without other disturbing pieces that are already in place.

## Contents

## Mathematical definition

Given a group, a **commutator** is an element of the form *ghg'h'* (also denoted [*g*, *h*]), where *g* and *h* are elements of the group with inverses *g'* and *h'*.

Cube notation is very close: A B A' B' = [A, B]

## Fundamental principle

It is straightforward that A A' does nothing, as well as B B', because A' is the inverse of A and B' the inverse of B. Also A A' B' B.

So the commutator A B A' B' does change something only because B A' is not the same as A' B. When B A' = A' B, or B A = A B, we say that the elements A and B commute. In this case, A B A' B' = A (B A') B' = A (A' B) B' = I where I is the identity.

For example for L and R or U and D. In this case, the commutator does nothing: L R L' R' = L L' R R' = I

So in some way, the commutator allows you to measure to which extent the moves do not commute.

## Effect

To help us discuss how a commutator works we will first define some terms.

The image on the right gives a visual indication of which pieces of a cube are affected by the different sequences of a commutator. In the example commutator chosen, the sequence A is F and the sequence B is U, giving the simple commutator [F, U].
Referring to the image, the sequence A changes the pieces at a set of locations we will call **J**. The sequence B changes the pieces at a set of locations we will call **K**. We will call the intersection of **J** and **K**, **N**. If **J** and **K** have no intersection, such as when A equals L and B equals R, then A and B are said to commute, and the commutator [L, R] does nothing. However if, as in the image, when **J** and **K** do have an intersection, A and B generally do not commute and the cube, as a result, is changed by the commutator. Note that the changes which this particular commutator make to the cube are rather difficult to understand, however more straight forward commutator examples will be discussed in a moment.

There is a set of locations that we will be calling **N**A'. This name is appropriate because the pieces can be identified by applying the inverse of A to the locations **N**. Referring to the lowest right hand cube, these particular locations are identified using two shades of grey. Pieces that are lighter grey are pieces that will be brought into the intersection region **N**, pieces that are darker grey are pieces that are already within the intersection region and will remain in the region. Such pieces will however be moved within the region, as in this case, or will be twisted in place.

All of the above statements regarding the **N**A' region is also true for **N**B' region.

The only pieces that are affected by any commutator are the ones located in the union of **N**, **N**A' and **N**B'. In other words, pieces that are affected by a commutator are those who are at the intersection of both moves, or are brought into the intersection by A or B. Other pieces, even if they are temporarily mixed up after the sequences A and B are executed, will be put back into their original locations with sequences A' and B'.

This restoration of all the pieces that are not in the union of **N**, **N**A' and **N**B' is the reason the commutator is such a powerful tool.

Click the following thumbnail for an image similar to the one just discussed which instead uses the more common commutator [B' D B, U'].

### Trivial case

When **J** and **K** have no intersection, A and B commute, so the commutator does nothing.

### B inplace

If **N**B' = **N**, the sequence B only moves affected pieces that are inside the intersection. It may also move pieces that are outside the intersection, but those moves will be cancelled at the end. Affected pieces will only be **N** and **N**A'. So those pieces will be in **J**, i.e. among pieces that are directly affected by A.

In this case, it is relevant to consider that [A, B] = (A B A') B' = [A: B] B'. First part is the conjugate of B by A, and second part is the inverse of B.

If [A: B] and B' interfere, there is a quirk part P_{Q} (see general case).

#### Examples

Let's consider [M', U2] = M' U2 M U2

In this example, **N** are the top-front and top-back edges. **N**B' is **N**U2, which is exactly **N**, and **N**A' are front-bottom and front-top edges. So affected pieces are top-back, top-front, and front-bottom edges, which are directly affected by M and M'. In other words, affected pieces are in the middle slice.

The conjugated move is U2. Because only middle slice pieces are changed at the end, we can safe ignore top-left and top-right pieces. The relevant part of U2 is just a swap of top-back and top-front edges. Thus, M' U2 M swaps front-top and front-bottom edges.

So [M', U2] can be understood as: swap front-top and front-bottom edges, then swap top-back and top-front edges, which yields a 3-cycle of edges.

There is a quirk part, the front-bottom edge, which is affected by both [M': U2] and U2, i.e. by all four moves of the commutator.

Let's consider [M2, U2] = M2 U2 M2 U2

Again, **N** are the top-front and top-back edges. But there is no more interference between [M': U2] and U2, thus no quirk part. Simply, top-front and top-back edges are swapped, as well as bottom-front and bottom-back edges.

### A inplace

The image on the right breaks down a commutator that twists two corner pieces. In the type of commutator being discussed in this section, the sequence A does not move pieces into the intersection region but only moves or twists pieces that are already within the region. As a result, the **N**A' region and intersection region **N** are the same. In this particular commutator, the sequence A twists the single piece that is in the intersection region counter-clockwise. (Refer to the cube image which shows the effects of sequence A on the cube) Note that, as for all commutators, sequence A moves or twists all of the pieces that are in the **J** region, however any changes to that region which are outside of the intersection region are undone by sequence A'. If one performs this commutator on a cube or runs this applet they will see that the piece at **N**B' gets twisted clockwise when sequence A' is restoring the rest of the **J** region.

To appreciate sequence B's interaction with the intersection region one can observe the general nature of a commutator. Looking at the mathematical structure of a commutator, A B A' B' one can see that it has two overlapping conjugates. ie A B A' B' = (A B A') B' = A (B A' B'). (If one is unfamiliar with conjugates it is critical that one read the lead of the conjugate page now before continuing.) It is the action of the second conjugate, B A' B', that is apparent in this type of commutator. Because sequence A' only alters the contents of the intersection region, sequence B can be viewed as the initial setup move of a conjugate, A' can be viewed as the actual manipulation move and B' can be viewed as the restoring move. Regarding this specific commutator, because sequence A twists the corner piece at **N**A' counter-clockwise, the sequence A', which is acting as the middle manipulation sequence of a conjugate, twists the corner piece at **N**B' clockwise.

In this next example, the sequence A again does not move pieces into the intersection region resulting in the **N**A' region and intersection region **N** being the same. However in this commutator, the sequence A moves pieces around within the intersection region. Specifically, it exchanges the only two pieces that are in the intersection region.

Everything else discussed regarding the previous example applies here as well.

Here is an applet of this commutator

In summary: Sequence A initially alters the pieces that are in the intersection region, then sequence B, acting as the setup move of a conjugate, moves a different group of pieces into that intersection region. Sequence A' then, while restoring the rest of region **J**, "reverse alters" those new pieces and sequence B' finally returns both altered groups of pieces back to their original locations.

#### Examples

Let's consider the inverse of [M', U2] which is (M' U2 M U2)' = U2 M' U2 M = [U2, M'] = U2 [M': U2]. The relevant part of U2 consists in swapping top-back and top-front edges, and [M': U2] swaps top-front and front-bottom edges.

Other examples:

- A = "rotating a corner" like [R' D' R D R' D' R, U]
- A = "flipping an edge" like [R' E' R2 E2 R', U]
- A = "exchanging two corners" like [R' L' D2 R L, U]
- A = "exchanging two edges" like [M2 D2 M2, U]

### Three different sets

When **N**A' and **N**B' are not included in **N**, there are three sets involved in the commutator:

**N**A' : pieces that are brought into the intersection by A**N**B' : pieces that are brought into the intersection by B**N**: the intersection of**J**and**K**, i.e. where A and B interfere.

Note that **N**A' can have locations in common with **N** and **N**B' can have locations in common with **N**. In other words, it is possible that a sequence (A or B) does two different things in the context of a commutator:

- moving pieces inside the intersection (from
**N**to**N**) - bringing pieces into the intersection (from
**N**A' \**N**to**N**or from**N**B' \**N**to**N**)

When there is only case 1, it is in fact the cases studied before. So we are left with those possible cases:

- Case 2 only: the three sets
**N**A',**N**B' and**N**are completely separated (no overlap) - Case 1 and 2 at the same time: the three sets overlap

#### No overlap

Referring to the animation below, when sets do not overlap, the commutator can be summed up by:

- A stores the content of the intersection P
_{N}in**N**A, and replace it with some pieces P_{A}from**N**A' - B stores P
_{A}in**N**B, and bring some pieces P_{B}from**N**B' into the intersection - A' retrieves P
_{B}from the intersection and places them in**N**A', and brings to the intersection previously stored pieces P_{N}in**N**A - B' retrieves P
_{N}from the intersection and places them in**N**B', and finally places P_{A}in the intersection.

So it is a 3-cycle of (P_{N}, P_{A}, P_{B}) into (P_{A}, P_{B}, P_{N})

We notice that **N**A and **N**B are used as temporary storage:

- The content of the intersection, P
_{N}, is first hidden by A in its storage**N**A, and comes back with A', so that the only transformation applied to these pieces is B'. - The content of
**N**A' is brought by A, and is then hidden by B in**N**B, so that the only transformation applied to these pieces is A. - The content of
**N**B' is brought by B, and then is placed immediately in**N**A' by A'. So the transformation applied to these pieces is B A'.

Note that **N**A may or may not overlap with **N**A', and **N**B may or may not overlap with **N**B', but that it does not have any implication, except that the location where the pieces come from can also be the location where they are temporarily stored. The most obvious case is when **N**A equals to **N**A', or **N**B equals to **N**B', which means that pieces of the intersection **N** are swapped with pieces of **N**A' or **N**B', as in [R2, F2]

In other words, all the commutator does is:

- P
_{A}goes A - P
_{B}goes B A' - P
_{N}goes B'

##### Examples

- [R' E2 R, U'] is a 3-cycle of edges, where P
_{A}is the back-left edge, P_{B}is the top-front edge and P_{N}is the top-right edge. - [R' D' R, U'] is a 3-cycle of corners

#### Overlap

This is the most complex case, because it is like the "no overlap" case, but with additional interferences.

##### Safe part

Some pieces in the intersection **N** are hidden in a storage, thus protecting them from being scrambled by the interference due to the overlap.

Let's call **H**_{B} the location of pieces hidden by B:

**H**_{B} = ((**N**B) \ **N**) B'

Similarly, pieces are hidden by A:

**H**_{A} = ((**N**A) \ **N**) A'

We will also use pieces that are hidden by A' so that they are not affected by B':

**H**_{A'} = ((**N**A') \ **N**) A

In order to get the same results as in the "no overlap" case, we will redefine the set of pieces:

- P
_{A}will be pieces that are brought into**H**_{B}by A, i.e. pieces that are at the beginning in**H**_{B}A'. This set may overlap with the intersection**N**. - P
_{B}will be pieces that are brought into**H**_{A'}by B, i.e. pieces that are at the beginning in**H**_{A'}B' \**N** - P
_{N}will be pieces that are hidden by A, which are at the beggining in**H**_{A}.

We get the same result as before:

- P
_{A}goes A - P
_{B}goes B A' - P
_{N}goes B'

###### Example

Let's consider [R', F]. The intersection **N** is the front-right column (containing the front-right-top corner, the front-right-bottom corner and the front-right edge).

**H**_{B} = ((**N**B) \ **N**) B' = ((**N**F) \ **N**) F'
which is the set of locations containing the front-right edge and the front-right-bottom corner.

So P_{A} are front-right-top corner and top-right edge.

**H**_{A} = ((**N**A) \ **N**) A' = ((**N**R') \ **N**) R

So P_{N} are front-right edge and front-right-bottom corner.

**H**_{A'} = ((**N**A') \ **N**) A = ((**N**R) \ **N**) R'
which is the set of locations containing the front-right-top corner and the front-right edge.

P_{B} are pieces at **H**_{A'}B, i.e. front-top edge and front-top-left corner.

So the safe part of [R', F] is similar to a 3-cycle pairs, but is clearly not a 3-cycle of pairs.

- P
_{A}goes R', thus replacing P_{N} - P
_{N}goes F, thus replaces a part of P_{A}and a part of P_{B} - P
_{B}goes FR, thus replacing a part of P_{A}and the top-right-back corner (the quirk part**Q**) - the top-right-back corner is affected by all moves, R'FRF' = [R': F] F' equivalent to UF', or R'FRF' = R' [F: R] equivalent to R'U, thus going to the top-front-right position, replacing a part of P
_{B}

The quirkiness is that the locations of those pairs overlap, and that an extra location is used, the top-right-back corner. Pieces that are initially in this location are moved according a special scheme (see below).

In this example, the top-right-back corner goes to the top-front-right position, thus being separated from the edges around it.

##### Quirk and conjugated part

Some pieces are outside of the pseudo 3-cycle and never hidden. Let's call their starting location the quirk part **Q**.

**Q** = (**H**_{A'} \ **H**_{B}) A'

Those pieces P_{Q} are never hidden, thus being affected by all moves of the commutator:

- P
_{Q}goes A B A' B'

Some pieces are outside of the pseudo 3-cycle, but are hidden by A or B at some point. So they are conjugated. Let's call them P_{C} and their starting location **C**.

**C** = (**J** union **K**) \ (**H**_{A} union **H**_{B}A' union **H**_{A'}B union **Q**)

In the overlap case, either **Q** or **C** is non empty, so there are at least 4 sets of pieces: P_{A}, P_{B}, P_{N} and P_{Q} or P_{C}.

In complex cases, there may be five sets with both P_{Q} and P_{C}.

The quirk part and the conjugated part are used as final locations for pieces that go outside of the pseudo 3-cycle.

###### Example

Let's consider [R', F']

**H**_{A} is the front-right edge and the front-right-bottom corner. So P_{N} is the set of pieces at these locations.

**H**_{B} is the front-right edge and the front-right-top corner. So P_{A} is the top-right edge and the top-right-back corner.

**H**_{A'} is the front-right edge and the front-right-top corner. So P_{B} is the front-bottom edge only.

The quirk part is :
**Q** = (**H**_{A'} \ **H**_{B}) A' = empty

The conjugated part is :

**C** = (**J** union **K**) \ (**H**_{A} union **H**_{B}A' union **H**_{A'}B union **Q**) = front-right-top corner and front-bottom-left corner

The front-right-top is affected by R'F'R so it is equivalent to x'F'x which is U'.

The front-bottom-left is affected by F'RF so it is equivalent to z'Rz whichi is D.

So this move does :

- P
_{N}, i.e. front-right edge and front-right-bottom corner, goes F - P
_{A}, i.e. top-right edge and top-right-back corner, goes R' - P
_{B}, i.e. front-bottom edge, goes F'R - the front-right-top corner goes U'
- the front-bottom-left goes D

## General case

Pieces can be affected by one, two, three of four elements of the sequence A B A' B'. The gives use the different sets of pieces. For each element of the sequence, there are two possibilities, either a piece is affected by this element, or it is not. So there is a maximum of 2^{4} = 16 sets.

If a piece is not affected by any element, it means that it is completely outside of the commutator.

### Pieces affected by one element only

If a piece is affected by A only, then it is not affected by B and then it is necessarily affected by A', so it is impossible. Same thing for B. If a piece is affected by A' only, it means that it was not affected by B before that, so that it was affected by A. Impossible again. If a piece is affected by B' only, it means that it was not affected by A' before that, so that it was affected by B. Impossible again.

### Pieces affected by two elements

If a piece is affected by A and A', or by B and B', it means that it comes back finally where it comes from. We can ignore them.

If a piece is affected by A and B only, it means that it is not affected by A', so it is necessarily affected by B'. Impossible. If a piece is affected by A and B' only, it is not affected by B, so it is necessarily affected by A'. Impossible again.

If a piece is affected by B and A', it means that it is brought into the intersection by B. They are denoted P_{B}.

### Pieces affected by three elements

If a piece is affected by A and A' B', it means that it is hidden by A so that it is not affected by B. These pieces are denoted P_{N} because they come from the intersection.

If a piece is affected by A B and B', it means that it is brought into the intersection by A, and then hidden by B from A'. These pieces are denoted P_{A}.

If a piece is affected by B A' B', it means that it is brought into the intersection by B and then moved inplace by A. If a piece is affected by A B A', it means that it is affected by the conjugate of B. In both of these cases, let's denote them P_{C} to express that they are affected by conjugates.

### Pieces affected by all four elements

If a piece is affected by all four elements, it means that it is never hidden from the intersection. Thus it is in the quirk part. They are denoted P_{Q}.

### Summary of sets of pieces

In all cases, pieces that are moved by the commutator are in one of these sets:

- P
_{A}: pieces moved into the intersection by A and then hidden by B - P
_{B}: pieces moved into the intersection by B and then hidden by A - P
_{N}: pieces hidden by A and then moved out of the intersection of B' - P
_{C}: pieces affected by a conjugate, in all inplace cases and some overlap cases - P
_{Q}: pieces moved by all elements of the sequence of the commutator, in complex inplace cases and some overlap case

## Classification

If P_{A} is not empty, then B can hide pieces, thus P_{B} is not empty either. Conversely, if P_{B} is not empty, then P_{A} is not empty.

If P_{N} is not empty, then A and B can hide pieces, thus P_{A} and P_{B} are not empty. Conversely if P_{A} is not empty, it means that pieces are brought into the intersection so that pieces are brought out of the intersection by A, thus P_{N} is not empty.

So either the three sets P_{A}, P_{B} and P_{N} are not empty or the three sets are empty. If these sets are empty, it means that at least A, B or both A and B move pieces inside the intersection **N** only. So it is either a trivial case or an inplace case. If both A and B move pieces inside the intersection, let's call it "double inplace".

If it is an inplace case and not a "double inplace", then some pieces are affected by a commutator. Thus P_{C} is not empty.

If the sets P_{A}, P_{B} and P_{N} are not empty, we cannot deduce anything about P_{Q} or P_{C}. If it is the no overlap case, then pieces are hidden either by A or B, so P_{Q} is empty. Conversely, if P_{Q} is empty, then pieces brought by A into the intersection are completely hidden by B. The inverse of the commutator B A B' A' shows that also A hides pieces brought by B, so that it is a no overlap case.

So we get the following possible types of commutators:

- trivial commutator which is equivalent to the identity: [L, R]
- double inplace, A and B move pieces inside the intersection
- single inplace without quirk part, the same transformation is applied twice (the second time in reverse order) without interference: corner twist, edge flip, double swap
- single inplace with quirk part, there is an interference between the conjugated and the non conjugated version of the transformation: [M', U2]
- no overlap, 3-cycle: [R' D' R, U']
- overlap with quirk part and without conjugated part: [R', F]
- overlap with conjugated part and without quirk part: [R', F']
- overlap with both quirk and conjugated part