I'm trying to solve a computer science challenge and have readily been able to validate whether or not the outside dimensions of a sudoku puzzle are valid. However, it doesn't check the validity of the inside squares and will "validate" the following incorrect sudoku puzzle because the 3x3 squares are not unique 1-9:

[1, 2, 3, 4, 5, 6, 7, 8, 9],

[2, 3, 4, 5, 6, 7, 8, 9, 1],

[3, 4, 5, 6, 7, 8, 9, 1, 2],

[4, 5, 6, 7, 8, 9, 1, 2, 3],

[5, 6, 7, 8, 9, 1, 2, 3, 4],

[6, 7, 8, 9, 1, 2, 3, 4, 5],

[7, 8, 9, 1, 2, 3, 4, 5, 6],

[8, 9, 1, 2, 3, 4, 5, 6, 7],

[9, 1, 2, 3, 4, 5, 6, 7, 8]

My question is this: if a sudoku puzzle has all valid columns and rows in the 9x9, is there a way to grab a single other set of values from the puzzle (say, for instance, the first 3x3) and know the whole puzzle to be correct? Or must one check every 3x3 for an otherwise valid whole puzzle square?


Suppose you have valid Soduko. Now swap rows 6 and 7.

The "outside measurements" are still all valid. The 3, $3\times3$ boxes along the top are valid, but the remaining 6 likely are not.

  • $\begingroup$ I have clarified the question title from being "outside" dimentions to Can a sudoku with valid columns and rows be proved valid without evaluating every 3x3 inside it?". Your step will produce incorrect columns, if, say, swapping the 6 and 7 in the first row. $\endgroup$ – AuroraTertius Nov 18 '16 at 19:13
  • $\begingroup$ Not swapping the 6 and 7 in the first row. Swapping the entire 6th and 7th rows. $\endgroup$ – Doug M Nov 18 '16 at 19:25
  • $\begingroup$ Yes, but this still doesn't address my question, or at least the question I mean to ask. In the example I provided, there are no valid 3x3s. Swapping any two rows in my example keeps the whole row x whole column solution valid, but these were all invalid 3x3s to begin with. Maybe one way to clarify would be "can all rows and columns be correct, and any one 3x3 correct without ALL 3x3s being correct? I didn't want to be that specific though, because maybe there's something other than finding a single correct 3x3 that will otherwise validate the whole puzzle. $\endgroup$ – AuroraTertius Nov 18 '16 at 20:14
  • $\begingroup$ After reviewing, I think Doug has the proper counter example to my question as to whether a puzzle can be row correct and column correct, but not 3x3 correct. Swapping the 6th and 7th rows of an otherwise valid puzzle can readily destroy a previously 3x3-correct puzzle. If there is a way, it will not come it seems of inspecting any one correct 3x3 in a row/column correct puzzle and inferring that the whole puzzle is correct. $\endgroup$ – AuroraTertius Nov 18 '16 at 21:04

As proved in https://mathoverflow.net/q/129143, it is insufficient in general to additionally check three (or less) of the $3\times3$ blocks.

On the other hand, it is enough to check four blocks: for instance, the three blocks on the diagonal and one more block.

Together with rows and columns, this makes $9+9+4=22$ checks. It is in fact possible to make do with 21 checks (e.g., by checking suitable 6 rows, 6 columns, and 9 blocks). This is the best possible, as is also proved at the linked page.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.