# Minimum steps to verify a Sudoku solution

When checking if a 9x9 Sudoku solution is valid in the absence of an answer key it may not be necessary to check every row, column and 3x3 box.

What is the minimum number of items (rows, columns, or boxes) you must check if the only information you get from a check is whether that specific item is valid?

• This should be an interesting game theory question. Mathematics of Sudoku Feb 4 '16 at 18:40
• I believe the minimum will depend on the question. for some questions, lesser number of numbers were necessary, for some questions you mightn ned lots of extra numbers to solve it.
– Oray
Feb 4 '16 at 19:17
• @Oray I am not trying to solve it. I want to know if a solution is correct as quickly as possible (or something like that). Feb 4 '16 at 19:20
• @StrongBad if checking that a solution is correct, you need to check each box once, that is a total of 81. This can be cut down a bit if you already knew what the initial numbers were. Lets say x numbers were given then you need to check 81-x boxes. Take a scenario where you don't check one of the squares, how can you say for sure that the one you skipped has the correct number? You cannot. Hence you need to check every square once. Feb 4 '16 at 19:24
• There are several solutions already on SO: stackoverflow.com/questions/5484629/… And MO: mathoverflow.net/questions/129143/… Feb 4 '16 at 19:35

Welp, you need to check almost all rows and columns. Proof by counterexample:

Let X be a correct solution. Switch the topleft square with its right neighbour. All rows and boxes still check out but two columns do not. Same for rows if you switch two vertically aligned squares. So you can skip at most one row/column.

The only thing you can skip, after having checked all 9 of one item(say rows), is that you only need to check 8 of the other 2 items(columns and boxes), as it's already clear that there are 9 of each number. Alternatively, after fully checking rows and columns, you can skip boxes 1, 5 and 9(or 3 other boxes so that they do not align)(because there are 3 of the number in the 3 rows/columns it uses, and the other 2 boxes in those rows/columns are checked).

EDIT: That's a mighty useful link, mathoverflow has thought this through a lot. Paraphrasing the pages of text found there:

When you have checked the columns and rows, you can skip some boxes. Having checked the top 3 rows and boxes 1 and 2, you don't need to check box 3. Likewise you don't need to check box 6 if you have 4 and 5, and the bottom boxes are proven correct by having checked the columns and the first six boxes. The last row is proven correct by the bottom 3 boxes and the two rows above it. So you can skip 1 row and 5 boxes for 21 checks total.

• What exactly do you mean by almost everything? Can you show that you can't select which ones you check to lessen the amount of work you have to do?
– Deusovi
Feb 25 '16 at 14:38
• You answer suggests 23 checks (9+8+6) while this question at MO.SE seems to suggests that it can be done in at most 21 checks. That said, I have no idea what is being checked in those answers and I can implement your answer and save 4 checks. Feb 25 '16 at 14:58

this was made obsolete by a subsequent edit

Conjecture: Given a unique solution to a Sudoku puzzle, one must check all squares that are not given in order to confirm its correctness

Proof:

Suppose that only one square on a board does not match the solution. Let us check all other squares that were not "given" (i.e. printed into the puzzle when given to you to solve). All of them will be correct. However, the puzzle is incorrect.

Understand that this refers to the minimum number needed to prove the puzzle is correct. This doesn't consider the minimum number to confirm it is wrong (i.e. 1). I'm assuming the asker isn't referring to that (trivial) value.

Going in response to the edit, here is a partial answer. This a pretty tricky puzzle to nail down an algorithm for that is most efficient. Therefore, I will work by proving more conjectures.

If a row/column is inconsistent then there exists another row/column/block that is inconsistent.

Proof: I'm still thinking about how to phrase it. I need to think about it a while.

• Without an answer key you cannot check a square, you can only check rows, columns and 3x3 boxes. I am interested in the case where there is no answer key. May 23 '17 at 21:58
• @StrongBad where is it stated that I am not given an answer key? May 23 '17 at 22:40
• I think the framing of the question in terms of checking rows, columns, and 3x3 boxes would be a little strange if there was an answer key. I will edit the question to be clearer. May 23 '17 at 22:46
• @StrongBad that makes more sense now. May 23 '17 at 22:48