Anda di halaman 1dari 21

Sudoku

2
9

5
5

1
7
2

2
2

Most of
us have
probably

5
4

1
6

encountered the following puzzle in a newspaper or article:

4
3

C
This

challenging puzzle is Sudoku. Sudoku consists of an n2 x n2 grid composed of n x n squares.


There are specific rules that must be followed:
1. In each horizontal row of cells, the integers from 1 through n2 are repeated only once.
2. In each column of cells, the integers from 1 through n2 are repeated only once.
3. In each n x n square, the integers from 1 through n2 are repeated only once.
Most of us have spent time in completing one, whether it is a few minutes or maybe an hour,
these puzzles can be very challenging. Although, when I was young, I always wondered if there
was an endless amount of Sudoku puzzles. Do some Sudoku puzzles reflect others? Is every
valid Sudoku puzzle unique? This investigation will show how many unique Sudoku puzzles
there are in a 9 x 9 (32 x 32) Sudoku puzzle.

9 x 9 Sudoku

Each letter above represents a specific 3 x 3 square of a 9 x 9 grid. Each 3 x 3 square will be
referred to as a block.
A band is composed of three blocks across the grid (i.e. block A, block B, and block C) make up
one of the three bands of the Sudoku grid.
A stack is composed of a column of three blocks (i.e. block A, block D, and block G) make up a
stack.
First we ask ourselves, how many ways we can order the digits 1-9 in block A?
There is essentially 9 x 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 9! = 362,880 ways of rearranging the
integers 1-9 in block A.
One representation of this would be the following grid:

The above
example
will be
fixed. The numbers in block A will stay in their current position. The amount of valid grid
completions for block A will be labeled X1.
Hence, the total amount of unique Sudoku grids is:
X1 x 9!
We can further deduce:
X1 = X/9!
Where X is the total amount of unique Sudoku grids.
Since block A contains the numbers {1, 2, 3} in the top row, the numbers {4, 5, 6, 7, 8, 9} can
only be filled in the top rows of block B and C now.
The following will denote the different combinations for block B and block C:
Block B combinations are listed on the left column and block C combinations on the right
column:

Table 1
{4,5,6} {7,8,9}

{7,8,9} {4,5,6}

{4,5,7} {6,8,9}

{6,8,9} {4,5,7}

{4,5,8} {6,7,9}

{6,7,9} {4,5,8}

{4,5,9} {6,7,8}

{6,7,8} {4,5,9}

{4,6,7} {5,8,9}

{5,8,9} {4,6,7}

{4,6,8} {5,7,9}

{5,7,9} {4,6,8}

{4,6,9} {5,7,8}

{5,7,8} {4,6,9}

{5,6,7} {4,8,9}

{4,8,9} {5,6,7}

{5,6,8} {4,7,9}

{4,7,9} {5,6,8}

{5,6,9} {4,7,8}

{4,7,8} {5,6,9}

There are a total of 20 possibilities to rearrange the integers from 4-9 in blocks B and C
Looking at the first row of presented combinations (outlined with a box) we refer to these as
pure top rows as the other combinations are mixed rows since they incorporate the mixed
numbers from the sets of {4, 5, 6} and {7, 8, 9}
Pure top rows
To calculate the arrangement of the first band we take a look at the pure top rows
One of the two pure top rows is the following consisting of {1,2,3}, {4,5,6} and {7,8,9}:

We are forced to put {7,8,9} and {1,2,3} in the 2nd row in blocks B and C and {1,2,3} and
{4,5,6} in the 3rd row of blocks B and C to follow the rules of Sudoku
We can then reorder the three digits in each row in blocks B and C to obtain all the
configurations. An example would be reordering {4,5,6} in block B to show either of the
following combinations:
{4,6,5} or {5,4,6} or {5,6,4}or {6,5,4} or {6,4,5}
This adds up to a total of (3! = 6) ways of rearranging the top row in block B
Keeping in mind that block A is fixed, there are a total of (3!)6 = 46,656 ways to rearrange the
first pure top row.
The other pure top row is the same value since blocks B and C are just swapped

Therefore, the total amount of different rearrangements for the pure top rows is:
2 x (3!)6 = 93,312

Mixed Top Rows


We then have to calculate the amount of arrangements that the other 18 combinations of the top
row will make
One of the combinations is:
1

Before I explain the variables, I want to clarify the other location of the other numbers.
{8,9} belongs in the second row of block B because it is forced there as block C already contains
{8,9} and the third row of block A contains these numbers as well.
{5} belongs in the third row of block B because it cannot be put in the second row because of the
position of {5} in the second row of block A. It cannot go in the third block as block C already
contains {5}
The same logic is used to force {7} and {4,6} in block C.
The difference between mixed top rows and pure top rows is the variables {a,b,c}
{a,b,c} represent {1,2,3} in any respective order.
{a} is inserted into the second row of block B and the third row of block C to follow the rules of
Sudoku
Since {b,c} are in the same row for either blocks B and C, their order does not matter
For the above table, {a} can be either {1,2,3} and once a is picked, that leaves {b,c} with two
numbers to interchange between.
Example: if {a} is 1, {b,c} interchange between {2,3} (represented by tables below)
1

And

Since there are three digits that {a} can be, the following equation can be deduced:
3 x (3!)6
(3!)6 represents the reordering of the digits in each of the six rows in blocks B and C
and we multiply (3!)6 by 3 to account for the three different possibilities {1,2,3} that {a} could
be
This equation represents the number of arrangements for the mixed row {4,6,7};{5,8,9} and for
the other mixed top rows you get the same equation. Therefore, the equation for the total
arrangements for top rows is:
18 x 3 x (3!)6
As there are 18 total mixed top rows
So the total amount of arrangements for the top band of a Sudoku grid is:
2 x (3!)6 x 18 x 3 x (3!)6 = 2,612,736
Where 2 x (3!)6 is the sum of the arrangements of the pure top rows and
18 x 3 x (3!)6 is the sum of the arrangements of the mixed top rows
Now to try to reduce 2,612,736 arrangements for the first band, we conduct various operations to
the first band.

Permutation
When we permute (change) any of blocks in the first band (blocks A,B,C) we have to permute
blocks D,E,F,G,H, and I correspondingly to preserve the rules of Sudoku.

If I swap blocks A and B then the resulting grid would be:

Example:

96

67

18

74

29

81

42

12

98

57

64

71

29

36

43

85

25

12

98

86

51

67

79

with H.

To
preserve
the rules
of
Sudoku, I
would
have to
swap
blocks D
with E
and G

Permuting blocks also applies when we switch columns and rows within a band.
If I swap the top two rows in block A then I would have to swap the top two rows in blocks B
and C to compensate for the permutation.
So this leads up to lexicographical reduction. This operation is possible to perform on the top
band of the Sudoku grid. The columns in the second and third blocks will be permuted so that the
numbers in the top rows of blocks B and C are in increasing order. We then swap blocks B and C
so that the top left number of block B is smaller than the top left number in block C. Since there
are 6 ways to permute the columns in blocks B and C and two ways to permute blocks B and C
the following equation is deduced:
62 x 2 = 72
There are 72 other first bands that have the same number of grid completions, therefore there is
only
2612736/72 = 36, 228 first bands
Now from here, Felgenhauer and Jarvis continued to cut down the amount of first bands and
write a computer band to come up with the total amount of Sudoku grids possible. It turned out
to be 6,670,903,752,021,072,936,960 which is a really big number. But from this number I
wanted to find out how many essentially different Sudoku grids there are, that is finding out
how many unique Sudoku grids there are.
Interestingly enough, the concept of groups came about, to find out how many essentially
different grids there are. Recollecting what I learned from Groups in math class, the following
will be used:
A group is a set G, with a binary operation such that:
1) If x and y are elements of G then, x g G; the operation is closed
2) If x, y, and z are elements of G, then x (y z) = (x y) z; the operation is associative

3) For x G There exists an e G such that for all x G e x = x e = x


4) For x G, there exists x-1 G such that x-1 x = x x-1 = e
So we take a look at a group of symmetries of a square to depict the symmetries in a Sudoku
Grid. The following is a square with labelled vertices:

We look at various transformations that can be performed that still preserve that this is a square.
There are eight total transformations meaning that there are eight symmetries:
1)
2)
3)
4)
5)
6)
7)
8)
A

C
B

Rotating the square by 0 degrees (the identity of the group)


Rotating the square by 90 degrees clockwise
Rotating the square by 180 degrees clockwise
Rotating the square by 270 degrees clockwise
Reflection on the horizontal axis (center of square)
Reflection on the vertical axis (center of square)
Reflection on the diagonal of the square from top right corner to bottom left corner
Reflection on the diagonal of the square from top left corner to bottom right corner
B

D
C

The above squares show the transformations from 1-8 (left to right)
The symmetry group G of a valid Sudoku grid consists of the above transformations shown and
various permutations of the blocks, rows, and columns within a Sudoku grid. The symmetry
group is consisted of the following transformations:
1)
2)
3)
4)
5)
6)

Relabeling the nine digits


Permuting the three bands
Permuting the three stacks
Permuting the three columns within a stack
Permuting the three rows within a band
Any reflection or rotation from the list of symmetries of the square (given above)

The above list does not include all elements of the group G; it only lists the kinds of
transformations that are in group G. Specific transformations derive from each of the above types
that make up the elements of group G.
An example of showing this, is swapping the 2nd and 3rd stacks of a Sudoku Grid which is a
transformation derived from type 3 in the above list.
Reintroducing that X is the valid number of Sudoku grids, X = 6,670,903,752,021,072,936,960
Since this set is finite, each element of G maps one valid grid to another valid grid, which shows
that there is a finite set of elements in G.

Now, two Sudoku grids are equivalent if we can go from one valid grid to another valid grid
performing one or more symmetries in G; if we cannot, then the grids are essentially different.
The Sudoku grids that are equivalent form an equivalence relation if and only if:
1) A grid A is equivalent to itself (the reflexive property)
2) If grid A is equivalent to grid B, then grid B is equivalent to A (symmetric property)
3) If grid A is equivalent to grid B, and grid B is equivalent to grid C, then grid A is
equivalent to grid C (transitive property)
This means that given any valid grid A, all grids that are equivalent to A are essentially the same
as A.
What I learned in Sets, relations, and groups was coming back to me.
By grouping together the grids that are equivalent to each other, we are then able to partition the
set of grids, that is, breaking the number of grids in the set of X into subsets. These subsets are
called equivalence classes as they share no elements together.
Keep in mind that within each equivalence class, any two elements are equivalent to each other
by some type of symmetry in the group G stated above.
These equivalence classes are denoted by X/G, read as X mod G
We now disregard the relabeling of digits in the symmetry of G for a moment; to form a
subgroup of G labelled H. Subgroup H consists of the symmetries of types 2-6 from the list
above. Subgroup H is generated by these symmetries and retains the properties of group G.
Russell and Jarvis discovered that this subgroup H contains 3,359,232 distinct symmetries.
For all the elements h in subgroup H, they map a way from an element in X to an element in X.
This is possible because h is just a transformation and we perform this on an element in X to
give us another mapping of an element in X, keeping in mind that this could possibly be the
same element.
To account for the grids that were left out by relabeling, we take all the grids A such that the grid
B to which h sends A, is equivalent to A by relabeling.
To calculate the amount of essentially different grids we need to use a formula from group
theory, Burnsides Lemma:
Let G be a finite group. g is an element in G and for every g, let Xg be the set of elements in X
that are fixed by g. Therefore, the number of elements in X/G is |X/G|= 1/|G| for all elements of
G where the brackets, | | indicates the elements inside the set.
Now to see how it applies to Sudoku, we will look at a basic group showing Burnsides Lemma

We will look at a square whose edges can be colored either red or blue. Two colorings are
essentially the same if the eight symmetries of a square that are given above if their colorings are
fixed. A fixed square is one where a symmetry leaves the square unchanged.

Consider the above square; one of the colorings of the edges is all red.
We could also color it all blue and that would be another one of the colorings.
There are essentially 24 = 16 ways to color this square since each of the 4 edges can be colored in
two ways.
So now we apply the symmetries of a square to see which symmetry leads to fixed squares:
1) Rotating 0 degrees to each coloring would make each square fixed. Therefore there
are 16 colorings of the square that are fixed by this symmetry
2) To make each square fixed by rotating by 90 degrees each coloring of the edge of the
square would have to be all blue or all red so there are only 2 colorings of a square
3) Rotating 180 degrees would only make 4 colorings of the square fixed, all red or all
blue, when the top and bottom edges of the square are both red or blue, and the left
and right edges are either both red or blue
4) Rotating 270 degrees would only lead to 2 fixed squares since all edges would have
to either all red or all blue
5) A reflection on the horizontal axis leads to 8 fixed squares where all edges are all blue
or red, the top and bottom edges are either both red and blue where the left and right
edges can be either blue or red
6) Reflection on the vertical axis is similar to a reflection on the horizontal axis where
the left and right edges are either both blue or red. So there are 8 fixed squares
7) A reflection from a top right diagonal to bottom left lead to 4 fixed squares where the
first 2 colorings are all red or blue and when the top and right edges are the same and
the bottom and left edges are the same.
8) A reflection from top left to bottom right diagonal leads to 4 fixed squares where the
top and left edges are colored the same and the bottom and right edges are colored the
same.

Now we apply Burnsides Lemma by adding up the total amount of fixed squares by each
symmetry and then taking the average of these numbers, (since we performed 8 symmetries, we
will be
1
2
4
5
6
7
8
9
3
diving by
8)

(16 + 2 +
4+2+8
+8+4+
4) / 8 = 48
/8=6
Therefore,
there are
6

essentially different colorings of the square

So to apply Burnsides Lemma to our case in Sudoku, we use the finite group H and it acts on the
set X of valid grids. We want to determine how many elements of h in H fix X, up to relabeling,
then dividing this number by the number of elements in H.
Below is an example of a grid that is transformed by symmetry then relabeled to the original
grid. Relabeling is a method to permute numbers as shown below:

61

14

35

96

47

78

59

83

38

73

85

97

46

54

69

69

57

92

81

38

15

72

46

23

Rotating
the grid
we get:

Then relabeling 1 3 9 7 1 and 2 6 8 4 2 and 5 5 so we get the


original grid

So we
need to
8
6
3
9
7
2
1
5
4
determine
how many
4
9
5
6
1
8
2
3
7
fixed
points for
7
1
2
3
4
5
6
8
9
each of
the 3,
359, 232 elements of H and it would take a lot of time. But some of these elements have
transformations like the one above that give the same grid Russell and Jarvis were able to
calculate through the computer program GAP that there are 275 classes of symmetries. So every
symmetry in H has the same number of fixed points in one of these 275 classes.
So now we need to know how many symmetries are in each class to use Burnsides Lemma.
Though we can see that for some of these symmetries there are no grids which are transformed to
equivalent grids.
When we try to reflect a Sudoku grid on the horizontal axis, through the center (red numbers)

The red numbers will stay in place after the reflection, therefore no relabeling can take place to
get an equivalent grid. So to get an equivalent grid under reflection the 4th row and 6th row would
have to be identical, but that is not possible because that means two identical numbers would be
in the same block.
Russell and Jarvis, yet again, found out that only 248 out of the 275 classes contain symmetries
which do not have any fixed grids. So they only needed to count the number of fixed grids in 27
classes and how many symmetries are in each to use Burnsides Lemma. They did their final
calculations through a computer program and found 5, 472, 730, 538 essentially different grids.
Conclusion
So what does knowing all this mean? Well for starters, there are a LOT of valid Sudoku grids so
Sudoku puzzle makers have a lot of puzzles to make. Though, this does mean if two Sudoku
puzzles are related to by symmetries and relabeling than those two puzzles should be the same
level of difficulty and require the same sort of solving techniques, which is an interesting concept
to consider when I do Sudoku puzzles from now on.

Bibliography
Felgenhauer, Bertram, and Frazer Jarvis. "Enumerating possible Sudoku grids." (2005)
Felgenhauer, Bertram, and Frazer Jarvis. "Mathematics of Sudoku I." (2006)
Hayes, Brian. "Unwed Numbers." American Scientist 94 (2006)
"The Math Behind Sudoku." Cornell University Department of Mathetmatics. Web. 26 Jan.
2014.
Russell, Ed, and Frazer Jarvis. "Mathematics of Sudoku II." (2006)

Anda mungkin juga menyukai