# When will inverting an algorithm allow it to function the same as the original?

Let's say I have this zperm algorithm:

R' U' R U' R U R U' R' U R U R2 U' R' U2

Now, let's suppose I invert it.

U2 R U R2 U' R' U' R U R' U' R' U R' U R

Assuming the cube is in a state of its pll in which a zperm will put it into a solved state, both algorithms will work.

My question is when this works and when it doesn't.

Mathematically, if $A:\mathcal{R}\rightarrow\mathcal{R}$ [an algorithm on a Rubik's Cube] is congruent ($\equiv$) to $A'$ [its inverse], that means that $A(A(R))=A'(A(R))=R$ $\forall R\in\mathcal{R}$.

For any cubie $P$ in a position $p$, either $P$ stays in position $p$, or it moves to some other position $q\neq p$. Let $Q$ be the cubie that was originally in position $q$.

We then see that $A(p)=q\Rightarrow A'(q)=p\Rightarrow A(q)=p$, so $Q$ moves to position $p$ under the algorithm.

So in the first case, $A$ keeps a cubie in the same place, and the second case, it swaps two cubies (here $P$ and $Q$).

We also have the case where the positioning of the facelets changes orientation (thanks @JaapScherphius!). If the cubie is an edge cubie (stationary or non-stationary) we are fine, since flipping the cubie is self-reversible. If the cubie is a centre cubie, obviously we can't flip this. However, if the cubie is a corner cubie, changing the orientation comes in a three-cycle (because there are three positions), so we can't change the orientation.

Therefore the only algorithms on a Rubik's Cube that are equal to their own inverse are those that swap certain disjoint pairs of cubies and optionally also flip edge cubies.

(Note: $\mathcal{R}$ is not an official designation of a permutation of a Rubik's Cube)

• The orientation of the cubies matters too. The stationary corner cubies cannot get twisted at all. Stationary edge cubies can be flipped. Any swapped cubie pairs are oriented such that they have swapped facelets. This is proved by the same argument, except applied to facelets instead of cubies. – Jaap Scherphuis Jul 1 '17 at 7:05