Content uploaded by Glenn Rhoads

Author content

All content in this area was uploaded by Glenn Rhoads on Feb 07, 2015

Content may be subject to copyright.

A Group Theoretic Solution to the Alien Tiles

Puzzle

Glenn C. Rhoads

3651 Karen Drive

Chesapeake Beach, MD 20732

email: rhoads@cs.rutgers.edu

1 Introduction

Alien Tiles is an on-line puzzle game invented by Dr. Cliﬀ Pickover and is

located at http://www.alientiles.com/ You are given a square board of tiles,

each of which could be any one of the four colors which are ordered in the cycle

Red →Green →Blue →P urpl e →Red. Clicking on a tile rotates the color

of the selected tile and of every tile in the same row and column. The puzzle is

to ﬁnd a sequence of clicks that transforms a starting state to a goal state. For

ease of description, I’ll assign the following integers to the colors; 0 for red, 1

for green, 2 for blue, and 3 for purple. With this assignment, the state of any

tile rotates through the sequence 0 →1→2→3→0. For uniformity with

how the game is played at the on-line site, I’ll assume that a goal position is

speciﬁed and that the starting position is chosen randomly.

2 Basic Facts

Clicking on a particular tile say xtimes will rotate the color of all tiles in the

same row and column xtimes regardless of how these xclicks are interspersed

with other clicks. Thus,

Fact 1 The order of clicks is irrelevant.

Hence, we need to be concerned only with how many times to click on each

tile. The number of clicks reduces to arithmetic modulo the number of colors,

four. Hence, to solve a puzzle, no tile ever needs to be clicked on more than

three times.

Deﬁnition 1 A Short Solution is a solution in which no tile is clicked on more

than 3 times.

Deﬁnition 2 Two solutions or patterns of clicks are Short Equivalent if for

each tile, the number of clicks is equivalent modulo four.

1

Short equivalence partitions the solutions into equivalence classes and each

class has at least one short solution. Intuitively, the short solutions are the ones

using a small, though not necessarily minimal, number of clicks and these are

the ones we want to ﬁnd.

From now on, let nbe the dimension of our square board. A n×nboard

has n2tiles. Each tile is one of four possible colors and each tile is clicked on

0, 1, 2, or 3 times in a short solution. Hence, a n×nboard has 4n2starting

positions and 4n2possible short solutions. Thus,

Fact 2 For all board sizes, all starting positions are solvable if and only if each

position has a unique short solution.

Theorem 1 For odd n, some starting positions are not solvable.

Proof:

Case 1:n= 1 mod 4. Clicking once on every tile in the same row advances

every tile on the board forward by 1 mod 4.

Case 2:n= 3 mod 4. Clicking twice on every tile in the same row advances

every tile on the board forward by 2 mod 4.

Thus in both cases, some positions have more than one short solution which by

fact 2 implies the some positions do not have a solution.

3 Solving the Puzzle

Theorem 2 For even n, all positions are solvable.

Proof:

Case 1:n= 0 mod 4

You can independently cycle any tile forward by 1 mod 4 as follows. Click on the

particular tile three times, click on all other tiles in the same row and column

once, and click on all other tiles twice. By examining the cumulative eﬀects of

these clicks on the various tiles, we see that the particular tile will cycle forward

by 1 mod 4 and that all other tiles will remain as they were.

Case 2:n= 2 mod 4

You can independently cycle any tile forward by 1 mod 4 as follows. Click on the

particular tile three times, click on all other tiles in the same row and column

three times, and click on all other tiles twice.

The sets of clicks described in the proof of Theorem 2 provide a method

for solving any even order puzzle. For any tile that is not equal to its goal

value, simply apply the described set of clicks the appropriate number of times.

Obviously, you can repeat this for each tile.

Corollary 1 For even n, all board positions have a unique short solution.

2

4 Case: n = 1 mod 4

Deﬁnition 3 A Quarter Identity (QI) is a pattern of clicks where each tile in

a row or column is clicked once.

Theorem 3 A pattern of clicks is an identity transformation if and only if it

is composed of X quarter identities where X = 0 mod 4.

Proof:

(⇐=) A QI advances each tile on the board once. Thus, any number of QIs, X,

where Xis a multiple of 4 is an identity transformation.

(=⇒) Let matrix Abe a pattern of clicks for the identity. Let Ai,j denote the

i,j’th element A. Pick a row and column of A, say row pand column q.

For i= 1,2,3, . . . , n, click on all entries in column i,Ap,i times.

For j= 1,2,3, . . . , n, click on all entries in row j, (Aj,q −Ap,q mod 4) times.

The number of QIs performed is X= the sum of the p’th row of A, plus the

sum of q’th column of A, minus Ap,q .Xis also the number of clicks that eﬀect

tile p, q which must be 0 mod 4 since Aproduces the identity. Hence, we have

performed X= 0 mod 4 QIs. Showing the following claim will complete the

proof.

Claim: We have constructed all of A. In other words, Abeing the identity

forces the remaining clicks uniquely.

We have clearly constructed row pand column qof A.

Let A′be the matrix of additional clicks on the remaining n−1×n−1 submatrix.

We need to show that A′

i,j = 0 mod 4 for all i, j. The sum of the additional

clicks in any row of A′and any column of A′must be 0 mod 4 in order to not

change the cell contents in row pand column q. More formally, for any A′

i,j :

n−1

X

k=1

A′

i,k = 0 mod 4 (1)

n−1

X

k=1

A′

k,j = 0 mod 4 (2)

Since Ais the identity; for any A′

i,j , the sum of the clicks in A′eﬀecting

A′

i,j = 0 mod 4. More formally, for any A′

i,j ,

n−1

X

k=1

[A′

i,k] +

n−1

X

k=1

[A′

k,j ]−A′

i,j = 0 mod 4 (3)

Substituting for 1 and 2 into 3, we get A′

i,j = 0 mod 4.

3

Theorem 4 There are exactly 42n−2identity transformations.

Proof:

Since we need consider only short solutions, there are 42ndistinct ways of se-

lecting QIs. Only for 1/4 of them, do we have a multiple of 4.

But counting all these selections of QIs would count each identity transforma-

tion four times. To see this, suppose we have some selection of QIs producing

the identity. For each row, let rbe the number of corresponding QIs selected for

that row and for each column, let cbe the number of corresponding QIs. Now

for each row, select r+xmod 4 QIs and for each column, select c−xmod 4

QIs. We will get a distinct selection of QIs for each of the four values of xfrom

0 through 3. Clearly the number of clicks on each tile will be the same for each

such selection (since we add xclicks for the row it is in and subtract xclicks for

its column). I.e. All four of these distinct selections of QIs correspond to the

same pattern of clicks.

Furthermore, this is the only way to achieve a distinct selection of QIs cor-

responding to the same pattern of clicks. If we change the number of QIs

corresponding to any row say r(or equivalently any column c), then in order

to have the same number of clicks in each entry of row r(col c), we must must

make the opposite change to every col (row) which in turn implies that we must

make the same change to every row (col).

In summation, we divide out two separate factors of four from our total of 42n

ways to get 42n−2distinct identity transformations.

Corollary 2 There are exactly 4n2−2n+2 solvable positions.

Our solution method when n= 1 mod 4 is as follows. First consider the even-

order square subboard consisting of the ﬁrst n−1 rows and the ﬁrst n−1 columns.

We can ﬁx this subboard any way we like by using the solution algorithm for

the 0 mod 4 case (with all clicks restricted to the subboard). Once we’ve ﬁxed

this, we can then independently ﬁx entry n, n. This ﬁxes everything except

the remaining 2(n−1) entries in row nand column n. But by Theorem 4,

once we ﬁx all but 2n−2 = 2(n−1) entries, these ﬁnal entries will be in fact

completely determined and thus, we have solved the puzzle (or else the puzzle

was insolvable).

5 Case: n = 3 mod 4

Deﬁnition 4 A Half Identity (HI) is a pattern of clicks where each tile in a

row or column is clicked twice.

Lemma 1 If a pattern of clicks is composed of X = 0 mod 2 HIs, then it is an

identity transformation.

4

Proof:

A HI advances each tile on the board twice. Thus, any number of HIs, X, where

X is a multiple of 2 is an identity transformation.

Lemma 2 There are at least 4n−1identity transformations.

Proof:

Since we need consider only short solutions, there are 22ndistinct ways of se-

lecting HIs. Only for 1/2 of them, do we have a multiple of 2. But this counts

each such identity transformation two times. The proof of this is almost iden-

tical to the corresponding proof in Theorem 4 and is thus omitted for brevity.

Thus, we divide out two separate factors of two from the total of 22nways to

get 22n−2= (22)n−1= 4n−1distinct identity transformations.

Corollary 3 There are at most 4n2/4n−1= 4n2−n+1 solvable positions.

Theorem 5 When n = 3 mod 4, every tile can be independently cycled forward

by two colors.

Proof:

Click on the particular tile twice, click on all other tiles in the same row and

column once, and click on all other entries twice. By examining the cumulative

eﬀects of these clicks on the various tiles, we see that the particular tile will

cycle forward by 2 mod 4 and that all other tiles will remain uneﬀected.

Deﬁnition 5 Two positions are two-transformable if one position can be changed

into the other by advancing some subset of tiles by two.

Two positions are two-transformable if and only if they have the same pat-

tern of odds and evens. Now we only have to worry about achieving a desired

pattern of 0s and 1s. Any other attainable position P can be achieved by ﬁrst

reaching the position of 0s and 1s that is two-transformable to P and then by

applying the necessary two transformations given in Theorem 5.

Our solution method when n= 3 mod 4 is as follows. First consider the

even-order square subboard consisting of the ﬁrst n−1 rows and the ﬁrst n−1

columns. We can ﬁx this subboard into any pattern of 0s and 1s we like by

using the solution algorithm for the 2 mod 4 case (with all clicks restricted to

the subboard). Once we’ve ﬁxed this, we can then independently ﬁx entry n, n

to a 0 or a 1. We can then reach any two-transformable position, by cycling any

subset of the n2tiles forward by two.

How many positions can we solve by this method? We are ﬁrst ﬁxing (n−1)2

tiles in the subboard to one of two colors. We can reach 2((n−1)2)= 2n2−2n+1

positions this way. For each of them, there are two ways of ﬁxing entry n, n

to a 0 or a 1. And for each way of doing both of the preceding, we can ﬁx

5

each of the n2tiles in one of two ways (due to the two-transforms). There

are 2(n2)ways of doing this. Thus the total number of positions solvable using

this method is 2n2−2n+1 ·2·2(n2)= 22n2−2n+2 = (22)n2−n+1 = 4n2−n+1. By

corollary 3, this is the total number of solvable positions. Thus, this constitutes

a solution method. I.e., the remaining pattern of 0s and 1s that we did not

ﬁxed is uniquely determined and hence must be set correctly as well, or else the

puzzle has no solution.

Corollary 4 There are exactly 4n2−n+1 solvable positions and exactly 4n−1

identity transformations.

Theorem 6 A pattern of clicks is an identity transformation if and only if it

is composed of X = 0 mod 2 HIs.

Proof: Since there are 4n−1identity transformations of this form and since

there are exactly 4n−1total identity transformations, there are no other identity

transformations.

For odd order boards, one way to determine if you can achieve the given goal

position is to ﬁx every tile you can according to the solution method and check to

see if the remaining tiles are in fact set to the desired goal. The solution method

and the three basic transformations described in Theorem 2 and Theorem 5 do

imply a way to describe whether a given position is solvable but the resulting

condition is not particularly simple.

Let Abe the initial position, Bbe the goal position, and let C=B−A

where each entry is taken mod 4.

Theorem 7 Suppose n=1 mod 4. The puzzle is solvable if and only if the

following two conditions hold.

I For every i= 1,2,3,...,n−1,

Ci,n ≡

2

n−1

X

j=1

Ci,j

+

3

n−1

X

k=1,k6=i

n−1

X

j=1

Ck,j

+Cn,n

mod 4

II For every j= 1,2,3,...,n−1,

Cn,j ≡

2

n−1

X

i=1

Ci,j !+

3

n−1

X

i=1

n−1

X

k=1,k6=j

Ci,k

+Cn,n

mod 4

Theorem 8 Suppose n=3 mod 4. The puzzle is solvable if and only if the

following two conditions hold.

6

I For every i= 1,2,3,...,n−1,

Ci,n ≡

3·

n−1

X

k=1

n−1

X

j=1

Ck,j

+Cn,n

mod 2

II For every j= 1,2,3,...,n−1,

Cn,j ≡" 3·

n−1

X

i=1

n−1

X

k=1

Ci,k!+Cn,n #mod 2

6 Extension to Rectangular Boards

Let the dimension of a board be m×n. All of section 2 extends to the general

case except that there are now mn tiles on the board. Thus, all solvable positions

have a solution using at most 3mn clicks; the board has 4mn distinct positions;

and there are 4mn distinct short solutions.

6.1 Case: m and n are both even

The solutions for the even cases extend to handle all positions where both m

and nare 0 mod 4, and where both mand nare 2 mod 4.

Theorem 9 Suppose m = 0 mod 4 and n = 2 mod 4. Then any position is

achievable.

Proof: We can independently cycle the tile in row i, column jforward by one

mod 4 with the following pattern of clicks. Click three times on all tiles in

column jand click once on all tiles in row iexcept for the tile i, j .

The situation where m= 2 mod 4 and n= 0 mod 4 is symmetric to the

above and thus, every position is solvable when both dimensions are even.

6.2 Case: m and m are both odd

The solutions to the odd cases extend to handle all positions where both m

and nare 1 mod 4, and where both are 3 mod 4. So consider the case where

m= 3 mod 4 and n= 1 mod 4 (the case m= 1 mod 4 and n= 3 mod 4 is

obtained by symmetry).

Lemma 3 If a pattern of clicks is composed of Xcolumn HIs and Yrow QIs

such that either

(X = 0 mod 2 and Y = 0 mod 4) or

(X = 1 mod 2 and Y = 2 mod 4),

then it is an identity transformation.

7

Proof: A column HI advances each tile on the board twice and a row QI ad-

vances each tile on the board once. Thus, any number of column HIs, X, and

row QIs, Y, where (X= 0 mod 2 and Y= 0 mod 4) or (X= 1 mod 2 and

Y= 2 mod 4) is an identity transformation.

Lemma 4 There are at least 4m−12n−1identity transformations.

Proof:

There are 2ndistinct ways of selecting column HIs and 4mdistinct ways of

selecting row QIs. But only 1/4 of them satisfy the conditions of Lemma 3.

But this counts each identity transformation twice. To see this, suppose we

have some selection of row QIs and column HIs producing the identity. For

each row, let rbe the number of corresponding QIs selected for that row and

for each column, let cbe the number of corresponding HIs. Now for each row,

select r+ 2xmod 4 QIs and for each column, select c−xmod 2 HIs. We will

get a distinct selection of QIs and HIs for x= 0 and x= 1. Now for each tile,

we add 2xclicks for the row it is in and subtract 2xclicks for its column (since

there are two clicks for each column HI). Thus, both these distinct patterns of

QIs and HIs correspond to the same pattern of clicks.

Furthermore, this is the only way to achieve a distinct selection of row QIs

and column HIs corresponding to the same pattern of clicks. If we change the

number of HIs corresponding to any column say c, then in order to have the same

number of clicks in each entry of column c, we must must make the opposite

change (but twice as large) to every row which in turn implies that we must

make the same change to every column.

In summation, we divide out factors of four and two from the total of 4m2n

ways to get 4m−12n−1distinct identity transformations.

Corollary 5 There are at most 4mn /(4m−12n−1) = 22mn−2m−n+3 solvable po-

sitions when m=1 mod 4 and n=3 mod 4.

Theorem 10 For any pair of tiles in the same row, we can independently cycle

both of them forward by two.

Proof: Click once on the each tile in the pair, twice on all other tiles in the

same row, and once on all other tiles in the same column as one of the pair.

Our solution method when m= 3 mod 4 and n= 1 mod 4, is as follows.

First solve the upper-left m−1×n−1 subboard by applying the solution for when

m= 2 mod 4 and n= 0 mod 4. (restricting all clicks to the sub-board). Then

for each tile in row mexcept the one in column n, we can independently cycle

that tile plus the tile in column nforward by 2. Then we can set the tile in row m

8

column n. Thus, we can solve 4(m−1)(n−1) ·2n−1·4 = 4mn−m−n+1 ·2n−1·22=

22mn−2m−n+3 positions. By corollary 5, this is the total number of solvable

positions and hence, the remainder is forced.

Corollary 6 There are exactly 22mn−2m−n+3 solvable positions and exactly

4m−12n−1identity transformations.

Theorem 11 A pattern of clicks is an identity transformation if and only if it

is composed of Xcolumn HIs and Yrow QIs such that either

(X = 0 mod 2 and Y = 0 mod 4) or

(X = 1 mod 2 and Y = 2 mod 4),

Proof: There are 4m−12n−1identity transformations of this form and there are

exactly 4m−12n−1identity transformations in total, hence these are all of the

identity transformations.

The only remaining situation is when mis odd and nis even (meven and

nodd is symmetric). This breaks up into three distinct cases.

6.3 Case: m = 1 mod 4, n is even

Lemma 5 If a pattern of clicks is composed of X column QIs where X = 0 mod

4, then it is an identity transformation.

Proof:

A column QI advances each tile on the board once. Thus, any number of column

QIs, X, where Xis a multiple of 4 is an identity transformation.

Lemma 6 There are at least 4n−1identity transformations.

Proof:

There are 4ndistinct ways of selecting column QIs. Only for 1/4 of them, do

we have a multiple of 4 and furthermore, every such selection corresponds to a

distinct identity.

Corollary 7 There are at most 4mn−n+1 solvable positions.

We can solve the puzzle, when m= 1 mod 4 as follows. First solve the upper

m−1×nsubboard using the method from the corresponding both even case

(again with the clicks restricted to the sub-board). Then we can set the tile in

row mcolumn 1 to one of four distinct values. Doing this will cycle all the tiles

in column one forward by an equal amount. But re-solving the upper m−1 rows

from such a position will have no net eﬀect on the entire bottom row! Thus, the

number of positions we can solve using this method is 4(m−1)n·4 = 4mn−n+1

which by Corollary 7 is the total number of solvable positions and hence, the

remainder is forced.

9

Corollary 8 There are exactly 4mn−n+1 solvable positions and exactly 4n−1

identity transformations.

Theorem 12 A pattern of clicks is an identity transformation if and only if it

is composed of X column QIs where X = 0 mod 4.

Proof: There are 4n−1identity transformations of this form and there are ex-

actly 4n−1identity transformations in total, hence these are all of the identity

transformations.

6.4 Case: m = 3 mod 4, n = 0 mod 4

Lemma 7 If a pattern of clicks is composed from either X column HIs where

X = 0 mod 2, or a row QI for every row plus Y column HIs where Y = 1 mod

2, then it is an identity transformation.

Proof:

A column HI advances every tile on the board twice and thus, Xcolumn HIs

where X= 0 mod 2 is an identity transformation. A row QI for every row

advances each tile on the board twice. Thus, a row QI for every row plus Y

column HIs where Y= 1 mod 2 is an identity transformation.

Lemma 8 There are at least 2nidentity transformations.

Proof:

There are 2ndistinct ways to select column HIs. For half of them we have

a multiple of two. Thus, there are 2n−1ways of selecting an even number of

column HIs and 2n−1ways of selecting an odd number of column HIs. There

is only one way to select a row QI for every row. Thus, there are at least

2n−1+ 2n−1= 2nidentity transformations.

Corollary 9 There are at most 4mn/2n= 22mn−nsolvable positions.

Theorem 13 We can cycle any two distinct tiles in the same row forward by

two.

Proof:

Click zero times on both of the particular tiles, click twice on all other tiles in

the same column as one of the pair, and click once on all the remaining tiles

(including those tiles in the same row as the pair). The cumulative eﬀect of

these clicks is to cycle both tiles of the pair forward by two while all other tiles

remain unchanged.

To solve the puzzle when m= 3 mod 4 and n= 0 mod 4, ﬁrst solve the top

m−1 rows using the solution method from the m= 2 mod 4, n= 0 mod 4 case

10

(as usual, all clicks are restricted to the subboard). For each tile in the bottom

row except for tile m, n, we can advance it and tile m, n forward by two mod

four. Then we have two choices for tile m, n, we can leave it as it is or we can

click on it twice. If we click on it twice, this will advance all tiles in row mand

column nby two. Now re-solving the ﬁrst m−1 rows will also restore the bottom

row except for tile m, n which will be uneﬀected. Thus using this method we

can solve 4(m−1)n·2n−1·2 = 4mn−n·2n= 22mn−npositions. Corollary 9 implies

that this is the total number of solvable positions and hence, the remainder is

forced.

Corollary 10 There are exactly 22mn−nsolvable positions and exactly 2niden-

tity transformations.

Theorem 14 A pattern of clicks is an identity transformation if and only if it

is composed from either X column HIs where X = 0 mod 2, or a row QI for

every row plus Y column HIs where Y = 1 mod 2.

Proof: There are 2nidentity transformations of this form and there are ex-

actly 2nidentity transformations in total, hence these are all of the identity

transformations.

6.5 Case: m = 3 mod 4, n = 2 mod 4

Lemma 9 If a pattern of clicks is composed from either X column HIs where

X = 0 mod 2, or a row QI for every row plus X column HIs where X = 0 mod

2, then it is an identity transformation.

Proof:

A column HI advances every tile on the board twice and thus, Xcolumn HIs

where X= 0 mod 2 is an identity transformation. A row QI for every row is

an identity transformation. Thus, a row QI for every row plus Xcolumn HIs

where X= 0 mod 2 is an identity transformation.

Lemma 10 There are at least 2nidentity transformations.

Proof:

There are 2ndistinct ways to select column HIs. For half of them we have a

multiple of two. We can select zero row QIs for every row or one row QI for

every row which gives us a factor of two and hence, there are at least 2nidentity

transformations.

Corollary 11 There are at most 4mn/2n= 22mn−nsolvable positions.

Theorem 15 We can cycle any two distinct tiles in the same row forward by

two.

11

Proof:

Click once on one tile of the pair and click three times on the other tile. For the

tile that was clicked on once, click on all other tiles in the same column three

times. For the tile that was clicked on three times, click on all other tiles in the

same column once.

We can solve the puzzle when m= 3 mod 4 and n= 2 mod 4 using the

solution method for the m= 3 mod 4, n= 0 mod 4 case except that we instead

use the transformation described in the proof of Theorem 15 to cycle a pair

of tiles forward by two. As before we can solve 22mn−npositions which by

Corollary 11 is the total number of solvable positions and hence, this constitutes

a solution method.

Corollary 12 There are exactly 22mn−nsolvable positions and exactly 2niden-

tity transformations.

Theorem 16 A pattern of clicks is an identity transformation if and only if it

is composed from either X column HIs where X = 0 mod 2, or a row QI for

every row plus X column HIs where X = 0 mod 2.

Proof: There are 2nidentity transformations of these forms and there are ex-

actly 2nidentity transformations in total, hence these are all of the identity

transformations.

7 Obtaining a Short Solution

Suppose we want to actually solve a puzzle on the on-line site. Solving the

puzzle by repeatedly applying the patterns of clicks needed to transform the in-

dividual tiles is very ineﬃcient in terms of the number of clicks and is very

tedious to perform in practice. But each solution has at least one equiva-

lent short solution and it is straightforward to compute one. Since we know

which tiles have to be cycled forward and by how much, we can simply add

up the necessary patterns of clicks and then for each tile reduce the total mod

4 to get a corresponding short solution. We can write a computer program

to automate this process. Writing such a program is a straightforward ex-

ercise and in fact, the author has written a program for the square boards

that are used at the Alien Tiles site. This program is available from the page

http://mysite.verizon.net/vze16nctz/GamesPuzzles/gp.html

8 Acknowledgements

The author is indebted to the following people for their helpful discussion on

the rec.puzzles newsgroup during May of 2000 which was shortly after the Alien

Tiles puzzle was put online. Dennis Yelle for Fact 2, Theorem 4, and Corollary 2,

and Nis Jorgensen for the his version of the proof of Theorem 3.

12