Rubik’s Cube: Number of Permutations of the Corner Position Orientations

permutationsrubiks-cube

The Rubik's Cube has 8 corners, and each corner has 3 stickers. A corner can be in 1 of 3 orientations, i.e. any of the three stickers can point up, giving $3^8$ possible permutations of the corner orientations.

However, 1/3 of those permutations are unreachable (more detail here). It's not possible, for example, to disorient one corner. So, there are $3^7$ reachable permutations of the corner orientations.

As an aside, there are 8! arrangements of the corners, so there are $8!*3^7$ possible permutations of the positions and orientations of the corners.

What I can't figure out is how many ways the pieces in the corner positions can be oriented. Instead of looking at the ways the corner pieces–the red-blue-yellow, red-green-yellow, red-green-white, etc.–can be oriented, I want to know how many ways the pieces in the up-left-back, up-right-back, up-right-front, etc. positions can be oriented.

As an example, I'll arbitrarily define a corner cubie as "oriented" if it has a red or orange sticker facing up or down, rotated once if it has a yellow or white sticker pointing up or down, or rotated twice if it has an blue or green sticker pointing up or down. Thus, rotating the UP or DOWN face does not change the orientation of any corner cubies, whereas twisting any of the other four sides changes the orientation of four corner cubies.

I'll also arbitrarily index the corners cubies and positions as follows:

0   1   2   3   4   5   6   7
ULB URB URF ULF DLF DLB DRB DRF
RBY RGY RGW RBW OBW OBY OGY OGW

(In the solved state, the up-left-back position is occupied by the red-blue-yellow cubie, …, and the down-right-front position is occupied by the orange-green-white cubie.)

So, twisting the FRONT face 90 degrees changes the orientation of four corners, 2, 3, 4, and 7. Subsequently twisting the TOP face 90 degrees, note that the permutation of the orientations of the corner cubies remains the same; however, the orientations of the positions change. E.g. the RBY (0) cubie is still oriented, but the cubie in position ULB (0) is now disoriented.

By position, then, how many ways can the orientations be permuted? For what it's worth, I've empirically found the number to be 6,513. I would like to verify mathematically that that number is correct.

Edit: Here's a snippet of code that illustrates what I'm looking for.

    // Permutation of the orientations of the pieces occupying the
    // 8 corners.
    array<uint8_t, 8> cornerOrientations =
    {
      iCube.getCornerOrientation(CORNER_POSITION::ULB),
      iCube.getCornerOrientation(CORNER_POSITION::URB),
      iCube.getCornerOrientation(CORNER_POSITION::URF),
      iCube.getCornerOrientation(CORNER_POSITION::ULF),
      iCube.getCornerOrientation(CORNER_POSITION::DLF),
      iCube.getCornerOrientation(CORNER_POSITION::DLB),
      iCube.getCornerOrientation(CORNER_POSITION::DRB),
      iCube.getCornerOrientation(CORNER_POSITION::DRF)
    };

    // Treated as a base-3 number, converted to base-10.
    uint32_t permInd =
      cornerOrientations[0] * 2187 +
      cornerOrientations[1] * 729 +
      cornerOrientations[2] * 243 +
      cornerOrientations[3] * 81 +
      cornerOrientations[4] * 27 +
      cornerOrientations[5] * 9 +
      cornerOrientations[6] * 3 +
      cornerOrientations[7];

    return permInd;

Versus:

    // Permutation of the orientations of the 8 corner pieces.
    array<uint8_t, 8> cornerOrientations =
    {
      iCube.getCornerOrientation(CORNER_PIECE::RBY),
      iCube.getCornerOrientation(CORNER_PIECE::RGY),
      iCube.getCornerOrientation(CORNER_PIECE::RGW),
      iCube.getCornerOrientation(CORNER_PIECE::RBW),
      iCube.getCornerOrientation(CORNER_PIECE::OBW),
      iCube.getCornerOrientation(CORNER_PIECE::OBY),
      iCube.getCornerOrientation(CORNER_PIECE::OGY),
      iCube.getCornerOrientation(CORNER_PIECE::OGW)
    };

    // Treated as a base-3 number, converted to base-10.
    uint32_t permInd =
      cornerOrientations[0] * 2187 +
      cornerOrientations[1] * 729 +
      cornerOrientations[2] * 243 +
      cornerOrientations[3] * 81 +
      cornerOrientations[4] * 27 +
      cornerOrientations[5] * 9 +
      cornerOrientations[6] * 3 +
      cornerOrientations[7];

    return permInd;

Note the CORNER_PIECES and CORNER_POSITIONS. For CORNER_PIECES I calculate (and empirically find) $3^7$ permutations. For CORNER_POSITIONS I empirically find 6513 permutations with a breadth-first search to depth 9, but don't understand why.

Best Answer

That's a strange definition of orientation you are using. Half the corner pieces turn clockwise if you change it from oriented to twisted once, and the other half turn anti-clockwise.

With the normal definition of orientation, only $3^7=2187$ orientations are possible instead of $3^8=6561$ since the total twist of the pieces must be zero modulo 3. With your definition, you negate the twist of any four of the locations. They can indeed be any four, since all permutations are possible making any arrangement of the two types of corner pieces possible. This original twist constraint no longer holds, but instead you have the constraint that you can split them into two sets of four locations with the same total amount of twist mod 3.

It turns out that with this new definition, only $48$ of the $6561$ orientations cannot be reached. These are the configurations where there are 7 locations with one twist value and the 8th location with a different value. Whichever way you split this into two sets of four, the two sets will have different total twist values. There are 8 possibilities for the odd-one-out location, and 3 twist values it can be, and 2 twist values for the rest, giving a total of $8*3*2=48$ impossible configurations.

Proving that all other arrangements are reachable is a bit of case work, but it can be reduced by realising that

  • the order of the locations does not matter,
  • twisting all the locations by the same amount is possible (since four pieces are twisted in opposite directions to the other four), and
  • we can negate all the twists.

From this we can assume without loss of generality that there are at least as many 0s as 1s, and at least as many 1s as 2s. That leaves only the following cases to check:

00000000 = 0000+0000
00000001 = (impossible)
00000011 = 0001+0001
00000012 = 0000+0012
00000111 = 0000+0111
00000112 = 0011+0002
00001111 = 0011+0011
00001112 = 0001+0112
00001122 = 0000+1122
00011122 = 0011+0122

Related Question