Skip to main content
QUICK REVIEW

[Paper Review] Algorithms for Solving Rubik's Cubes

Erik D. Demaine, Martin L. Demaine|arXiv (Cornell University)|Jun 28, 2011
graph theory and CDMA systemsEngineering13 references11 citations
TL;DR

This paper establishes the asymptotic diameter of the n×n×n and n×n×1 Rubik’s Cube configuration spaces as Θ(n²/log n), leveraging parallelization of standard O(n²) solution algorithms to achieve a logarithmic speedup. It proves NP-hardness of finding optimal solutions when only a subset of cubies are considered, and presents a polynomial-time algorithm for solving fixed-width Rubik’s Cubes (c₁×c₂×n).

ABSTRACT

The Rubik's Cube is perhaps the world's most famous and iconic puzzle, well-known to have a rich underlying mathematical structure (group theory). In this paper, we show that the Rubik's Cube also has a rich underlying algorithmic structure. Specifically, we show that the n x n x n Rubik's Cube, as well as the n x n x 1 variant, has a "God's Number" (diameter of the configuration space) of Theta(n^2/log n). The upper bound comes from effectively parallelizing standard Theta(n^2) solution algorithms, while the lower bound follows from a counting argument. The upper bound gives an asymptotically optimal algorithm for solving a general Rubik's Cube in the worst case. Given a specific starting state, we show how to find the shortest solution in an n x O(1) x O(1) Rubik's Cube. Finally, we show that finding this optimal solution becomes NP-hard in an n x n x 1 Rubik's Cube when the positions and colors of some of the cubies are ignored (not used in determining whether the cube is solved).

Motivation & Objective

  • To determine the asymptotic diameter (God’s Number) of the n×n×n and n×n×1 Rubik’s Cube configuration spaces.
  • To investigate the computational complexity of finding optimal move sequences for solving Rubik’s Cubes, particularly when only a subset of cubies matter.
  • To develop efficient algorithms for solving generalized Rubik’s Cubes, especially in the case of fixed-width configurations (c₁×c₂×n).

Proposed method

  • Parallelizing standard O(n²) solution algorithms by exploiting simultaneous transformations of n^Θ(1) cubies per move to reduce total move count by a logarithmic factor.
  • Applying a counting argument to establish a lower bound of Ω(n²/log n) on the diameter, based on the number of configurations (2^Θ(n²)) and branching factor (O(n)).
  • Using a recursive decomposition of move sequences into long and short moves, with repeated application of a base move sequence to simulate complex move patterns.
  • Reducing the number of long moves in an optimal solution via a pigeonhole principle argument, showing that repeated move patterns can be compressed.
  • Enumerating all constant-sized sequences of long moves (bounded by a function of c₁ and c₂) and solving each cubie cluster independently using a finite search over short move combinations.
  • Applying dynamic programming and combinatorial optimization to find the shortest solution across all valid long move sequences, ensuring global optimality.

Experimental results

Research questions

  • RQ1What is the asymptotic diameter of the configuration space for the n×n×n and n×n×1 Rubik’s Cube?
  • RQ2Is finding the shortest solution sequence NP-hard when only a subset of cubies are required to be solved?
  • RQ3Can the optimal solution be computed in polynomial time for Rubik’s Cubes of fixed width c₁×c₂×n with c₁, c₂ ≠ n?
  • RQ4Can the parallelism in move operations be leveraged to design constant-factor approximation algorithms for near-optimal solutions?
  • RQ5How does the number of long moves in an optimal solution scale with the cube dimensions, and can this be bounded?

Key findings

  • The diameter of the n×n×n and n×n×1 Rubik’s Cube configuration space is Θ(n²/log n), resolving the asymptotic God’s Number for these puzzles.
  • The upper bound of O(n²/log n) is achieved by parallelizing standard solution algorithms, exploiting that each move affects Θ(n) cubies simultaneously.
  • A counting argument yields a lower bound of Ω(n²/log n), confirming the asymptotic tightness of the diameter result.
  • Finding the shortest move sequence to solve a given subset of cubies in an n×n×1 Rubik’s Cube is NP-hard, even when positions and colors of some cubies are ignored.
  • For c₁×c₂×n Rubik’s Cubes with c₁, c₂ ≠ n, an optimal solution can be computed in polynomial time, bounded by a constant number of long move sequences.
  • The number of long moves in any optimal solution for c₁×c₂×n cubes is at most (c₁c₂)! · 2^(1+3c₁c₂+8(c₁+c₂)), which is constant for fixed c₁ and c₂.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.