# How to determine whether a Rubik's cube is solvable

I have a (nearly solved) Rubik's Cube:

However, as you can see, one edge only is flipped, making it unsolvable. I have scrambled this unsolvable Rubik's Cube and now it looks like this:

And

What are the signs that this Rubik's Cube is now unsolvable?

Select any edge. In your head it should be fairly easy to imagine how to bring it to its home location using only moves of the U, D, L and R faces, and not the F or B faces (though if it makes it easier, you can use half turns F2 and B2). If it would arrive at its location flipped, then consider the edge flipped, and if it would arrive correctly oriented then it is not flipped.

Mentally do this for each edge, to determine which edges are flipped. If an odd number of edges are flipped, it is not solvable.

You can also recognise flipped edges by their colours, but I always get confused about the equator edges, so I prefer what I described above.

Corner orientation is easier to tell by their colours. Assuming you have white and yellow on the U/D centres, a corner has no twist if its yellow/white facelet is next to a yellow or white centre. It has +1 twist if it is twisted once clockwise from its no-twist orientation, and a -1 twist if it is twisted once anti-clockwise from its no-twist orientation.

Add up all the twists (i.e. count the clockwise twisted corners minus the number of anticlockwise twisted corners) and you should have a multiple of 3 (i.e. -6, -3, 0, 3, or 6). If not, the cube is not solvable.

There is also permutation parity, which is much harder to determine on a mixed cube.

There are 3 things to check:

• Corner Rotations
• Edge Parity
• Permutation Parity

Corners Rotations

As Jaap Scherphuis wrote, you can look at the yellow and white faces of a cube. Every yellow or white corner square on the face has a value of 0. A corner whose yellow or white square is rotated clockwise from the face has a value of 1. A corner whose yellow or white square is rotated counter clockwise from the face has a value of -1. The total of all 8 corner pieces’ rotations must be divisible by 3.

This shows the three different orientations that a corner piece can have, from the view of the white face:

However, it doesn’t matter what face you start with – you can pick any face and sum the rotations of the white and yellow squares of all corners on that face and its opposite face. If the sum is divisible by 3, then the corner rotations are solvable. Of course, instead of white and yellow squares on the corners, you could also look for red and orange squares or green and blue squares.

Edge Parity

Again, I started by studying Jaap Scherphuis’s solution but found that it’s not necessary to make any moves to determine solvability.

Pick an Up face and Front face. Check these 12 key positions:

• The 4 edge squares on the Up face.
• The 4 edge squares on the Down face.
• The 2 edge squares on the middle row of the Front face.
• The 2 edge squares on the middle row of the Back face.

This diagram shows the key positions to inspect in red:

When inspecting those positions, look for these squares:

• Any white or yellow square.
• Any red or orange square not connected to a white or yellow square on the same edge piece.

Count the number of times you see one of those squares in a key positions. If the count is even, the “edge parity” is even and the edges are solvable. In this example, the squares that count are circled and those that don’t count have an X over them:

All white and yellow squares in the key positions count. The red or orange squares in the key positions count only if they are not connected to a yellow or white square. In this example, there are 8 squares that count. Since that is even, the edge parity is even and the edges are solvable.

Just like the corner check, you can hold the cube in any position and you can use different color schemes.

Permutation Parity

For this check, ignore edge parity and corner rotation - only the positions of the pieces matter. Consider placing all the pieces in their correct positions by swapping two pieces at a time, i.e. swapping two corner pieces or swapping two edge pieces. The cube is solvable if and only if the total number of swaps is even.

Programmatically, this can be done with:

int countSwaps(int *pieces, int count) // pieces[5] = 3 means piece 3 is in position 5.
{
int swaps = 0;
for(int pos = 0; pos < count; ++pos) {
if (corners[pos] != pos) {
int dst = corners[pos];
corners[pos] = corners[dst];
corners[dst] = dst; // One piece is swapped into its correct position.
++swaps;
--i; // Force re-inspection of this position;
}
}
return swaps;
}


To do this by hand, it may be easier to count loops instead of swaps:

1. Place your finger on a piece.
2. If the piece is in the right position, it is a loop of length 1. Count it as a loop and move to the next corner piece.
3. If the piece is not in the right position, find the position it belongs in. Look at the piece in that position and find the position it belongs in. Repeat, following the loop, until you come back to the piece you started with. Count it as 1 loop.
4. If you reach the start of a loop you already counted, you have not found a new loop. Move your finger to the next piece and go to step 2. (You can skip this step and speed up processing if you are able to track all pieces in all previous loops, so that you never start step 1 inside a previous loop).
5. Repeat until all pieces are accounted for.

For both counting swaps and counting loops, you must consider both edge and corner pieces. The totals swaps or loops for both edges and corners must be even for the cube to be solvable.

• For your last loop algorithm, how does step 4 happen? Step 2 and 3 already cover all cases. Commented Feb 12 at 2:32
• Justhalf, if you can keep track of all of the pieces in all previous loops, either by marking or by memorization, then you don't need step 4. If you can only keep track of the start of each loop, then you need step 4. Commented Feb 12 at 3:38