what do we know mathematically about soduko

sao123

Lifer
May 27, 2002
12,649
202
106
I was solving a soduko puzzle last night and it got me thinking...

Do we know if there is a way to prove each puzzle is guranteed exactly one unique solution?

It seems to solve this we would need to know a lot of variables.

Firstly we would probably have to computer the exact number of all possible valid solutions.

I was thinking it would be easiest to estimate (possibly find exactly) by first starting with a 10 digit seed. A seed would be valid if and only if, it is exactly 10 digits and has the all 10 digits appear exactly once. Then developing a tree of all possible valid solutions for that seed. Then we could multiply that by the number of all possible seeds.

From this tree we could hopefully determine the minimum number of starter numbers needed to ensure that this puzzle selects a unique valid solution from the tree.

Im sure the details are far more grueling or possibly easier if you can do it with some matrix operations (which i suck at terribly)... but has anyone given this any thought or even made an attempt?
 

imported_inspire

Senior member
Jun 29, 2006
986
0
0
I've thought about it before, yeah - the first time I tried Su Doku, I thought to myself, "I bet I could write and iterative proggy using low-level rules and zip right through this." Turns out that depending on the seed values, that can be either very easy, or very hard.

Likewise, the question of whether there exists a unique solution would be one that depended on the seed values. N-dimensional matrices would certainly help. Trees sound useful, too.

What would be more puzzling is the maximum ratio of open tiles to seed tiles necessary to obtain a unique solution for each tileset (board size). I wonder if such a ratio is fixed or how it behaves.

Almost certainly this sounds like number theory and abstract algebra, but modeling usually gives us a good idea of what's going on. Then, the abstract layer can be proven.

I'll have to read that article sometime. I'm willing to make an attempt at writing a program or digging deeper into this if you guys don't mind brainstorming algorithms. I can code C++ and JAVA and IML in SAS - I deal a lot with matrix operations - I'm studying for an M.S. in Biostatistics.
 

videogames101

Diamond Member
Aug 24, 2005
6,777
19
81
You just use the start numbers and put every possible number in each box and it narrows itself until it's done. Takes longer then solving it, lol.
 

sao123

Lifer
May 27, 2002
12,649
202
106
Originally posted by: inspire
I've thought about it before, yeah - the first time I tried Su Doku, I thought to myself, "I bet I could write and iterative proggy using low-level rules and zip right through this." Turns out that depending on the seed values, that can be either very easy, or very hard.

Likewise, the question of whether there exists a unique solution would be one that depended on the seed values. N-dimensional matrices would certainly help. Trees sound useful, too.

What would be more puzzling is the maximum ratio of open tiles to seed tiles necessary to obtain a unique solution for each tileset (board size). I wonder if such a ratio is fixed or how it behaves.

Almost certainly this sounds like number theory and abstract algebra, but modeling usually gives us a good idea of what's going on. Then, the abstract layer can be proven.

I'll have to read that article sometime. I'm willing to make an attempt at writing a program or digging deeper into this if you guys don't mind brainstorming algorithms. I can code C++ and JAVA and IML in SAS - I deal a lot with matrix operations - I'm studying for an M.S. in Biostatistics.


I theorize that using any given seed, that the tree shape and depth would be pretty consistent without dependency to the choice of seed. If this is true, there should be a constant minimum for the ratio you speak of. I think this shall be a worthy effort.


To begin I think ill code an app which will compute and list all possible seeds numbers in the range 123456789 to 987654321, of which there should be exactly 9! valid seeds.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
making a program to slove soduko should be pretty trivial, the aproach is entirely algorithmic, would probably take only an hour or 2 to nail down a functional algorithm to solve Sudukos in a reasonable amount of time.
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,606
166
111
www.slatebrookfarm.com
I've pondered whether or not there is a "simple" way to solve Sudoku puzzles.. Seeing the phrases "unique solution" and "matrix" near each other should get any math person started thinking about linear algebra... I've just never had the time to play around with it.
 

Laputa

Golden Member
Jan 18, 2000
1,775
0
0
Using square matrix and linear algebra method of approach will be the right path, but you can also use a quicker approach since all 9 of the 9 squares must counter balance each other. It's like selecting 9 consective numbers and put them into a 3x3 square and each number can only take place at one spot. However, how you balance them so that the 3 numbers will add up equally vertically and horizontally is what really matters. If you use boolean algebra and combine it with linear algebra, the process will become much simpler since that single number can be legally place there or you can't.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
you really don't need any math simply so solve a suduko, jsut tell the computer to run the same algorithm you do when you solve one. There are simple rules which govern this game, tell the computer to follow them until it reaches a point where it would be forced to guess, then simple push all the guesses onto a stack and solve them like they were origional puzzles. If you are using a resonable starting matrix which is designed so that you don't ahve to make 10 guesses and there are 1000 possible solutions then the computation time shouldn't be bad.

Perhaps this does not solve for every single one imaginable, but it would deffinitely be able to get anything you would find in a suduko book. (Obviuosly if you tries to run it on a blank matrix it would simplly generate EVERY single possible solution which would take a very large amount of time)
 

CycloWizard

Lifer
Sep 10, 2001
12,348
1
81
I noticed that the beta version of MS Office 2007 has a Sudoku solver functionality or example...

I would think it's pretty trivial to solve such a puzzle using a computer. I've never really done Sudoku, but I think I have a general idea of the rules and how it works. I think that each number (1-9) can only appear once per row, once per column, and once per 3x3 sub-matrix. Thus, perhaps the simplest (albeit not the most efficient approach) would be to substitute numbers until the sum of each row/column is equal to 45 (1+2+3+4+5+6+7+8+9) with the constraint on the digits in the 3x3 matrix. A computer could surely solve it faster than a person using this method, though I'm sure there's a more efficient algorithm out there.

The minimum number of seeded numbers for a unique solution would be the number required to ensure that the rank of the matrix is 9. I'd have to do some thinking to figure out what this minimum would be, though it would probably depend on the locations and values of the seeds.
 

sao123

Lifer
May 27, 2002
12,649
202
106
maybe someone misunderstood me...


Im not looking to solve soduko puzzles... I know how to do that quite effectively.

I want to know the math theory behind them so I can create them based on a random seed, and be sure i give enough clues to ensure that the puzzle I create has exactly one unique solvable solution.
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,606
166
111
www.slatebrookfarm.com
Yes, I know I could program a computer to use the typical algorithm that most people use when solving these puzzles... what I'm more interested in, is a question similar to the OP's - is there a more elegant method of solving these?
 

Born2bwire

Diamond Member
Oct 28, 2005
9,840
6
71
Originally posted by: DrPizza
Yes, I know I could program a computer to use the typical algorithm that most people use when solving these puzzles... what I'm more interested in, is a question similar to the OP's - is there a more elegant method of solving these?

/me steals idea.

This sounds like something I could get funding for! To DARPA, quick!
 

MrDudeMan

Lifer
Jan 15, 2001
15,069
92
91
Originally posted by: DrPizza
Yes, I know I could program a computer to use the typical algorithm that most people use when solving these puzzles... what I'm more interested in, is a question similar to the OP's - is there a more elegant method of solving these?

yes - there are several techniques and several webpages with better information, but that is just an example. i used the x-wing technique today as a matter of fact.
 

DrPizza

Administrator Elite Member Goat Whisperer
Mar 5, 2001
49,606
166
111
www.slatebrookfarm.com
By more elegant, I was referring to a method that didn't involve steps such as what you linked to...
I'm looking for a more mathematical solution.

The only thought I had put into it was to simply assign a relatively prime number to each of the digits 1-9. Then, I stopped thinking about it. Thus, when you're thinking, "well, this column has all these numbers, this square has all these numbers, this row has all these numbers..."
I'm employing some process where I'm multiplying and dividing... if I come up with 35, then I know there are two possibilities: 5 or 7. I'd think that using some process or combination of processes from linear algebra, eventually I or someone better at math than I am, could come up with a very simple algorithm that didn't rely on a lot of recursive steps.
 

BrownTown

Diamond Member
Dec 1, 2005
5,314
1
0
EDIT: im confused again, but anyways, use 2^x to represent the nubmers, not prime numbers.
 

AyashiKaibutsu

Diamond Member
Jan 24, 2004
9,306
3
81
I wrote a program a few years ago that solved this. Basicly, I made a 3 dimensional array with the first two being the game board and the third being the possible solutions for each square that didn't break the rules. Then I had an algorithm that went through and filled in the results.
 

eLiu

Diamond Member
Jun 4, 2001
6,407
1
0
My understanding is that solving Sudoku problems is NP-complete and hence the only known solutions are brute force & some ugly polynomial time. It also means that if you find the "elegant" solution to Sudoku, you'll be damn famous b/c you'll have solved ALL NP problems

Edit: To clarify a little, I think this is the simplest example of an NP-complete problem: given a set of integers, can you find a subset that sums to some value X? There's no obvious, fast way to do this (and as far as theoretical CS/math know, there's no fast way to do this period.)

Now you're going to say... who cares about polynomial time? It's a 9x9 grid!
Well you can "generalize" sudoku and make much bigger grids

It's trivial to write a solver that works (but not trivial to write an efficient one... see above); I think it took me all of an hour... a friend of mine did it even faster for some kind of CS contest. But again all the algorithms here are brute force with some minor tricks applied, which are not the kind of 'elegant' solutions DrPizza is wondering about. So yeah... the NP-completeness means that the best method we know about is to try every possible solution. Granted there are some small tricks to speed this up somewhat, but ultimately... nothing special.

As for uniqueness... I think they found that 4 given #s short of a full grid is the maximum number you can specify and still not have a unique solution. But the minimum # of specfied #s without a unique solution is still unknown--empirically it's in the high teens.

If you wiki for sudoku or mathematics of sudoku or something like that, you'll find a wealth of information that I won't bother repeating any further.
 

imported_inspire

Senior member
Jun 29, 2006
986
0
0
Originally posted by: DrPizza
By more elegant, I was referring to a method that didn't involve steps such as what you linked to...
I'm looking for a more mathematical solution.

The only thought I had put into it was to simply assign a relatively prime number to each of the digits 1-9. Then, I stopped thinking about it. Thus, when you're thinking, "well, this column has all these numbers, this square has all these numbers, this row has all these numbers..."
I'm employing some process where I'm multiplying and dividing... if I come up with 35, then I know there are two possibilities: 5 or 7. I'd think that using some process or combination of processes from linear algebra, eventually I or someone better at math than I am, could come up with a very simple algorithm that didn't rely on a lot of recursive steps.

I'm thinking 'Cyclic Groups' right now. I'm not sure how that works out, but that's my gut instinct. I haven't had much time to think about it, but I'm sure that if we put our heads together, we can figure something out.

 

gbuskirk

Member
Apr 1, 2002
127
0
0
This question may be along the lines the OP intended: There are many symmetries in the Sudoku grid, and the set of 9 symbols can be shuffled. Suppose we have an algorithm to normalize any minimal solvable puzzle to a unique representative for its equivalence group. How many unique normalized minimal solvable Sudoku puzzles are there?
 

imported_inspire

Senior member
Jun 29, 2006
986
0
0
I would think we'd have as many normalized unique solvable Sudoku puzzles as we have normalized unique solutions, but that would require more than a warm fuzzy to proove. But it does seem like it might be trivial...
 

Thraxen

Diamond Member
Dec 3, 2001
4,683
1
81
I have a question for the math whizzes in here. What is the minimum number of numbers that can be provided at the start in a Sudoku puzzle that will still ensure only a single possible solution? That's something I've wondered about before but have no real idea how to solve such a question myself.
 

sao123

Lifer
May 27, 2002
12,649
202
106
Originally posted by: Thraxen
I have a question for the math whizzes in here. What is the minimum number of numbers that can't be provided at the start in a Sudoku puzzle that will still ensure only a single possible solution? That's something I've wondered about before but have no real idea how to solve such a question myself.

that was part of my original question, in order to solve it, it seems we must examine a set of solutions to determine a geometric pattern.
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |