Sudoku Theory

http://www.sudokudragon.com/sudokutheory.htm

Sudoku
Introduction Sudoku History Strategy Advanced Theory Types Guides Guessing Symmetry News Donate

udoku is all about permutations, but permutations with an extra twist of logic. To look into the theory behind Sudoku you need to first look into permutations.

A permutation is just a particular ordering of symbols. In Sudoku it is insisted that there is only one occurrence of each symbol (or number) in each group (row, column or region). So for two symbols there are only two possible orders {1;2} and {2;1} with three there are six {1;2;3}, {1;3;2}, {2;1;3}, {2;3;1}, {3;1;2} and {3;2;1} possible orders and for four there are 24 permutations of the four symbols. The number of permutations is the Factorial of the number of symbols in the set, as each time an extra element is added to a set of size 'n' that element multiplies up the number of arrangements of the previous set size. So for the standard Sudoku set size of 9 we have 9 factorial (represented in maths as 9!) or 9x8x7x6x5x4x3x2x1 possible permutations which works out as 362,880 possible ways of ordering the nine symbols in a row, column or region.

Dragon Daily Online Forum Help Manual Books Site Map

Properties of permutations
Permutations do not look at all exciting; but from it you can create other permutations by doing one of the following: Swap the symbols consistently In a permutation you can always swap all occurrences of one symbol for another as long as the swap is done systematically and in reverse too. If you swap 4 with 1 then the 1 must be swapped to a 4 (e.g. 4;2;3;1 would become 1;2;3;4). Several or all symbols can be swapped in this way. The result will always be a valid permutation. Here is a 4x4 puzzle with 1;2;3 swapped for 3;1;2 respectively; they are both valid 'Sudokus'.

Sudoku

1 of 13

2/16/2012 9:47 PM

7. they are both valid 'Sudokus'.3) becomes (4. (4 / 3) / 2 is not the same as 4 / (3 / 2). make sure you are up-to-speed on all the main ways of solving the puzzle.3) becomes (4.9.com/sudokutheory.6. has the property that all the numbers in rows and This is also a property of permutations.5. The same is true of multiplication but it is not true of all the simple arithmetic operations.9.4. This is because addition is Associative .5.9.4.1.3. e. For example you can shift the symbol '8' from the start to the end so (8. and if they are multiplied together the answer is always 362. The original related puzzle of Magic squares columns add up to the same number. as both subtraction and division give different results depending on the order that the operations are carried out.8) or swap each element with its neighbor in pairs so (8.2.5.7.7. It has all the features you need to solve puzzles whether you are new to Sudoku or an expert. Read More Shifting the order Permutations are by their nature just an ordering so you can swap the order however much you like and the result is also a permutation.7. column or region the answer is always the same: 45.9.1. if you add up the individual numbers in the set that make up the permutation then this will always give the same result. you always end up with the same result ((5+1)+2) = (5+(1+2)). Today's Dragon Tip Learn the basics Look through our range of easy to follow guides to puzzle solving strategies.2.1.1.6.880 (this is our 9 'factorial' or 9!) 2 of 13 2/16/2012 9:47 PM . it does not matter in which order you add up the numbers.8.htm Solver Download Sudoku Dragon for a free 23 day trial on your PC. Here is a 4x4 puzzle with the bottom two rows swapped.6.sudokudragon.5.6.2.3).g.2. If we add up all the numbers in a completed 9x9 Sudoku row.Sudoku Theory http://www.

it could be any two numbers that add up to 7 (either 2 and 5.840 so dividing this into 362. if there is one number missing and the sum of the other numbers is 40 the missing number must be a '5' to make up the required group total of 45. There is more than one choice of numbers that give the same answer. 3 and 4) in each row.htm This is starting to look useful because if we had a number missing it can be deduced which one it is. 2. This does not work in general as. All Sudoku groups in the 4x4 grid must now multiply up to give a product of 2x3x5x7 = 210 rather than 24. Here are the factorials from 1 to 9 (9!). for '4' use '7' and so on. So a permutation of all the numbers must add up to 10 and the product of all the numbers is 24 (4! factorial).] The problem with deducing missing numbers does not arise if we use a form of Gödel numbers . [Sudoku Dragon supports ten different puzzle sizes including the 4x4 and 16x16 sized puzzles.3..880 we get the answer '7' as the missing number. for '2' use the second prime '3'.9. Before getting any further into any more analysis.com/sudokutheory. In the 4x4 grid. it can't be directly deduced what the numbers are..880.3 the product is 51.sudokudragon. Here we don't just multiply the Sudoku numbers together we use the corresponding prime number.1. Similarly with multiplication. or 3 and 4). the value of missing number this can be deduced by multiplying together all the numbers that are there and dividing this product into 362. for example.5. For example. So the two 3 of 13 2/16/2012 9:47 PM .6. with two missing numbers we convert these to the corresponding prime and multiply them together 3 x 5 giving 15. column and region. Now 210 / 15 = 14. So for a '1' we use the first prime number '2'. the rules are just the same but there are only four numbers (1. Unfortunately. For example if the group is 8. let's simplify by using the 4x4 Sudoku grid rather than 9x9 just to reduce the number of options. for '3' use '5'.2. or 1 and 6. If a Sudoku 4x4 group is 2.Sudoku Theory http://www.4. if two numbers are missing and the total is 38. just like addition we can't use this scheme to determine which of two or more numbers are missing.

they can be colors. 1. We put a binary '1' to indicate the presence of the symbol at the corresponding position.123.092. What is needed then is just a simple 'yes' or 'no' answer to the question 'is the symbol at this position?'.870 (primordial for 9) which means the missing prime number is 17. back in the normal Sudoku world this is '7'. We can use this trick for finding any number of missing numbers in a Sudoku group (of any size) just by a little multiplication and division. Note : the product of all primes up to a specific prime number such as 210 is given a special name : a 'primorial' .4. 3 we convert these to the corresponding prime and multiply them together 19x7x13x2x3x11x23x5 = 13.3. Because of the properties of prime numbers there is only one way of generating 1.870 gives an answer of 1.Sudoku Theory http://www. For the 4x4 grid we can then encode the permutation of 3. To be a well formed Sudoku group the binary combination logical or of all these numbers must give a result of 4 of 13 2/16/2012 9:47 PM . and so the corresponding missing numbers must be 4. 4.1. 2..com/sudokutheory.0001 (for position 3 there is a 1) and 0010 (for position 4 there is a 2). prime. In the case of 9x9 grid we need the next five prime numbers for '5' use '11'.1.. So to work out what is missing from an incomplete row of 8.htm missing numbers multiplied together must give 14 and there are only two numbers that can do that 2 and 7. for '8' use '19' and for '9' use '23'.2 as four binary numbers: 0100 (for position 1 there is a 3). Sudoku can be done with any old symbols not just numbers. 5. 6. Using the corresponding 'encoding' table shows that '1' (for the 2) and '4' (for the 7) are the missing numbers.1000 (for position 2 there is a 4).6.8 the Gödel number using our encoding gives 170. Now try a Sudoku group with three numbers missing 9. for '6' use '13'.092.sudokudragon. shapes. 5 and 7.. the puzzle is more general than that.430 dividing this into the full product 223. we can't make a prime number by multiplying two other numbers together. 9.2.309.309 using prime numbers and that is by multiplying 7 x 11 x 17. This can then be easily encoded into a binary '0' or '1'. Why does this work? Because prime numbers are well. Having looked at traditional 'arithmetic' to investigate the properties of Sudoku it is worth looking for a different and thankfully simpler analysis. for '7' use '17'. We shouldn't get hung up about using 'numbers'. pictures: anything as long as they are distinct and there is only one in each group.110 but the product of all the numbers must be 223.

This can then be used to find missing numbers. brushing hair. and they can be done in any order.. 5 of 13 2/16/2012 9:47 PM . more mathematical sense we could treat each symbol as a move along a vector.sudokudragon. These are chosen so that the end result of completing all these steps takes you back to where you started.com/sudokutheory. '3' as move W 2 units and '4' move E 2 units. Other vectors could have been chosen. a group with 2. brush hair.2.htm 1111 to confirm that each of the four symbols has occurred once in all four positions in the group. If you think of these as a permutation with numbers 3. Just like addition the moves can be done in any order to achieve the same end position. so we can now tell at a glance that it is a '4' and a '1' that are the missing numbers as they correspond with the missing symbols represented by '0's. So rather than using Gödel numbers the same can be applied to Sudoku much more easily using boolean 'yes/no' questions. An 'operation' is in terms of moving a certain amount in a certain direction. To make this more everyday consider four operations : getting dressed. We might do each of these once every morning. This approach allows missing moves to be deduced by just combining the known moves and working out how to get back to the original point.0100. That's established the idea of thinking of a permutation as a sequence of operations done in time order rather than symbols. This is important as it makes the sequence of operations into a mathematical concept known as a 'ring' in group theory . collecting the post and eating breakfast. Applied to Sudoku this can be used to work out which numbers are missing. eat breakfast.Sudoku Theory http://www. Looking at this in a simpler. Other examples of these sorts of patterns are square dances where after a number of moves.. A permutation is just saying that you need to perform a set of operations only once but in any order. twists and turns you end up where you started. would be translated as 0010.. So we could use '1' as move 2 units N . get dressed.4.1 might represent collect post. logically ored together gives 0110. '2' as move 2 units S.3.. Actions and Operations There is another way of looking at permutations and symbols. You can think of the contents not as symbols but as operations to perform.

9) and it is the pattern of these subsets that are used to deduce additional constraints on the possible content of the squares. .1} and {1.4. If the possibilities were {1. if the possibility subsets were {1. This is the simplest case of how analysis of possibilities can be helpful in reducing the options. Therefore the square with {4. column and region. . By using the knowledge that a symbol may occur only in a subset of the squares we cannot deduce where exactly it can go but deduce where it cannot go.9 these could on their own occur in any permutation within the squares. The complexity comes from applying the restriction of a single group into a two dimensional grid.4. for example. {1.4} {4.9} and {4. Each of these is a subset of the missing numbers (1. there are two squares with these two possibilities and this means that the '1' must go in one of the two places and '8' in the other place.8.9} for the four empty squares.9} then the first three form a chain of 6 of 13 2/16/2012 9:47 PM . Each unused symbol must be possible in one or more squares in a group.8} {1. .8.9}.6. The rule is that if there are 'n' symbols and all possibilities for these symbols are located in a subset of 'n' squares within a group then we have a sub-group of possibilities. reduce the choice down to {1.sudokudragon. There are then three constraints on each squares: it must be unique to the row.8} {4. Apart from the twin example there is the 'chain'. Other groups (columns.8. For example.4.8.4. {4.5 the four missing numbers are 1.8} is an example of a 'naked twin'. Each unsolved square can have one or more possibilities. Sudoku Possibility Analysis Apart from the simplest cases (where only one choice is available) solving a Sudoku puzzle involves analysing permutations. However taking the other groups that share squares with this group reduces the number of possibilities.4.8}.Sudoku Theory http://www. regions) may.3.8. .9} as the '8' can't occur there. So for a row having 7.com/sudokutheory.htm If Sudoku were just a matter of single groups of symbols then it wouldn't be much of a challenge.2. General possibility rule The 'naked twin' rule is just the simplest example of a general rule for Sudoku possibilities.9} as possibilities can be safely restricted down to {4.8. If we look at a Sudoku group on its own then all the unused symbols can occur in any of the unsolved squares.8} {8.9} then {1.8} and {1.

9} {1.1} in a group this is just saying the allocation is either {1} and {4} or {4} and {1} so the 1 and 4 can not occur anywhere else.9} and {4.9} as possibilities for that square then the combined constraint for the square is just 4 or 9 {4. This makes it a very useful rule. The knowledge that a {4} must go in the square can be fed back into the constraints for the three groups as it precludes {4} being a possibility anywhere else in these groups as well.9} are the possibilities for a square in the column and the row it is in gives {2. The simplest example of this is the X-Wing.8} and preclude the occurrence of these symbols in the last square.4. Each square is a member of three groups (row.4.9}.sudokudragon.5} in the top row A.4.8} then the three squares form a triplet of {1.Sudoku Theory http://www. So if a column requires that {1. A chain is a closed loop of symbols that imply that the symbols must occur only in this group but it can not be determined where precisely the numbers go.4} and {4. but because of the shared groups it is in.9} and the other square must be '8' as 4 must be allocated in the triplet. In this example taken from a 9x9 grid.5} then that would leaves {4} as the only possibility that meets the requirements of the row.9} {1.4. If the region gives possibilities {3. column and region) and the rules for one group apply equally to the other groups.com/sudokutheory.4. one region has two naked twins {4. If the possibilities form a particular pattern then the corners of the box must be in one of only two configurations. column and region. The Sudoku rules are applying a two-dimensional constraint involving four groups (two rows and two columns) because of the X-Wing. Some of the constraints are 'indirect' meaning that the implication for one square will limit what can go in another square. Using the twin rule 4 can not occur in the four other unallocated squares and 5 in three of the remaining squares. Here four groups are logically inter-linked to form a 'box'.htm the symbols {1.4.4. The same logic applies to 3 or more symbols it is not limited to just two. In the case of {1. If we had {1.4. This can become even 7 of 13 2/16/2012 9:47 PM . The usefulness does not end there. in this case the last square becomes a 'single possibility' square as it must be '9'. Beyond the linear dimension Much of this analysis so far has looked at one Sudoku group in isolation.

Sudoku Theory http://www. Both humans and computers struggle to find these interdependencies between possibilities. The puzzle has only 21 revealed 8 of 13 2/16/2012 9:47 PM . Pattern matching problems like Sudoku belong to the class of the difficult problems to solve : The NP complete class . Luckily most Sudoku puzzles can be solved without needing to work them out. This is difficult to determine as there are a number of advanced solution strategies available that need to be tried before being certain that this is the case.sudokudragon. it cannot do it as a single linear scan of the permutations. The simplest algorithm is the trial and error method which checks all the possibilities in turn without looking for rules such as excluded possibilities or only square. This is not just for humans. This can take a very long time to do as there just so many to check . The time taken to solve NP complete problems does not grow linearly with problem size it grows exponentially. There is no simple 'trick' that a human or computer can use to solve Sudoku puzzles in general.htm more complicated as even more groups can become involved. Finding patterns within these permutation subsets is definitely a 'hard' problem. it is just as tough for computers too. It is not symmetric and so can be considered not a valid Sudoku. These cyclic dependencies result from the ways that squares are connected via groups into interconnected grids. The asymmetry can make puzzles harder to solve. To spot a 'twin' a computer needs to look through all possible combinations of two squares in a group. What is the most difficult Sudoku puzzle ever discovered? To be genuinely hard to solve a puzzle must reveal the minimum number of squares and still have a unique solution. Any analysis has to look through all the possible combinations. if you find a way you will become a multi-millionaire.com/sudokutheory. If it takes 2 seconds to solve a problem of size '3' it will take much more than 4 seconds to solve a problem of size '6'. Here is an example of a truly difficult standard puzzle that you might like to try to solve. There are many examples of puzzles that are not 'solvable' without having to make a guess on the content of the square.the crudest algorithm would work through something like 10 to the power 47 combinations (that's 10 with 47 noughts after it).

9 of 13 2/16/2012 9:47 PM .com/sudokutheory... Many puzzlers reckon that having a large empty space in the middle creates some very tricky puzzles. If so then surely this must qualify as one of the hardest possible puzzles to solve.htm squares. To download this puzzle and see it in Sudoku Dragon click here. It is reckoned that the hardest possible Sudokus have 17 or 18 'given' or initially revealed squares. To download this puzzle and see it in Sudoku Dragon click here.. It has just 22 revealed squares.Sudoku Theory http://www..sudokudragon.

this may be provable to be an impossible starting arrangement.com/sudokutheory.sudokudragon. 10 of 13 2/16/2012 9:47 PM .htm The 4x4 Puzzle There is nothing all that special about 9x9 Sudoku puzzles. I have never seen a 4x4 with only 3 initial squares revealed .Sudoku Theory http://www. The minimum number of squares that can be revealed and still produce a solvable puzzle is four. it just happens to make an interesting Sudoku puzzle that can be solved in a reasonable time. However it is possible to choose a smaller or larger size of grid. With 4x4 there are only 16 squares in total and it is impossible to create a difficult puzzle.

naked twins.com/sudokutheory.sudokudragon. excluded sub-group. All the strategies you might use for solving 9x9 can be adapted to the larger 16x16 grid. But with practice these grids can become quite straightforward to solve too. For example the 'two out of three' strategy becomes the 'three out of four' strategy. excluded hidden twins. only square. It becomes much harder for mere humans to solve when there are 16 rather than 9 numbers/symbols to reason about. You can still use all the basic strategies : only choice. 11 of 13 2/16/2012 9:47 PM .Sudoku Theory http://www. X-Wing and all the advanced strategies.htm The 16x16 Puzzle Moving to larger than the regular 9x9 puzzle size introduces nothing new other than more possibilities to work through. single possibility.

g. 81x81. six 2x3 blocks). a 5x5 puzzle can not be subdivided in any different way). Sudoku Dragon supports 2x3. 25x25. in fact the only grid sizes that can't be used are those that are prime numbers and so can't be divided up into a rectangular block (e. The rules are generic and by mathematical induction it can be shown that they just grow and grow. 10 and 14 respectively.000 squares in the puzzle). 100x100 (10.sudokudragon. 3x5. 20. The same can be done with many other sizes (e. The symbols used are 0 to 9 and A to D The Smallest Sudoku Puzzle 12 of 13 2/16/2012 9:47 PM . One rectangular Sudoku is made up of 3x5 blocks arranged as three blocks wide and five blocks deep giving 15 regions in all. 2x5 and 2x7 rectangular block puzzles giving puzzle sizes of 6. Keeping to a square arrangement the number just goes up in squares : 16x16. 36x36 (over a thousand squares to complete). 49x49. 4x5. 2x4.g. 8.htm Larger Sudoku Puzzles There is no theoretical limit on the size of a Sudoku puzzle. 3x5. Please refer to our Theme and Variations page for more strange and interesting forms of Sudoku. Rectangular Puzzles A set of same sized rectangles can be arranged into a square puzzle grid. 15. Here is an example of a 14x14 grid made up two stacks of 2x7 squares.Sudoku Theory http://www.com/sudokutheory.

htm For the pure mathematicians amongst you. even though it is rather academic. easy to follow guides. Mathematicians may appreciate the symmetry as it shows that the Sudoku rules are general for any group size including 1 upwards. It just happens that 1 is a seriously simple puzzle to solve! See also: Sudoku Solvers A range of mathematical puzzles and solvers.sudokudragon. it may be interesting to note that from a pedantic point of view 4x4 is not the simplest size of Sudoku puzzle. It can help you quickly identify square possibilities and exclude the ones that actually are impossible. If instead of all groups having 4 squares in it we have just 'one' square then. the 1x1 sudoku puzzle has 1 row and 1 column with 1 symbol occurring just once in each row and column. ny comments on this page ? Click here to contribute Copyright © 2005-2012 Sudoku Dragon 13 of 13 2/16/2012 9:47 PM .com/sudokutheory.Sudoku Theory http://www. All the main Sudoku strategies have clear. There is only one region with 1 square in it. Give our SudokuDragon puzzle solver a free 23 day trial by visiting our download page. So there is only one Sudoku puzzle of size 1 and the solution is 1.

Sign up to vote on this title
UsefulNot useful