RubikologyExposécrypto.cs.mcgill.ca/~crepeau/RUBIK/SLIDES/Rubik03.pdf2x2x2 3x3x3 4x4x4 5x5x5 6x6x6...

81
©2003 Claude Crépeau b b y y C C l l a a u u d d e e C C r r é é p p e e a a u u R R u u b b i i k k o o l l o o g g y y E E x x p p o o s s é é

Transcript of RubikologyExposécrypto.cs.mcgill.ca/~crepeau/RUBIK/SLIDES/Rubik03.pdf2x2x2 3x3x3 4x4x4 5x5x5 6x6x6...

©2003 Claude Crépeau

bbyyCCllaauuddeeCCrrééppeeaauu

RRuubbiikkoollooggyyEExxppoosséé

©2003 Claude Crépeau

"The most famous of recent puzzles is the Rubik's cube invented bythe Hungarian Ernö Rubik. It's fame is incredible. Invented in 1974,patented in 1975 it was put on the market in Hungary in 1977. How-ever it did not really begin as a craze until 1981. By 1982 10 million

cubes had been sold in Hungary, more than the population of thecountry. It is estimated that 100 million were sold world-wide. It is

really a group theory puzzle, although not many people realize this."

’’EERRNNÖÖ RRUUBBIIKK’’

aanndd hhiiss CCUUBBEE

©2003 Claude Crépeau

tthhee ssppeecciieess

©2003 Claude Crépeau

2x3x3

aa xx bb xx cc -- RRuubbiikk

2x2x2 3x3x3 4x4x4 5x5x5 6x6x6 11x11x11

2x2x3 2x2x4 3x3x53x3x4 3x4x4

©2003 Claude Crépeau

RReegguullaarr PPoollyyhheeddrraa

HHeexxaahheeddrroonn == CCuubbee66 ffaacceess,, 88 ccoorrnneerrss

DDooddeeccaahheeddrroonn1122 ffaacceess,, 2200 ccoorrnneerrss

TTeettrraahheeddrroonn44 ffaacceess,, 44 ccoorrnneerrss

IIccoossaahheeddrroonn2200 ffaacceess,, 1122 ccoorrnneerrss

OOccttaahheeddrroonn88 ffaacceess,, 66 ccoorrnneerrss

©2003 Claude Crépeau

RRuubbiikk ffaammiillyy :: ssttrriicctt ssuubb--ppuuzzzzlleess

©2003 Claude Crépeau

=

©2003 Claude Crépeau

=

©2003 Claude Crépeau

=

©2003 Claude Crépeau

=

©2003 Claude Crépeau

=

©2003 Claude Crépeau

=

©2003 Claude Crépeau

=

©2003 Claude Crépeau

=

©2003 Claude Crépeau

CCoouunnttiinngg!!

©2003 Claude Crépeau

PPeerrmmuuttaattiioonnss GGrroouuppss

©2003 Claude Crépeau

2 1 4 3 5 6 7 8 9

1 2 3 4 5 6 7 8 9

3 6 1 4 2 8 5 9 7

1 2 3 4 5 6 7 8 9

PPeerrmmuuttaattiioonnss GGrroouuppss

Objects: permutations on n elements

©2003 Claude Crépeau

a b c d e f g h i

1 2 3 4 5 6 7 8 9

CCoouunnttiinngg ppeerrmmuuttaattiioonnss??

9 x8 x7 x6 x5 x4 x3 x2 x19! choices

in general n! permutations.

©2003 Claude Crépeau

6 3 4 1 2 8 5 9 7

1 2 3 4 5 6 7 8 9

PPeerrmmuuttaattiioonnss GGrroouuppss

Operation: composition of permutations

©2003 Claude Crépeau

3 6 1 4 2 8 5 9 7

1 2 3 4 5 6 7 8 9

NNuummbbeerr ooff CCrroossssiinnggss aanndd PPaarriittyy

2 1 4 3 5 6 7 8 9

1 2 3 4 5 6 7 8 9

number of crossings = 10, even permutation.

number of crossings = 3, odd permutation.

©2003 Claude Crépeau

NNuummbbeerr ooff CCrroossssiinnggss aanndd PPaarriittyy

9 1 2 3 4 5 6 7 8

1 2 3 4 5 6 7 8 9

an n-cycle, n even = odd permutation.

an n-cycle, n odd = even permutation.8 1 2 3 4 5 6 7

1 2 3 4 5 6 7 8

©2003 Claude Crépeau

6 3 4 1 2 8 5 9 7

1 2 3 4 5 6 7 8 9

NNuummbbeerr ooff CCrroossssiinnggss

number of crossings after composition ???

©2003 Claude Crépeau

i j

i j

ii'' jj''

i' j'

i' j'

ii"" jj""j'

j'

jj""i'

i'

ii""

i j

i j

ii'' jj''

PPaarriittyy ooff tthhee NNuummbbeerr ooff CCrroossssiinnggssthere is a crossing in a composed permutation exactly if

there was a SINGLE crossing before composition.

j

j

jj''i

i

ii''

i'

i'

ii""j'

j'

jj""j' i'

j' i'

jj"" ii""

j

j

jj''i

i

ii''

©2003 Claude Crépeau

6 3 4 1 2 8 5 9 7

1 2 3 4 5 6 7 8 9

PPaarriittyy ooff tthhee NNuummbbeerr ooff CCrroossssiinnggss

parity of the number of crossings after =parity of the total number of crossings before

©2003 Claude Crépeau

PPaarriittyy ooff tthhee NNuummbbeerr ooff CCrroossssiinnggss

AAnnyy ccoommppoossiittiioonnss ooff eevveenn ppeerrmmuuttaattiioonnssiiss aann eevveenn ppeerrmmuuttaattiioonn..

TThhee ppaarriittyy ooff aa sseeqquueennccee ooff ccoommppoossii--ttiioonnss iiss tthhee ppaarriittyy ooff tthhee nnuummbbeerr ooffoodddd ppeerrmmuuttaattiioonnss iinn tthhee sseeqquueennccee..

©2003 Claude Crépeau

NNoottaattiioonnss

©2003 Claude Crépeau

YY

X

ZZ

X1 X2 X3 Xn-1

IInnddiicceess aanndd aaxxeess

...

©2003 Claude Crépeau

IInnddiicceess aanndd aaxxeessYY

X

ZZ

Z1 Z5 Y4

©2003 Claude Crépeau

X13X1

2X11

RReeppeettiittiioonnssYY

X

ZZ

©2003 Claude Crépeau

PPiieecceess aanndd mmoovveemmeennttss

©2003 Claude Crépeau

Z1

Z4

All rotation results in a 4-cycle ofthe corners, an odd permutation.

Parity of the corners =Parity of the number of rotations

CCoorrnneerrss

©2003 Claude Crépeau

All rotation results either in• a single 4-cycle of the c-edges,or• two 4-cycles of the c-edges and

a 4-cycle of the centers,an odd permutation.

Parity of central edges and centers= Parity of the number of rotations

CCeennttrraall EEddggeessaanndd CCeenntteerrss

Z1

Z4

©2003 Claude Crépeau

Certain rotations produce two or four 4-cycles of off-center edges, an even permuta-tion. Other rotations produce three 4-cyclesof the off-center edges, an odd permutation.

OOffff--cceenntteerr EEddggeess

Z1 Z2 Z4

©2003 Claude Crépeau

Squares are moving parts showing a single face,but usually we discard centers. We subdividesquares in four types: diagonal , central ,ordinary+ (dark) and ordinary- (pale), each typehaving its own set of parity rules. These piecesexist only on large enough cubes.

diagonal n>3 central n>4 ordinary n>5

SSqquuaarreess

©2003 Claude Crépeau

All rotations produce one, three or five4-cycle(s) of the diagonal squares: anodd permutation.

Parity of diagonal squares= Parity of the number of rotations

DDiiaaggoonnaall SSqquuaarreess

Z1 Z2 Z4

©2003 Claude Crépeau

Certain rotations produce two or four 4-cycles of the central squares: an odd per-mutation, while others produce one or five4-cycle(s) of the central squares: an evenpermutation.

CCeennttrraall SSqquuaarreess

Z1 Z2 Z4

©2003 Claude Crépeau

All rotations produce two, four, six, eightor ten 4-cycles of the ordinary squares:an even permutation.

Permutation of the ordinary squares= even permutation

OOrrddiinnaarryy SSqquuaarreess

Z1 Z2 Z5Z3

©2003 Claude Crépeau

All rotations produce one, two, three,four or five 4-cycle(s) of the ordinary+squares, and exactly the same number ofrotations of the ordinary- squares.

Parity of the ordinary+ squares= Parity of the ordinary- squares

OOrrddiinnaarryy SSqquuaarreess ((IIII))

Z1 Z2 Z5Z3

©2003 Claude Crépeau

PPaarr((nnuummbbeerr ooff rroottaattiioonnss))==

PPaarr((ccoorrnneerrss))==

PPaarr((cceenntteerrssii)) ++ PPaarr((eeddggeessii))==

PPaarr((ssqquuaarreessiijj)) ++ PPaarr((eeddggeessii)) ++ PPaarr((eeddggeessjj))==

PPaarr((ssqquuaarreessjjii)) ++ PPaarr((eeddggeessii)) ++ PPaarr((eeddggeessjj))

PPoossiittiioonnss RRuulleess

©2003 Claude Crépeau

FFLLIIPPss aanndd TTWWIISSTTss

©2003 Claude Crépeau

FFLLIIPPssA FLIP is the inversion of the twocolors of an edge.

Central edges may carry a FLIP butonly according to a global parityrule.

Off-center edges cannot FLIP. Theymay not come back to the samelocation with colors reversed. Twoof them may however be swapped,but this is NOT a FLIP.

©2003 Claude Crépeau

All rotations produce twoor four 4-cycles of theco lo r s of the cent ra ledges : an even permuta-tion of the colors.

CCeennttrraall EEddggeessaanndd tthheeiirr CCoolloorrss

Z1

Z4

©2003 Claude Crépeau

Twist = -1 Twist = +1Twist = 0

TTWWIISSTTssA TWIST is therotation of thethree colors ofa corner.

©2003 Claude Crépeau

Twist = 0Twist = 0

Twist = 0

Twist = 0

Twist = 0Twist = 0

Twist = 0

Twist = 0

Twist = 0Twist =+1

Twist = 0

Twist =-1

Twist = 0Twist =-1

Twist = 0

Twist =+1

TTWWIISSTTss

©2003 Claude Crépeau

TTWWIISSTTss

Twist = bTwist = d

Twist = f

Twist = h

Twist = aTwist = c

Twist = e

Twist = g

Twist = bTwist =c+1

Twist = f

Twist =d-1

Twist = aTwist =g-1

Twist = e

Twist =h+1

©2003 Claude Crépeau

TTWWIISSTTss rruullee

TThhee ssuumm ooff aallll tthhee TTWWIISSTTssiiss aallwwaayyss aa mmuullttiippllee ooff 33..

FFLLIIPPss rruullee

TThhee ppaarriittyy ooff aallll tthhee FFLLIIPPSSssiiss aallwwaayyss eevveenn..

©2003 Claude Crépeau

CCoouuttiinngg tthhee vvaalliidd CCoonnffiigguurraattiioonnss

©2003 Claude Crépeau

RRuubbiikk’’ss FFaammiillyy

©2003 Claude Crépeau

There are 8 pieces, 3 orientations each, giving a maximumof 8! x 38 positions. This limit is not reached because:

• The orientations of the flat pieces are not visible (34)• the orientation of the puzzle does not matter (24)

This leaves 7! x 33 = 136,080 positions.

Moves Posi-tions0 11 92 543 3214 1,8355 9,7166 39,5367 68,4248 16,1209 64Total 136,080

There are 8 pieces, with 3 orientations each, giving amaximum of 8! x 38 positions. This limit is not reachedbecause:

• The total twist of the cubes is fixed (3)• the orientation of the puzzle does not matter (24)

This leaves 7! x 36 = 3,674,160 positions.

Moves Positions0 11 92 543 3214 1,8475 9,9926 50,1367 227,5368 870,0729 1,887,74810 623,80011 2,644Total 3,674,160

©2003 Claude Crépeau

There are 8 corners and 8 edges, givinga maximum of 8! x 8! positions. Thislimit is not reached because the orien-tation of the puzzle does not matter.

This leaves 8! x 8! / 4 =406,425,600 positions.

Moves Positions Positions0 1 11 7 92 34 533 168 3044 807 1,6875 3,768 8,8916 17,250 45,5887 77,696 227,1478 342,305 1,079,3449 1,472,169 4,854,692

10 6,052,497 19,388,33411 22,364,538 59,315,83012 65,693,109 109,477,37213 121,339,537 119,312,96314 127,175,987 80,533,71715 58,226,238 12,049,12016 3,627,117 130,52417 32,344 2418 28 -Total 406,425,600 406,425,600

There are 8 corners and 8 edges, 2 centers with 4orientations, giving a maximum of 42 x 8! x 8! posi-tions. This limit is not reached because

• the orientation of the puzzle does not matter (4)• the parity of the corners and the parity of the

center orientations must be the same (2).

This leaves 8! x 8! x 2 = 3,251,404,800 positions.

©2003 Claude Crépeau

There are 8 corner pieces with 3 orientations each, 12 edge pieceswith 2 orientations each, giving a maximum of 8! x 12! x 38 x 212positions. This limit is not reached because:

• The total twist of the cubes is fixed (3)• The total number of edge flips is even (2)• The permutation of corners and edges is even (2)

This leaves 8! x 12! x 37 x 210 = 43,252,003,274,489,856,000or 4.3 x 1019 positions.

There are 8 corner pieces with 3 orientations each, 12 edge pieceswith 2 orientations each, 6 center pieces with 4 orientations each,giving a maximum of 8! x 12! x 38 x 212 x 46 positions. This limit isnot reached because:

• The total twist of the cubes is fixed (3)• The total number of edge flips is even (2)• The permutation of corners and edges is even (2)• The permutation of corners and center orientations is even (2)

This leaves 8! x 12! x 37 x 29 x 46 =88,580,102,706,155,225,088,000

or 8.8 x 1022 positions.

©2003 Claude Crépeau

There are 8 corners with 3 orientations each, 24 side edges with only 1or ienta t ion each and 12 cent ra l edges wi th 2 or ienta t ion s each ,24 d iagona l m idd les , and 24 centra l m idd les , g iv ing a max imum of8! x 24!3 x 12! x 38 x 212 positions. This limit is not reached because:

• The total twist of the corners is fixed (3)• The number of central edge flips is even (2)• The permutation of corners and diagonal middles is even (2)• The permutation of corners and central edges is even (2)• There are indistinguishable middle pieces (4!12/2)

This leaves 8! x 24!3 x 12! x 37 x 210 / 4!12 =282,870,942,277,741,856,536,180,333,107,150,328,293,

127,731,985,672,134,721,536 x 1015or 2.8 x 1074 position.There are 8 corners with 3 orientations each, 24 side edges with only 1or ientat ion each and 12 centra l edges wi th 2 or ientat ions each ,24 diagonal middles, and 24 central middles, 6 centers with 4 orienta-tions each, giving a maximum of 8! x 24!3 x 12! x 38 x 212 positions. Thislimit is not reached because:

• The total twist of the corners is fixed (3)• The number of central edge flips is even (2)• The permutation of corners and diagonal middles is even (2)• The permutation of corners and central edges is even (2)• The permutation of corners and center orientations is even (2)

This leaves 8! x 24!3 x 12! x 37 x 28 x 46 =10,578,478,173,744,985,617,050,909,483,723,503,967,920,492,298,462,

155,293,265,013,983,514,318,459,633,664 x 1015

or 1.0 x 1084 positions.

©2003 Claude Crépeau

monochromefaces

polychromefaces

n

log 10 Rubik(n)

n=2m

8!·38·(24!)m(m-1)________________________

3·24·(4!)6(m-1)2

n=2m+1

8!·38·(24!)m2-1·12!·212_____________________________

3·2·2·(4!)6m(m-1)

n=2m

8!·38·(24!)m(m-1)________________________

3·24·2(m-1)2

n=2m+1

8!·38·(24!)m2-1·12!·212·46_____________________________

3·2·2·2·2m(m-1)

200 000

400 000

600 000

800 000

1 000 000

1 200 000

1 400 000

0 100 200 300 400 500

©2003 Claude Crépeau

HHOOWW??

©2003 Claude Crépeau

TTrreeee SSeeaarrcchhiinngg

©2003 Claude Crépeau

X2X1 X3 Z2Z1 Z3 Y2Y1 Y3

Y2Y1 Y3X2X1 X3

Z2Z1 Z3X2X1 X3

YY

X

ZZ

TTrreeee SSeeaarrcchhiinngg

©2003 Claude Crépeau

X2X1 X3 Z2Z1 Z3 Y2Y1 Y3

YY

X

ZZ

TTrreeee SSeeaarrcchhiinngg

Level 0 : 1 nodeLevel 1 : 9 nodesLevel 2 : 54 nodesLevel 3 : 324 nodesLevel 4 : 1944 nodes...Level k : 9x6k-1 nodes

43

2

1

0

©2003 Claude Crépeau

1 + 9 + 54 + 324 + 1944 + ... + 9x6k-1

= 1 + 9 ( 1 + 6 + 36 + 256 + ... + 6k-1)

LetSk = 1 + 6 + 36 + 256 + ... + 6k-1

6Sk = 6 + 36 + 256 + ... + 6k-1 + 6k

5Sk = 6k - 1Sk = (6k - 1)/5

therefore1 + 9 + 54 + 324 + 1944 + ... + 9x6k-1

= 1 + 9(6k - 1)/5 nodes on levels 0 to k.

TTrreeee SSeeaarrcchhiinngg

©2003 Claude Crépeau

TTrreeee SSeeaarrcchhiinngg

• total number of nodes to visit: Rubik(n)=Ω(cn2)

• some configurations requirelog3(n-1)Rubik(n) = Ω(n2/log n) rotations

• optimale solution but very hard to find( GOD’s algorithm )

©2003 Claude Crépeau

©2003 Claude Crépeau

PPeerrmmuuttaattiioonn GGrroouuppss

©2003 Claude Crépeau

GGrroouuppssElements : P,Q,R,...

Operation: P◊Q closed on the element set

Neutral : there exists an element I s.t.for all P we have

P◊I = I◊P = P

Inverses: for all P, there exists P' s.t.P◊P'=P'◊P=I

Associative: (P◊Q)◊R = P◊(Q◊R)

? Commutatif ? : P◊Q = Q◊P ??

©2003 Claude Crépeau

2 1 4 3 5 6 7 8 9

1 2 3 4 5 6 7 8 9

3 6 1 4 2 8 5 9 7

1 2 3 4 5 6 7 8 9

PPeerrmmuuttaattiioonnss GGrroouuppss

Objects: permutations on n elements

©2003 Claude Crépeau

6 3 4 1 2 8 5 9 7

1 2 3 4 5 6 7 8 9

PPeerrmmuuttaattiioonnss GGrroouuppss

Operation: composition of permutations

©2003 Claude Crépeau

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

PPeerrmmuuttaattiioonnss GGrroouuppssNeutral:

Inverse:

©2003 Claude Crépeau

RRuubbiikk’’ss CCUUBBEE GGrroouuppElements: valid permutations of the cubeOperation: compositionNeutral: no rotationInverses:• for all rotation

R=Auv, A∈X,Y,Z, v∈1,2,3, u∈1,2,...,n-1,

there exists R'=Au4-v s.t.

R◊R' = R'◊R = I• for all permutation P=R1◊R2◊...◊Rk

there exists P'=R'k◊R'k-1◊...◊R'1 s.t.P◊P'=P'◊P=I

Associative: yes !? Commutative ? : NO !

©2003 Claude Crépeau

CCoonnjjuuggaaiissoonnconjugaison of Q by P = P◊Q◊P'

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 91 3 2 4 5 6 7 8 9

4 5 6 7 8 91 2 3Q:

P:

P':

©2003 Claude Crépeau

CCoonnjjuuggaaiissoonnP◊Q◊P'

2 1 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

©2003 Claude Crépeau

CCoonnjjuuggaaiissoonn

Q: 3-cycling certain corners

P◊Q◊P':3-cycling any corners

Q: TWISTing 2 corners

P◊Q◊P':TWISTing any 2 corners

©2003 Claude Crépeau

CCoonnjjuuggaaiissoonn

Q: 3-cycling fixed edges

P◊Q◊P':3-cycling any edges

Q: 3-cycling fixed squares

P◊Q◊P':3-cycling any squares

©2003 Claude Crépeau

CCoonnjjuuggaaiissoonn

Q: 3-cycling fixed edges

P◊Q◊P':3-cycling any edges

Q: FLIPping 2 edges

P◊Q◊P':FLIPping any 2 edges

©2003 Claude Crépeau

CCoommmmuuttaattiioonncommutation of Q by P = P◊Q◊P'◊Q'

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9P:

1 3 2 4 5 6 7 8 9

4 5 6 7 8 91 2 3Q:

©2003 Claude Crépeau

CCoommmmuuttaattiioonncommutation of Q by P = P◊Q◊P'◊Q'

1 2 3 4 5 6 7 8 9

1 2 4 5 6 73 8 9Q'=Q:

2 1 3 4 5 6 7 8 9

4 5 6 7 8 91 2 3P◊Q◊P':

©2003 Claude Crépeau

2 3 1 4 5 6 7 8 9

CCoommmmuuttaattiioonncommutation of Q by P = P◊Q◊P'◊Q'

4 5 6 7 8 91 2 3

P◊Q◊P'◊Q':

In general, if P and Q commute thenP◊Q◊P'◊Q' = Q◊P◊P'◊Q' = Q◊I◊Q' = Q◊Q' = I

otherwise commutations are often close to Iand therefore usually change few things.

©2003 Claude Crépeau

CCoommmmuuttaattiioonnssP = Z13X43Y41

Q = Z11

P’= Y43X41Z11

Q’= Z13

©2003 Claude Crépeau

CCoommmmuuttaattiioonn aanndd CCoonnjjuuggaaiissoonn

• find commutations for- 3-cycles of each type of pieces- FLIPs- TWISTs

• (using the commutations) by conjugaison- move each cubbie to its original location- TWIST all the corners appropriately- FLIP all the edges appropriately

©2003 Claude Crépeau

CCoommmmuuttaattiioonn aanndd CCoonnjjuuggaaiissoonn

• total number of cubbiesto move, TWIST or FLIP = O(n2)

• number of rotation(s)to move, TWIST or FLIP each cubbie = constant

• number of rotations to solve cube = O(n2)

• sub-optimal solution , but easy to find...

©2003 Claude Crépeau

WWHHYY??FERDINAND

© 1981 United Feature Syndicate Inc.

©2003 Claude Crépeau

SSoommee RReeaaddiinnggss

©2003 Claude Crépeau

©2003 Claude Crépeau

http://www.cs.mcgill.ca/~crepeau