Sudoku Two Solutions - Telling a Flawed Puzzle from Your Own Mistake
When a finished Sudoku does not match the answer key, either you made a mistake or the puzzle has more than one solution. This article shows the order in which to check: first your own grid for rule breaks, then the givens for copying errors. It also shows, with a table and a grid, the four-cell shape in which two valid answers appear, and why a difference of three cells or fewer can never mean two solutions.
Your answer differs from the key: what to check first
You finish a grid, compare it with the answer key, and a few cells disagree. The natural question is whether you went wrong or whether the puzzle has two solutions. The short answer is that you check your own grid first, and the order of checks is fixed. First, confirm that every row, column and 3x3 box in your grid contains the digits 1 to 9 exactly once. Second, confirm that every given digit from the puzzle is still in place in your grid. Only if both conditions hold and your grid still differs from the key should you suspect the puzzle. If either check fails, the cause is on your side. The reason for starting with your own grid is practical: the checks are quick, and each one gives a clear yes or no. Suspecting the puzzle can wait until you know your grid obeys the rules. This article sets out that sorting procedure, and shows with a table and a grid the shape that two valid answers take on the board.
A Sudoku is meant to have one answer
Two answers count as a flaw because a Sudoku puzzle is built to have exactly one solution. Nikoli, the Japanese puzzle publisher, opens its Japanese guide to the rules and solving methods by stating that the answer is always unique and that logical reasoning will tell you with certainty which digit goes in each cell. Because the answer is fixed, every cell can be settled by reasoning alone, and the puzzle can be finished without guessing. Conversely, a puzzle with two solutions always leaves some cell that logic cannot decide. From that point on, either choice obeys the rules. That is a defect in the puzzle, not a gap in the solver's skill. There is also a known lower limit on givens. In 2012, McGuire and colleagues ran an exhaustive computer search and showed that no puzzle with 16 givens has a unique solution. At least 17 givens are needed. So a puzzle with 16 givens or fewer that you managed to complete certainly has more than one solution. The reverse does not hold. Seventeen or more givens do not guarantee uniqueness; depending on where they sit, a puzzle with many givens can still have several solutions.
Four reasons your answer can differ
The mere fact that your grid differs from the key does not pin down the cause. There are four broad cases, and only the last one is a flaw in the puzzle. In the first, your grid breaks a rule: some row, column or box holds the same digit twice. This happens when a wrong digit goes in partway through and you carry on to the end. In the second, your grid obeys the rules but started from different givens. A slip while copying the puzzle onto paper or typing it into an app is the usual cause. You solved a different puzzle, so of course the answer differs. In the third, the key you compared against belongs to another puzzle, through a mix-up of puzzle numbers or a misprint in the key. In the fourth, your grid and your givens are both correct and the key still disagrees. Only here can you say the puzzle has more than one solution. The table below tells the cases apart by the state of your grid and lists what to do next. Working from the top down clears the cheap checks first.
| Case | State of your grid | Cause | What to do next |
|---|---|---|---|
| A rule is broken | A row, column or box has a repeated digit | A mistake made while solving | Find where the error began and solve again from there |
| Givens differ from the original | Obeys the rules but started elsewhere | A slip while copying or entering the puzzle | Compare each given with the original puzzle |
| The key is for another puzzle | Rules and givens both correct | Mixed-up numbers or a misprinted key | Check the puzzle and key numbers and their source |
| The puzzle has several solutions | Rules and givens both correct | A flaw in the puzzle itself | Treat your grid as one of the valid answers |
The top two rows are causes on your side; the bottom two are on the side of the key or the puzzle. Tell rows three and four apart only after confirming that the key matches the puzzle.
How to check your own grid
Checking your grid comes down to 27 units: nine rows, nine columns and nine boxes, each of which must contain 1 to 9 once. Avoid the shortcut of adding up each column to see whether it reaches 45. Replacing a 1 and a 9 with a 2 and an 8 keeps the total at 45, so a repeated digit slips through. What matters is not the sum but whether all nine digits are present. The easiest way to count is digit by digit. Take the 1s, for example, and trace that there is one in each row, one in each column and one in each box. If the nine 1s never share a row, column or box, that digit passes. Repeat for 2 through 9. If no rule is broken, move on to the givens. Put the original puzzle beside your grid, read the given cells from the top left, and compare each with the same cell in your grid. On a handwritten grid, similar shapes such as 1 and 7, 3 and 8, or 5 and 6 are easy to misread. Note that a repeated digit on a diagonal is not an error. Nikoli's guide states plainly that diagonals play no part in the rules. Do not confuse the standard puzzle with the Diagonal Sudoku variant and reject a correct grid.
Where two valid answers differ
Suppose your grid obeys the rules, the givens match, and it still differs from the key. In that case the differing cells follow a fixed pattern. Compare any two valid grids and every row that contains a differing cell contains at least two of them. The row holds the same nine digits in both grids, so one cell cannot change on its own; another cell in that row must make up for it. The same holds for columns and boxes. The smallest shape that meets this condition is the four cells shown below: the corners where two rows meet two columns, spread over two boxes, holding two digits in a criss-cross pattern. The grid is a finished solution. In rows 4 and 5, columns 3 and 7 hold 2 and 8 crosswise. Swap the 2s and 8s in these four cells and every row, column and box still contains 1 to 9 once. If none of these four cells is a given, the puzzle has two answers. This yields a handy rule of thumb. If your grid differs from the key in only one, two or three cells, the puzzle does not have two solutions. Either your grid or the key breaks a rule.
- Four cells where 2 and 8 can trade places
The four cells where rows 4 and 5 cross columns 3 and 7. After swapping 2 and 8, every row, column and box still holds 1 to 9 once. A puzzle with no given in any of these cells has two answers.
How puzzles with several solutions arise
If puzzles are meant to have one answer, why do flawed ones get published? There are two likely routes. One is that the setter never checked the number of solutions. In a hand-made puzzle, removing a single given can open up a swappable shape like the four cells above, and skipping the verification means nobody notices. The other is loss after the puzzle was made. If a given drops out during printing or copying, the result is a different puzzle from the one the setter checked, and it may have extra solutions. When puzzles are made by computer, recounting the solutions each time a given is removed prevents this flaw, and stopping the search as soon as a second solution turns up keeps the cost low. The puzzles on this site are checked for a unique solution before they are offered. To check a puzzle you have on hand, the reliable method is to enter it into a solver that can count solutions and see whether it finds exactly one. The related article on solvers explains how they search. Entering it wrongly, however, means checking a different puzzle. Compare the grid you typed in with the original once more before you trust the result.
The trap in uniqueness-based techniques
A puzzle with several solutions causes one more problem. Some techniques assume the answer is unique, and the best known is the Unique Rectangle. A Unique Rectangle removes candidates so that the swappable four-cell shape from the previous section cannot remain on the board. It is valid only on the promise that the puzzle has one solution. Used on a puzzle with several solutions, it can remove a candidate that should have stayed. You may then run into a contradiction partway through, or arrive at an answer other than the one in the key. If you look back over your solving steps and find a place where you used a uniqueness-based technique, that may be where you parted ways with the key. Techniques derived only from the row, column and box constraints, on the other hand, never remove a candidate wrongly, even when the puzzle has several solutions, because they use only facts that hold in every solution. When you solve a puzzle of unknown origin, saving uniqueness-based techniques for last is a sensible precaution against such mismatches.
Common mistakes and how to spot them
Four mistakes come up often when sorting out the cause. The first is declaring the puzzle flawed as soon as your answer differs from the key. As shown above, two valid grids differ in at least four cells. If the difference is one or two cells, go back and check your own grid. The second is relying on the 45 sum, which lets repeated digits through. The third is concluding that four or more differing cells prove the puzzle has two solutions. Four differing cells is only one condition for two solutions; a grid with a rule break can also differ in four or more cells. Decide by whether your grid obeys the rules, not by how many cells differ. The fourth is erasing your answer as wrong once you learn the puzzle has several solutions. A grid that obeys the rules and keeps every given is one of the correct answers to that puzzle. The disagreement comes from the puzzle, so there is no need to doubt your method. Still, the puzzle must have contained some cell that logic alone could not settle. Looking back at where you chose a digit can help you notice the places you filled by instinct.